Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attribute & Reflection libraries for C++?

Most mature C++ projects seem to have an own reflection and attribute system, i.e for defining attributes which can be accessed by string and are automatically serializable. At least many C++ projects I participated in seemed to reinvent the wheel.

Do you know any good open source libraries for C++ which support reflection and attribute containers, specifically:

  • Defining RTTI and attributes via macros
  • Accessing RTTI and attributes via code
  • Automatic serialisation of attributes
  • Listening to attribute modifications (e.g. OnValueChanged)
like image 387
Fabian Avatar asked Sep 17 '08 21:09

Fabian


1 Answers

There is a new project providing reflection in C++ using a totally different approach: CAMP. https://github.com/tegesoft/camp

CAMP doesn't use a precompiler, the classes/properties/functions/... are declared manually using a syntax similar to boost.python or luabind. Of course, people can use a precompiler like gccxml or open-c++ to generate this declaration if they prefer.

It's based on pure C++ and boost headers only, and thanks to the power of template meta-programming it supports any kind of bindable entity (inheritance and strange constructors are not a problem, for example).

It is distributed under the MIT licence (previously LGPL).

like image 154
Laurent Avatar answered Oct 09 '22 08:10

Laurent