class TRTTIType

template<typename Type, typename BaseType, typename MyRTTIType>
Inherits: RTTIType

Allows you to provide a run-time type information for a specific class, along with support for serialization/deserialization.

Derive from this class and return the that class from IReflectable::getRTTI. This way you can separate serialization logic from the actual class you're serializing.

This class will provide a way to register individual fields in the class, together with ways to read and write them, as well a providing information about class hierarchy, and run-time type checking.

Public

Constructors

TRTTIType<Type, BaseType, MyRTTIType>

TRTTIType<Type, BaseType, MyRTTIType>()

Methods

~TRTTIType<Type, BaseType, MyRTTIType>

virtual ~TRTTIType<Type, BaseType, MyRTTIType>() = default

staticInstance

static MyRTTIType *Instance()

Returns a singleton of this RTTI type.

GetDefaultObject

IReflectable *GetDefaultObject() const override

Returns the default constructed object of this type.

Will return null if the class is abstract.

GetDerivedClasses

Vector<RTTIType *> &GetDerivedClasses() const override

Returns RTTI type information for all classes that derive from the class that owns this RTTI type.

GetBaseClass

RTTIType *GetBaseClass() const override

Returns RTTI type information for the class that owns this RTTI type.

If the class has not base type, null is returned instead.

IsDerivedFrom

bool IsDerivedFrom(const RTTIType *base) const override

Returns true if current RTTI class is derived from . (Or if it is the same type as base)

RegisterDerivedClassInternal

void RegisterDerivedClassInternal(RTTIType *derivedClass) override

Called by the RTTI system when a class is first found in order to form child/parent class hierarchy.

CloneInternal

RTTIType *CloneInternal(FrameAllocator &alloc) override

Constucts a cloned version of the underlying class.

The cloned version will not have any field information and should instead be used for passing to various RTTIField methods during serialization/deserialization. This allows each object instance to have a unique places to store temporary instance-specific data.

InitializeDefaultObject

void InitializeDefaultObject() override

Constructs the default object for the type, if it's possible to construct one.

Protected

Methods

OnOperationStarted

virtual void OnOperationStarted(Type &object, RTTIOperationTypeFlags operationType, RTTIOperationContext &context)

OnOperationEnded

virtual void OnOperationEnded(Type &object, RTTIOperationTypeFlags operationType, RTTIOperationContext &context)

NotifyOperationStarted

void NotifyOperationStarted(IReflectable &object, RTTIOperationTypeFlags operationType, RTTIOperationContext &context) final

Called before any operation that is iterating over the type's fields starts.

NotifyOperationEnded

void NotifyOperationEnded(IReflectable &object, RTTIOperationTypeFlags operationType, RTTIOperationContext &context) final

Called after any operation that is iterating over the type's fields ends.