Description

Run-time type information defining and querying.

Classes

struct  RTTIField
 Structure that keeps meta-data concerning a single class field. More...
 
struct  RTTIManagedDataBlockFieldBase
 Base class containing common functionality for a managed data block class field. More...
 
struct  RTTIManagedDataBlockField< DataType, ObjectType >
 Class containing a managed data block field containing a specific type. More...
 
struct  RTTIPlainFieldBase
 Base class containing common functionality for a plain class field. More...
 
struct  RTTIPlainField< DataType, ObjectType >
 Represents a plain class field containing a specific type. More...
 
struct  RTTIReflectableFieldBase
 Base class containing common functionality for a reflectable class field. More...
 
struct  RTTIReflectableField< DataType, ObjectType >
 Reflectable field containing a specific type with RTTI implemented. More...
 
struct  RTTIReflectablePtrFieldBase
 Base class containing common functionality for a reflectable pointer class field. More...
 
struct  RTTIReflectablePtrField< DataType, ObjectType >
 Reflectable field containing a pointer to a specific type with RTTI implemented. More...
 
class  RTTITypeBase
 Provides an interface for accessing fields of a certain class. More...
 
struct  InitRTTIOnStart< Type, BaseType >
 Used for initializing a certain type as soon as the program is loaded. More...
 
struct  InitRTTIOnStart< Type, IReflectable >
 Specialization for root class of RTTI hierarchy - IReflectable. More...
 
struct  GetRTTIType< Type >
 Template that returns RTTI type of the specified type, unless the specified type is IReflectable in which case it returns a null. More...
 
struct  GetRTTIType< IReflectable >
 Specialization for root class of RTTI hierarchy - IReflectable. More...
 

Enumerations

enum  SerializableFieldType { SerializableFT_Plain, SerializableFT_DataBlock, SerializableFT_Reflectable, SerializableFT_ReflectablePtr }
 Types of fields we can serialize: More...
 
enum  RTTIFieldFlag { RTTI_Flag_WeakRef = 0x01, RTTI_Flag_SkipInReferenceSearch = 0x02 }
 Various flags you can assign to RTTI fields. More...
 

Enumeration Type Documentation

enum RTTIFieldFlag

Various flags you can assign to RTTI fields.

Enumerator
RTTI_Flag_WeakRef 

This flag is only used on field types of ReflectablePtr type, and it is used to solve circular references.

Circular references cause an issue when deserializing, as the algorithm doesn't know which object to deserialize first. By making one of the references weak, you tell the algorithm that it doesn't have to guarantee the object will be fully deserialized before being assigned to the field.

In short: If you make a reference weak, when "set" method of that field is called, it is not guaranteed the value provided is fully initialized, so you should not access any of its data until deserialization is fully complete. You only need to use this flag if the RTTI system complains that is has found a circular reference.

RTTI_Flag_SkipInReferenceSearch 

This flags signals various systems that the flagged field should not be searched when looking for object references.

This normally means the value of this field will no be retrieved during reference searches but it will likely still be retrieved during other operations (for example serialization). This is used as an optimization to avoid retrieving values of potentially very expensive fields that would not contribute to the reference search anyway. Whether or not a field contributes to the reference search depends on the search and should be handled on a case by case basis.

enum SerializableFieldType

Types of fields we can serialize:

  • Plain - Native data types, POD (Plain old data) structures, or in general types we don't want to (or can't) inherit from IReflectable. Type must be copyable by memcpy.
  • DataBlock - Array of bytes of a certain size. When returning a data block you may specify if its managed or unmanaged. Managed data blocks have their buffers deleted after they go out of scope. This is useful if you need to return some temporary data. On the other hand if the data in the block belongs to your class, and isn't temporary, keep the data unmanaged.
  • Reflectable - Field that is of IReflectable type. Cannot be a pointer to IReflectable and must be actual value type. Type and its fields are serialized recursively. Supports versioning so you may add/remove fields from the type without breaking previously serialized data.
  • ReflectablePtr - A pointer to IReflectable. Same as "Reflectable" except that data isn't serialized as a value type, but as a pointer, which may be referenced by multiple other instances. All references are saved upon serialization and restored upon deserialization.