RTTIField Struct Referenceabstract

Description

Structure that keeps meta-data concerning a single class field.

You can use this data for setting and getting values for that field on a specific class instance.

Class also contains an unique field name, and an unique field ID. Fields may contain single types or an array of types. See SerializableFieldType for information about specific field types.

Note
Most of the methods for retrieving and setting data accept "void *" for both the data and the owning class instance. It is up to the caller to ensure that pointer is of proper type.

Inherited by RTTIManagedDataBlockFieldBase, RTTIPlainFieldBase, RTTIReflectableFieldBase, and RTTIReflectablePtrFieldBase.

Methods

bool isPlainType () const
 Checks is the field plain type and castable to RTTIPlainFieldBase. More...
 
bool isDataBlockType () const
 Checks is the field a data block type and castable to RTTIManagedDataBlockFieldBase. More...
 
bool isReflectableType () const
 Checks is the field a reflectable type and castable to RTTIReflectableFieldBase. More...
 
bool isReflectablePtrType () const
 Checks is the field a reflectable pointer type and castable to RTTIReflectablePtrFieldBase. More...
 
bool isArray () const
 Checks is the field contains an array or a single entry. More...
 
UINT64 getFlags () const
 Returns flags that were set in the field meta-data. More...
 
virtual UINT32 getArraySize (void *object)=0
 Gets the size of an array contained by the field, if the field represents an array. More...
 
virtual void setArraySize (void *object, UINT32 size)=0
 Changes the size of an array contained by the field, if the field represents an array. More...
 
virtual UINT32 getTypeSize ()=0
 Returns the type id for the type used in this field. More...
 
virtual bool hasDynamicSize ()=0
 Query if the field has dynamic size. More...
 
void checkIsPlain (bool array)
 Throws an exception if this field doesn't contain a plain value. More...
 
void checkIsComplex (bool array)
 Throws an exception if this field doesn't contain a complex value. More...
 
void checkIsComplexPtr (bool array)
 Throws an exception if this field doesn't contain a complex pointer value. More...
 
void checkIsArray (bool array)
 Throws an exception depending if the field is or isn't an array. More...
 
void checkIsDataBlock ()
 Throws an exception if this field doesn't contain a data block value. More...
 

Fields

Any valueGetter
 
Any valueSetter
 
Any arraySizeGetter
 
Any arraySizeSetter
 
String mName
 
UINT16 mUniqueId
 
bool mIsVectorType
 
SerializableFieldType mType
 
UINT64 mFlags
 

Method documentation

void checkIsArray ( bool  array)

Throws an exception depending if the field is or isn't an array.

Parameters
[in]arrayIf true, then exception will be thrown if field is not an array. If false, then it will be thrown if field is an array.
void checkIsComplex ( bool  array)

Throws an exception if this field doesn't contain a complex value.

Parameters
[in]arrayIf true then the field must support complex array type.
void checkIsComplexPtr ( bool  array)

Throws an exception if this field doesn't contain a complex pointer value.

Parameters
[in]arrayIf true then the field must support complex pointer array type.
void checkIsDataBlock ( )

Throws an exception if this field doesn't contain a data block value.

void checkIsPlain ( bool  array)

Throws an exception if this field doesn't contain a plain value.

Parameters
[in]arrayIf true then the field must support plain array type.
virtual UINT32 getArraySize ( void *  object)
pure virtual

Gets the size of an array contained by the field, if the field represents an array.

Throws exception if field is not an array.

Implemented in RTTIPlainField< DataType, ObjectType >, RTTIReflectablePtrField< DataType, ObjectType >, RTTIReflectableField< DataType, ObjectType >, and RTTIManagedDataBlockField< DataType, ObjectType >.

UINT64 getFlags ( ) const

Returns flags that were set in the field meta-data.

virtual UINT32 getTypeSize ( )
pure virtual
virtual bool hasDynamicSize ( )
pure virtual

Query if the field has dynamic size.

Note
Field should have dynamic size if:
  • The field can have varying size
    • The field size is over 255
Types like integers, floats, bools, POD structs dont have dynamic size. Types like strings, vectors, maps do.
If your type has a static size but that size exceeds 255 bytes you also need to use dynamic field size. (You will be warned during compilation if you don't follow this rule)

Implemented in RTTIPlainField< DataType, ObjectType >, RTTIReflectablePtrFieldBase, RTTIManagedDataBlockField< DataType, ObjectType >, RTTIReflectableFieldBase, and RTTIPlainFieldBase.

bool isArray ( ) const

Checks is the field contains an array or a single entry.

bool isDataBlockType ( ) const

Checks is the field a data block type and castable to RTTIManagedDataBlockFieldBase.

bool isPlainType ( ) const

Checks is the field plain type and castable to RTTIPlainFieldBase.

bool isReflectablePtrType ( ) const

Checks is the field a reflectable pointer type and castable to RTTIReflectablePtrFieldBase.

bool isReflectableType ( ) const

Checks is the field a reflectable type and castable to RTTIReflectableFieldBase.

virtual void setArraySize ( void *  object,
UINT32  size 
)
pure virtual

Changes the size of an array contained by the field, if the field represents an array.

Throws exception if field is not an array.

Implemented in RTTIPlainField< DataType, ObjectType >, RTTIReflectablePtrField< DataType, ObjectType >, RTTIReflectableField< DataType, ObjectType >, and RTTIManagedDataBlockField< DataType, ObjectType >.