ezEngine  Milestone 9
ezRTTI Class Reference

This enumerable class holds information about reflected types. Each instance represents one type that is known to the reflection system. More...

#include <RTTI.h>

Inheritance diagram for ezRTTI:

Public Member Functions

 ezRTTI (const char *szName, const ezRTTI *pParentType, ezUInt32 uiTypeSize, ezUInt32 uiTypeVersion, ezUInt32 uiVariantType, ezBitflags< ezTypeFlags > flags, ezRTTIAllocator *pAllocator, ezArrayPtr< ezAbstractProperty *> properties, ezArrayPtr< ezAbstractFunctionProperty *> functions, ezArrayPtr< ezPropertyAttribute *> attributes, ezArrayPtr< ezAbstractMessageHandler *> messageHandlers, ezArrayPtr< ezMessageSenderInfo > messageSenders, const ezRTTI *(*fnVerifyParent)())
 The constructor requires all the information about the type that this object represents.
 
void VerifyCorrectness () const
 Can be called in debug builds to check that all reflected objects are correctly set up.
 
EZ_ALWAYS_INLINE const char * GetTypeName () const
 Returns the name of this type.
 
EZ_ALWAYS_INLINE ezUInt32 GetTypeNameHash () const
 Returns the hash of the name of this type.
 
EZ_ALWAYS_INLINE const ezRTTIGetParentType () const
 Returns the type that is the base class of this type. May be nullptr if this type has no base class.
 
EZ_ALWAYS_INLINE ezVariant::Type::Enum GetVariantType () const
 Returns the corresponding variant type for this type or Invalid if there is none.
 
bool IsDerivedFrom (const ezRTTI *pBaseType) const
 Returns true if this type is derived from the given type.
 
template<typename BASE >
EZ_ALWAYS_INLINE bool IsDerivedFrom () const
 Returns true if this type is derived from the given type.
 
EZ_ALWAYS_INLINE ezRTTIAllocatorGetAllocator () const
 Returns the object through which instances of this type can be allocated.
 
EZ_ALWAYS_INLINE const ezArrayPtr< ezAbstractProperty * > & GetProperties () const
 Returns the array of properties that this type has. Does NOT include properties from base classes.
 
EZ_ALWAYS_INLINE const ezArrayPtr< ezAbstractFunctionProperty * > & GetFunctions () const
 
EZ_ALWAYS_INLINE const ezArrayPtr< ezPropertyAttribute * > & GetAttributes () const
 
template<typename Type >
const Type * GetAttributeByType () const
 Returns the first attribute that derives from the given type, or nullptr if nothing is found.
 
void GetAllProperties (ezHybridArray< ezAbstractProperty *, 32 > &out_Properties) const
 Returns the list of properties that this type has, including derived properties from all base classes.
 
EZ_ALWAYS_INLINE ezUInt32 GetTypeSize () const
 Returns the size (in bytes) of an instance of this type.
 
EZ_ALWAYS_INLINE ezUInt32 GetTypeVersion () const
 Returns the version number of this type.
 
EZ_ALWAYS_INLINE const ezBitflags< ezTypeFlags > & GetTypeFlags () const
 Returns the type flags.
 
ezAbstractPropertyFindPropertyByName (const char *szName, bool bSearchBaseTypes=true) const
 Will iterate over all properties of this type and (optionally) the base types to search for a property with the given name.
 
EZ_ALWAYS_INLINE const char * GetPluginName () const
 Returns the name of the plugin which this type is declared in.
 
EZ_ALWAYS_INLINE const ezArrayPtr< ezAbstractMessageHandler * > & GetMessageHandlers () const
 Returns the array of message handlers that this type has.
 
bool DispatchMessage (void *pInstance, ezMessage &msg) const
 Dispatches the given message to the proper message handler, if there is one available. Returns true if so, false if no message handler for this type exists.
 
bool DispatchMessage (const void *pInstance, ezMessage &msg) const
 Dispatches the given message to the proper message handler, if there is one available. Returns true if so, false if no message handler for this type exists.
 
template<typename MessageType >
EZ_ALWAYS_INLINE bool CanHandleMessage () const
 Returns whether this type can handle the given message type.
 
bool CanHandleMessage (ezMessageId id) const
 Returns whether this type can handle the message type with the given id.
 
EZ_ALWAYS_INLINE const ezArrayPtr< ezMessageSenderInfo > & GetMessageSender () const
 

Static Public Member Functions

static void VerifyCorrectnessForAllTypes ()
 Calls VerifyCorrectness() on all ezRTTI objects.
 
static ezRTTIFindTypeByName (const char *szName)
 Iterates over all ezRTTI instances and returns the one with the given name, or nullptr if no such type exists.
 
- Static Public Member Functions inherited from ezNoBase
static const ezRTTIGetStaticRTTI ()
 

Static Public Attributes

static ezEvent< const ezRTTI * > s_TypeUpdatedEvent
 Fire this if a type was dynamically added or changed outside of plugin registration.
 

Protected Member Functions

void UpdateType (const ezRTTI *pParentType, ezUInt32 uiTypeSize, ezUInt32 uiTypeVersion, ezUInt32 uiVariantType, ezBitflags< ezTypeFlags > flags)
 
void RegisterType (ezRTTI *pType)
 
void UnregisterType (ezRTTI *pType)
 
void GatherDynamicMessageHandlers ()
 

Static Protected Member Functions

static void * GetTypeHashTable ()
 Returns a hash table that accelerates ezRTTI::FindTypeByName. The hash table type cannot be put in the header due to circular includes. Function is used by RegisterType / UnregisterType to add / remove type from table.
 

Protected Attributes

const char * m_szPluginName
 
const char * m_szTypeName
 
ezArrayPtr< ezAbstractProperty * > m_Properties
 
ezArrayPtr< ezAbstractFunctionProperty * > m_Functions
 
ezArrayPtr< ezPropertyAttribute * > m_Attributes
 
const ezRTTIm_pParentType
 
ezRTTIAllocatorm_pAllocator
 
ezUInt32 m_uiVariantType
 
ezUInt32 m_uiTypeSize
 
ezUInt32 m_uiTypeVersion = 0
 
ezUInt32 m_uiTypeNameHash = 0
 
ezBitflags< ezTypeFlagsm_TypeFlags
 
ezUInt32 m_uiMsgIdOffset
 
bool m_bGatheredDynamicMessageHandlers
 
const ezRTTI *(* m_fnVerifyParent )()
 
ezArrayPtr< ezAbstractMessageHandler * > m_MessageHandlers
 
ezDynamicArray< ezAbstractMessageHandler *, ezStaticAllocatorWrapperm_DynamicMessageHandlers
 
ezArrayPtr< ezMessageSenderInfom_MessageSenders
 
- Protected Attributes inherited from ezEnumerable< ezRTTI >
ezEnumerablem_pNextInstance
 

Detailed Description

This enumerable class holds information about reflected types. Each instance represents one type that is known to the reflection system.

Instances of this class are typically created through the macros from the StaticRTTI.h header. Each instance represents one type. This class holds information about derivation hierarchies and exposed properties. You can thus find out whether a type is derived from some base class and what properties of which types are available. Properties can then be read and modified on instances of this type.


The documentation for this class was generated from the following files: