Reflection.hpp

Support for defining reflection for types.

All reflected classes need DECLARE_REFLECTION in their declaration, (non-Dynamic types are reflected using DECLARE_STATIC_REFLECTION outside), these macros are provided in Reflection.h.

These macros unconventionally end in a function declaration without braces, the braces, and contents, are expected to be provided to define properties and otherwise initialize the class.  The function will be run to setup the class when <Class.LoadClasses> is called.  The function is a member function of the Class types Class::DescriptionHelper, which are designed to simplify registering contructors, properties, and metadata about the type.  See PersistentClass::DescriptionHelper.Properties for the prime example of how and why this is useful.

Note: You must #include the .hpp files of any classes you are defining reflection for to get the definitions of their DescriptionHelpers.

Summary
Reflection.hppSupport for defining reflection for types.
Macros
DEFINE_REFLECTIONDefines the reflection support for a type using its class’ DescriptionHelper.
DEFINE_TEMPLATE_REFLECTIONDefines the reflection support for a templated type using its class’ DescriptionHelper.
DEFINE_PRIVATE_REFLECTIONDefines the reflection support for a dynamic type, allowing the reflecting (class object) type to be privately specialized.
DEFINE_STATIC_REFLECTIONDefines reflection for a non-dynamic type.

Macros

DEFINE_REFLECTION

Defines the reflection support for a type using its class’ DescriptionHelper.

Parameters

TYPEThe fully qualified type (namespaces and everything).
NAMEThe name the class will be registered as.

Usage

#include <reflect/Class.hpp>

DEFINE_REFLECTION(MyClass, "MyClass")
{
   ReflectConstructor();
   ...
}

See Also

DEFINE_TEMPLATE_REFLECTION

Defines the reflection support for a templated type using its class’ DescriptionHelper.

The difference between this macro and DEFINE_REFLECTION is the template<> specialization markers required for template class defintions.

Parameters

TYPEThe fully qualified type (namespaces and template args).
NAMEThe name the class will be registered as.

Usage

#include <reflect/Class.hpp>

DEFINE_TEMPLATE_REFLECTION(MyClass<3>, "MyClass")
{
   ReflectConstructor();
   ...
}

See Also

DEFINE_PRIVATE_REFLECTION

Defines the reflection support for a dynamic type, allowing the reflecting (class object) type to be privately specialized.

This is usually used when defining the reflection for subclass of Class, because the class <Category> of the class does not need to be defined publicly.

Parameters

TYPEThe class type (fully qualified)
NAMEThe name the class will be registered as.
CLASSTYPEThe type of class reflecting this one.  (must subclass the type inferred from the declaration)

See Also

DEFINE_STATIC_REFLECTION

Defines reflection for a non-dynamic type.

Parameters

TYPEThe class/struct/primitive type (fully qualified)
NAMEThe name it will be registered as.

Usage

DEFINE_STATIC_REFLECTION(MyStruct, "MyStruct")
{

}
Declares reflection for a class.
class ReflectExport(reflect) Dynamic
This class defines the core interface for all runtime type identification (RTTI) in reflect.
Declares reflection for a static type.
Defines helper macros for reflecting types.
class ReflectExport(reflect) Class : public ObjectType
template<typename T> class Class::DescriptionHelper : public ObjectType::DescriptionHelper<T>
Used in reflection definitions.
PropertyCollector Properties
Used to help register properties in a reflection definition.
Defines the reflection support for a templated type using its class’ DescriptionHelper.
Defines reflection for a non-dynamic type.
Defines the reflection support for a type using its class’ DescriptionHelper.
Close