The abstract runtime representation of a C++ type.
Instances of this class are used to represent a C++ type and manipulate that type at runtime. On types marked as RTTI types, the GetClassTypeInfo() and GetRuntimeTypeInfo() functions can be used to access an object's static or runtime type information.
- Note
- Instances CYIRuntimeTypeInfo should only be created through the use of the YI_TYPE_BASES(...) macro.
-
RTTI'ed C++ types have a unique CYIRuntimeTypeInfo instance. For this reason, taking the address of a CYIRuntimeTypeInfo reference (or of a CYIRuntimeTypeInfoTyped reference) is safe, and CYIRuntimeTypeInfo objects can be compared using CYIRuntimeTypeInfo::operator==() and CYIRuntimeTypeInfo::operator!=() .
- See also
- CYIRuntimeTypeInfoTyped
-
RTTISampleClass::GetClassTypeInfo()
-
RTTISampleClass::GetRuntimeTypeInfo()
-
YI_TYPE_BASES(...)
-
CYIRTTIRegistry::GetTypeForName
-
YiGetTypeInfo(CYIStringView)
#include <utility/YiRtti.h>
◆ ~CYIRuntimeTypeInfo()
virtual CYIRuntimeTypeInfo::~CYIRuntimeTypeInfo |
( |
| ) |
|
|
virtual |
◆ CYIRuntimeTypeInfo()
◆ CanCastTo() [1/2]
Checks if the type represented by this object can be cast to the type represented by baseType. In other words, this function checks if baseType represents a base of this object's type.
Implemented in CYIRuntimeTypeInfoTyped< CLASS, BASES >.
◆ CanCastTo() [2/2]
template<typename T >
bool CYIRuntimeTypeInfo::CanCastTo |
( |
| ) |
const |
|
inline |
Checks if the type represented by this object can be cast to type T. In other words, this function checks if type T is a base of this object's type.
- Note
- CV qualifiers of type T are ignored.
- Template Parameters
-
T | The type to check against. |
◆ CastVoidPointer()
template<typename T >
const T* CYIRuntimeTypeInfo::CastVoidPointer |
( |
const void * |
pObject | ) |
const |
|
inline |
Casts the pointer pObject to the type T. If pObject cannot be cast to the type T, nullptr is returned.
- Warning
- This function is an implementation artifact and is not meant to be called by users. Use YiDynamicCast<T>(P*) instead.
-
The pointer pObject must be a pointer to an object of the type represented by this object. If the pointer points to an object of a different type, a runtime crash may occur.
-
pObject may not be null.
- Template Parameters
-
- See also
- YiDynamicCast
◆ CreateInstance()
template<typename T >
std::unique_ptr<T> CYIRuntimeTypeInfo::CreateInstance |
( |
| ) |
const |
|
inline |
Creates and returns a new instance of the type represented by this object using the type's default constructor.
- Note
- If the type represented by this object cannot be cast to type T, a warning is logged and nullptr is returned without having created a new instance.
-
If the type represented by this object is not instantiable, a warning is logged and nullptr is returned.
- Template Parameters
-
T | The type to cast the created object to. |
◆ GetBasesTypeInfos()
virtual const std::vector<const CYIRuntimeTypeInfo *>& CYIRuntimeTypeInfo::GetBasesTypeInfos |
( |
| ) |
const |
|
pure virtual |
◆ GetName()
CYIString CYIRuntimeTypeInfo::GetName |
( |
| ) |
const |
Returns the name of the type represented by this object. This is the name specified in the RTTI macro (either implicitely or explicitly). For namespaced types or inner types, the name is typically the full identifer of the type (e.g. "MyNamespace::MyType").
◆ GetNameAsView()
Returns the name of the type represented by this object as a CYIStringView. This is the name specified in the RTTI macro (either implicitely or explicitly). For namespaced types or inner types, the name is typically the full identifer of the type (e.g. "MyNamespace::MyType"). Unlike GetName(), this function does not make memory allocations.
◆ IsInstantiable()
virtual bool CYIRuntimeTypeInfo::IsInstantiable |
( |
| ) |
const |
|
pure virtual |
◆ operator!=()
◆ operator<()
◆ operator==()
◆ RegisterWithLinker()
void CYIRuntimeTypeInfo::RegisterWithLinker |
( |
| ) |
const |
Registers the type represented by this object with the linker. When a type is only 'used' through the YiRTTINew<T>() function (such as when a type is referenced only through an external tool such as After Effects), it is necessary to manually call RegisterWithLinker to prevent the linker from removing the type from the executable.
The documentation for this class was generated from the following file: