RTTI

Run-time type information defining and querying.

Classes

  • IReflectable — Interface implemented by classes that provide run time type information.
  • TRTTIType — Allows you to provide a run-time type information for a specific class, along with support for serialization/deserialization.

Structs

Enums

Free functions

B3DRTTISize

BitLength B3DRTTISize(const ElemType &data, bool compress = false)

Helper method when serializing known data types that have valid RTTIPlainType specialization.

Returns the size of the element when serialized.

B3DRTTIWrite

BitLength B3DRTTIWrite(const ElemType &data, Bitstream &stream, bool compress = false)

Helper method when serializing known data types that have valid RTTIPlainType specialization.

The data will be written to the provided stream and its write cursor advanced.

B3DRTTIRead

BitLength B3DRTTIRead(ElemType &data, Bitstream &stream, bool compress = false)

Helper method when serializing known data types that have valid RTTIPlainType specialization.

The data will be read from the provided stream and its read cursor advanced.

B3DRTTIWriteWithSizeHeader

BitLength B3DRTTIWriteWithSizeHeader(Bitstream &stream, const T &data, bool compress, P p)

Writes a set of data to the stream through the user provided function and then writes the size of that data as a header.

The size header is written as a 32-bit integer right before the data written by . The size value will include the size of the data from as well as the size of the header itself (32-bits). The size of the data is determined by the return value from . Returns the size written.

B3DRTTIReadSizeHeader

BitLength B3DRTTIReadSizeHeader(T &stream, bool compress, BitLength &size)

Reads the size header that was encoded with B3DRTTIWriteWithSizeHeader. contain the size value read from the stream, while the return value represents the number of bits read from the header itself (e.g. 4 bytes for uncompressed size).

B3DRTTIAddHeaderSize

inline void B3DRTTIAddHeaderSize(BitLength &size, bool compress)

Increments the provided size with the required size of the header.

B3DRTTIIsOfType

bool B3DRTTIIsOfType(IReflectable *object)

Returns true if the provided object can be safely cast into type T.

B3DRTTIIsOfType

bool B3DRTTIIsOfType(SPtr<IReflectable> object)

Returns true if the provided object can be safely cast into type T.

B3DRTTICreate

SPtr<IReflectable> B3DRTTICreate(u32 rttiId)

Creates a new object just from its type ID.

B3DRTTIIsSubclass

bool B3DRTTIIsSubclass(const IReflectable *object)

Checks is the current object a subclass of some type.

B3DRTTIIsSubclass

bool B3DRTTIIsSubclass(const SPtr<IReflectable> &object)

Checks is the current object a subclass of some type.

B3DRTTICast

T *B3DRTTICast(const IReflectable *object)

Attempts to cast the object to the provided type, or returns null if cast is not valid.

B3DRTTICast

SPtr<T> B3DRTTICast(const SPtr<IReflectable> object)

Attempts to cast the object to the provided type, or returns null if cast is not valid.

B3DGetTypeNameFromPrettyFunction

constexpr std::string_view B3DGetTypeNameFromPrettyFunction()

Returns the type name for the class , using the 'pretty function' macro provided by many compilers.

B3DGetTypeHash

constexpr HashType B3DGetTypeHash()

Computes a hash value for the current class name.

Uses B3DGetTypeNameFromPrettyFunction() to compute the hash from.

B3DGetRuntimeTypeId

constexpr TypeId B3DGetRuntimeTypeId()

Returns a unique type identifier for the provided type.

Internal

Symbols intended for engine-internal use. Not part of the public API.

Classes

  • IRTTIIterator — Interface for a RTTI iterator.
  • TRTTIIterator — Wraps a container that can be used for sequentially reading container contents, inserting new elements in the container, and retrieving container element count.
  • RTTIType — Provides an interface for accessing fields of a certain class.

Structs

Enums

Free functions

IsReflectable

constexpr bool IsReflectable()

Checks is the provided type a value type deriving from IReflectable.

IsReflectableShared

constexpr bool IsReflectableShared()

Checks is the provided type a shared pointer referencing a type deriving from IReflectable.

IsPlain

constexpr bool IsPlain()

Checks is the provided type a plain type (implements the RTTIPlainType <T > specialization).

CreateFieldTypeSchema

RTTIFieldDataTypeSchema CreateFieldTypeSchema(const RTTIFieldInfo &fieldInfo)

Creates a schema for a type stored in a field.

ReadPlainType

void ReadPlainType(T &value, Bitstream &stream, const RTTIFieldInfo &info, bool useCompression)

Reads the provided plain object from the stream.

WritePlainType

void WritePlainType(const T &value, Bitstream &stream, const RTTIFieldInfo &info, bool useCompression)

Writes the provided plain object to the stream.

GetPlainTypeSize

BitLength GetPlainTypeSize(const T &value, const RTTIFieldInfo &info, bool useCompression)

Returns the size of the provided plain object.

SetReflectableValue

void SetReflectableValue(T &value, const IReflectable &reflectable)

Assigns the reflectable value to the provided field value.

GetReflectableValue

const IReflectable &GetReflectableValue(const T &value)

Reads the reflectable value from the provided field value.

SetReflectablePointerValue

void SetReflectablePointerValue(T &value, const SPtr<IReflectable> &reflectable)

Assigns the reflectable pointer to the provided field value.

GetReflectablePointerValue

SPtr<IReflectable> GetReflectablePointerValue(const T &value)

Reads the reflectable pointer from the provided field value.