ezEngine  Milestone 9
DynamicRTTI.h File Reference

Go to the source code of this file.

Classes

class  ezReflectedClass
 All classes that should be dynamically reflectable, need to be derived from this base class. More...
 

Macros

#define EZ_ADD_DYNAMIC_REFLECTION_NO_GETTER(SELF, BASE_TYPE)
 This needs to be put into the class declaration of EVERY dynamically reflectable class. More...
 
#define EZ_ADD_DYNAMIC_REFLECTION(SELF, BASE_TYPE)
 
#define EZ_REFLECTION_DEBUG_CODE   /*empty*/
 
#define EZ_REFLECTION_DEBUG_GETPARENTFUNC   nullptr
 
#define EZ_BEGIN_DYNAMIC_REFLECTED_TYPE(Type, Version, AllocatorType)
 Implements the necessary functionality for a type to be dynamically reflectable. More...
 
#define EZ_END_DYNAMIC_REFLECTED_TYPE
 Ends the reflection code block that was opened with EZ_BEGIN_DYNAMIC_REFLECTED_TYPE. More...
 

Macro Definition Documentation

◆ EZ_ADD_DYNAMIC_REFLECTION

#define EZ_ADD_DYNAMIC_REFLECTION (   SELF,
  BASE_TYPE 
)
Value:
public: \
virtual const ezRTTI* GetDynamicRTTI() const override { return &SELF::s_RTTI; }
This enumerable class holds information about reflected types. Each instance represents one type that...
Definition: RTTI.h:30
#define EZ_ADD_DYNAMIC_REFLECTION_NO_GETTER(SELF, BASE_TYPE)
This needs to be put into the class declaration of EVERY dynamically reflectable class.
Definition: DynamicRTTI.h:12

◆ EZ_ADD_DYNAMIC_REFLECTION_NO_GETTER

#define EZ_ADD_DYNAMIC_REFLECTION_NO_GETTER (   SELF,
  BASE_TYPE 
)
Value:
\
public: \
typedef BASE_TYPE SUPER; \
EZ_ALWAYS_INLINE static const ezRTTI* GetStaticRTTI() { return &SELF::s_RTTI; } \
\
private: \
static ezRTTI s_RTTI; \
EZ_REFLECTION_DEBUG_CODE
This enumerable class holds information about reflected types. Each instance represents one type that...
Definition: RTTI.h:30
#define EZ_ALLOW_PRIVATE_PROPERTIES(SELF)
Insert this into a class/struct to enable properties that are private members. All types that have dy...
Definition: StaticRTTI.h:143

This needs to be put into the class declaration of EVERY dynamically reflectable class.

This macro extends a class, such that it is now able to return its own type information via GetDynamicRTTI(), which is a virtual function, that is reimplemented on each type. A class needs to be derived from ezReflectedClass (at least indirectly) for this.

◆ EZ_BEGIN_DYNAMIC_REFLECTED_TYPE

#define EZ_BEGIN_DYNAMIC_REFLECTED_TYPE (   Type,
  Version,
  AllocatorType 
)
Value:
EZ_RTTIINFO_DECL(Type, Type::SUPER, Version) \
ezRTTI Type::s_RTTI = ezRTTInfo_##Type::GetRTTI(); \
EZ_RTTIINFO_GETRTTI_IMPL_BEGIN(Type, AllocatorType)

Implements the necessary functionality for a type to be dynamically reflectable.

Parameters
TypeThe type for which the reflection functionality should be implemented.
BaseTypeThe base class type of Type. If it has no base class, pass ezNoBase
AllocatorTypeThe type of an ezRTTIAllocator that can be used to create and destroy instances of Type. Pass ezRTTINoAllocator for types that should not be created dynamically. Pass ezRTTIDefaultAllocator<Type> for types that should be created on the default heap. Pass a custom ezRTTIAllocator type to handle allocation differently.

◆ EZ_END_DYNAMIC_REFLECTED_TYPE

#define EZ_END_DYNAMIC_REFLECTED_TYPE
Value:
return ezRTTI(GetTypeName(), ezGetStaticRTTI<OwnBaseType>(), sizeof(OwnType), GetTypeVersion(), \
ezVariant::TypeDeduction<OwnType>::value, flags, &Allocator, Properties, Functions, Attributes, MessageHandlers, \
MessageSenders, EZ_REFLECTION_DEBUG_GETPARENTFUNC); \
}
This enumerable class holds information about reflected types. Each instance represents one type that...
Definition: RTTI.h:30
A helper struct to convert the C++ type, which is passed as the template argument, into one of the ezVariant::Type enum values.
Definition: Variant.h:95

Ends the reflection code block that was opened with EZ_BEGIN_DYNAMIC_REFLECTED_TYPE.