Reflection.h

Defines helper macros for reflecting types.  The helper macros install typedefs and function stubs.  The definitions are built by macros in Reflection.hpp.

It is possible to do this with template injection but it makes it difficult to describe DLL boundaries correctly, so we don’t do that.

Summary
Reflection.hDefines helper macros for reflecting types.
Macros
DECLARE_REFLECTIONDeclares reflection for a class.
DECLARE_TEMPLATE_REFLECTIONDeclares reflection for a class with a templated base type.
DECLARE_REFLECTION_EXDeclares reflection for a class, changing the ClassType used to reflect the class.
DECLARE_STATIC_REFLECTIONDeclares reflection for a static type.
DECLARE_REFLECTION_ALIASCauses one static type to share reflection with another.
DECLARE_TEMPLATE_REFLECTION_ALIASCauses a templated static type to share reflection with another.
DECLARE_STATIC_EXTENSION
DEFINE_LOCAL_STATIC_REFLECTION

Macros

DECLARE_REFLECTION

Declares reflection for a class.

Place this macro somewhere in the class to be reflected to enable reflection on it.  The reflection must be defined using DEFINE_REFLECTION in an implementation file somewhere.  This macro adds both private and public symbols, so put a public/private/protected label after it.

Parameters

BASEThe base class this class inherits from.

Usage

class MyClass : public MyBase
{
   DECLARE_REFLECTION(MyBase)
public:
   ...

DECLARE_TEMPLATE_REFLECTION

Declares reflection for a class with a templated base type.

See Also

DECLARE_REFLECTION_EX

Declares reflection for a class, changing the ClassType used to reflect the class.  This is an advanced declaration for introducing new root kinds of dynamic classes.

Parameters

BASEThe base class this class inherits from.
CLASSTYPEThe new reflection class.

Usage

class Persistent : public Dynamic, public Serializable
{
   DECLARE_REFLECTION_EX(MyBase, PersistentClass)
public:
   ...

DECLARE_STATIC_REFLECTION

Declares reflection for a static type.  Use this macro outside of any namespace scope.

Parameters

MODULEThe module for ReflectExport or “local” if the type reflection doesn’t need to cross dll boundaries.
TYPEThe type to reflect.
CLASSTYPEThe class type to use to reflect this type.  (should be a *Type, not a *Class).

Template specializes Signature for the type.

DECLARE_REFLECTION_ALIAS

Causes one static type to share reflection with another.

See Also

DECLARE_TEMPLATE_REFLECTION_ALIAS

Causes a templated static type to share reflection with another.

See Also

DECLARE_STATIC_EXTENSION

DEFINE_LOCAL_STATIC_REFLECTION

Support for defining reflection for types.
Defines the reflection support for a type using its class’ DescriptionHelper.
Declares reflection for a class.
Declares reflection for a class, changing the ClassType used to reflect the class.
Use this macro in the declarations of any classes or functions that need correct DLL linkage.
template<typename T> struct Signature
Signatures provide a uniform means of accessing the Class object and the static type of that class of any reflected type, dynamic (Dynamic) or not.
Declares reflection for a static type.
Close