siplasplas
A library for C++ reflection and introspection
Static-reflection

Access to static reflection information. More...

Classes

class  cpp::static_reflection::meta::Class
 Stores static reflection information of a given class. More...
 
class  cpp::static_reflection::meta::Enum< SourceInfo, EnumType, Constants, ConstantsNames >
 Stores static reflection information of an enumeration type. More...
 
class  cpp::static_reflection::meta::Field< SourceInfo, F, field >
 Stores static reflection information of a member object. More...
 
class  cpp::static_reflection::Field< FieldType, field >
 Returns static reflection information of a given pointer to member object. More...
 
class  cpp::static_reflection::meta::Function< SourceInfo, FunctionType, function >
 Stores static reflection information of a non-const member function. More...
 
class  cpp::static_reflection::Function< FunctionType, function >
 Returns static reflection information of a function. More...
 
class  cpp::static_reflection::meta::SourceInfo< Entity_, Kind, FullName, Spelling, DisplayName, File, Line >
 Stores source information of an entity. More...
 
class  cpp::static_reflection::Class< T >
 Returns static reflection information of a given class. More...
 
class  cpp::static_reflection::Enum< EnumType >
 Returns static reflection information of the given enumeration type. More...
 

Enumerations

enum  cpp::static_reflection::Kind {
  NAMESPACE, FUNCTION, ENUM, CLASS,
  FIELD, UNKNOWN
}
 Represents the different types of entities (namespaces, classes, functions, etc) the library can collect static reflection information. More...
 

Detailed Description

Access to static reflection information.

This API gives access to the reflection metadata collected by DRLParser at compile time. The APi works by declaring a template for each kind of entity supported by the reflection engine (Class, Enum, Field, etc) in the namespace cpp::static_reflection. These templates expect the entity to be reflected as parameter (The class type, the enum type, the member function pointer, etc), with the instance having access to the metadata of the given entity:

For the specifics about the metadata returned for the different kinds of entities, see the templates declared in the cpp::static_reflection namespace.

How the API namespaces are organized

The static reflection API reads the metadata scanned by DRLParser. This metadata is represented (stored) as instances of the different templates of the cpp::static_reflection::meta namespace.

That metadata is not declared nor accessed directly by the API but the code generated by DRLParser declares specializations of cpp::static_reflection::codegen templates that contain the metadata (the cpp::static_reflection::meta instances). This codegen templates are specialized for each type found in the processed header (So the parameters are supposed to be unique, an "index" to the metadata).

The static reflection API (cpp::static_reflection templates) indexes metadata through the cpp::static_reflection::codegen templates.

TL;DR:

Why codegen middle layer?

The codegen namespace is designed to abstract the reflection metadata representation from the user API, so the backend can be changed to use other reflection methods. Currently, all the metadata access is directly implemented in meta, but codegen can be used as a translation layer if the metadata backend changes.

Examples

Enumeration Type Documentation

Represents the different types of entities (namespaces, classes, functions, etc) the library can collect static reflection information.

See cpp::static_reflection::meta::SourceInfo.