COmpile Time Property Tree (cotprot) is a library to construct trees of objects with properties at compile time. It contains a small domain specific language to declare types and construct trees out of those types. By directly embedding c++11 lambdas to the tree construction behavioural aspects can be added directly. This avoids any additional scripting language or runtime environment. The resulting binary will be small and efficient to execute.
The library is still in development and not yet useable
cotprot is all about objects with properties (and children).
Trees like that are very common in UI toolkits or similar libraries that can be used or configured through composition. In the past such a composition is often done in XML with the help of dedicated editors or domain specific or dynamic languages like javascript or QML and is shipped with the executable binary that uses the library. Because of that the tree configuration has to be restored from its textual form during runtime. This requires parsing and despite all the existing advances in language design and parser research, those libraries tend to be really bad at that - mostly by reinventing their own solutions. Additionally libraries that rely on a tree configuration frequently offer some form of attachable programmability. This is usually solved by adding scripting languages like again javascript or lua to the tree configuration format. With that types and functions from the library or added by the user require runtime mapping to the embedded language. Now even when the tree configuration will remain constant throughout the life-time of the application it will be parsed and interpreted using some form of additional runtime environment over and over again.
The library proposed here tries to solve the original problem without incurring unnecessary runtime or memory waste. By constructing the tree using meta programming techniques, the tree structure can be compiled with the rest of the application.
Because the structure is known at compile time allocation can be vastly simplified - reduced to a single memory allocation in theory. Because of C++ lambdas there is no need for embedding another language. Hence no memory is wasted for a second runtime. No cycles are wasted to start up or tear down a scripting environment. No cycles are wasted to parse or interpret anything... Still the tree will be specified in a readable format.
Project information
- Maintainer:
- Andreas Pokorny
- Driver:
- Andreas Pokorny
- Licence:
- MIT / X / Expat Licence
View full history Series and milestones
trunk series is the current focus of development.