5#include <Foundation/Reflection/Implementation/StaticRTTI.h>
12#define PL_ADD_DYNAMIC_REFLECTION_NO_GETTER(SELF, BASE_TYPE) \
13 PL_ALLOW_PRIVATE_PROPERTIES(SELF); \
16 using OWNTYPE = SELF; \
17 using SUPER = BASE_TYPE; \
18 PL_ALWAYS_INLINE static const plRTTI* GetStaticRTTI() \
20 return &SELF::s_RTTI; \
24 static plRTTI s_RTTI; \
25 PL_REFLECTION_DEBUG_CODE
28#define PL_ADD_DYNAMIC_REFLECTION(SELF, BASE_TYPE) \
29 PL_ADD_DYNAMIC_REFLECTION_NO_GETTER(SELF, BASE_TYPE) \
31 virtual const plRTTI* GetDynamicRTTI() const override \
33 return &SELF::s_RTTI; \
37#if PL_ENABLED(PL_COMPILE_FOR_DEVELOPMENT) && PL_ENABLED(PL_COMPILER_MSVC)
39# define PL_REFLECTION_DEBUG_CODE \
40 static const plRTTI* ReflectionDebug_GetParentType() \
42 return __super::GetStaticRTTI(); \
45# define PL_REFLECTION_DEBUG_GETPARENTFUNC &OwnType::ReflectionDebug_GetParentType
48# define PL_REFLECTION_DEBUG_CODE
49# define PL_REFLECTION_DEBUG_GETPARENTFUNC nullptr
64#define PL_BEGIN_DYNAMIC_REFLECTED_TYPE(Type, Version, AllocatorType) \
65 PL_RTTIINFO_DECL(Type, Type::SUPER, Version) \
66 plRTTI Type::s_RTTI = GetRTTI((Type*)0); \
67 PL_RTTIINFO_GETRTTI_IMPL_BEGIN(Type, Type::SUPER, AllocatorType)
70#define PL_END_DYNAMIC_REFLECTED_TYPE \
71 return plRTTI(GetTypeName((OwnType*)0), plGetStaticRTTI<OwnBaseType>(), sizeof(OwnType), GetTypeVersion((OwnType*)0), \
72 plVariant::TypeDeduction<OwnType>::value, flags, &Allocator, Properties, Functions, Attributes, MessageHandlers, MessageSenders, \
73 PL_REFLECTION_DEBUG_GETPARENTFUNC); \
78#define PL_BEGIN_ABSTRACT_DYNAMIC_REFLECTED_TYPE(Type, Version) \
79 PL_BEGIN_DYNAMIC_REFLECTED_TYPE(Type, Version, plRTTINoAllocator) \
80 flags.Add(plTypeFlags::Abstract);
82#define PL_END_ABSTRACT_DYNAMIC_REFLECTED_TYPE PL_END_DYNAMIC_REFLECTED_TYPE
90 virtual const plRTTI* GetDynamicRTTI()
const {
return &plReflectedClass::s_RTTI; }
97 bool IsInstanceOf(
const plRTTI* pType)
const;
100 template <
typename T>
103 const plRTTI* pType = plGetStaticRTTI<T>();
104 return IsInstanceOf(pType);
Dummy type to pass to templates and macros that expect a base type for a class that has no base.
Definition Types.h:133
This class holds information about reflected types. Each instance represents one type that is known t...
Definition RTTI.h:30
All classes that should be dynamically reflectable, need to be derived from this base class.
Definition DynamicRTTI.h:86
PL_ALWAYS_INLINE bool IsInstanceOf() const
Returns whether the type of this instance is of the given type or derived from it.
Definition DynamicRTTI.h:101