This file contains the classes and macros used to implement RTTI in You.i Engine. More...
#include "framework/YiPredef.h"#include "utility/YiPreprocessorMacros.h"#include "utility/YiString.h"#include "utility/YiTypeTraits.h"#include <map>#include "utility/YiRtti.inl"Go to the source code of this file.
Classes | |
| class | CYIRuntimeTypeInfo |
| The abstract runtime representation of a C++ type. More... | |
| class | CYIRuntimeTypeInfoTyped< CLASS, BASE1, BASE2, BASE3 > |
| The runtime representation of a C++ type. More... | |
| class | CYIRTTIRegistry |
| A registry of all known RTTI types. More... | |
| class | RTTISampleClass |
| This is a sample class to document the RTTI functions inserted into classes by the YI_TYPE_BASES(...) macro. More... | |
Macros | |
| #define | YI_TYPE_BASES(...) YI_MAKE_VARIADIC_MACRO(YI_TYPE_BASES_, ##__VA_ARGS__) |
| #define | YI_TYPE_DEF(...) YI_MAKE_VARIADIC_MACRO(YI_TYPE_DEF_, ##__VA_ARGS__) |
| #define | YI_TYPE_DEF_INST(...) YI_MAKE_VARIADIC_MACRO(YI_TYPE_DEF_INST_, ##__VA_ARGS__) |
| #define | YI_TYPE_DEF_WITH_NAME(...) YI_MAKE_VARIADIC_MACRO(YI_TYPE_DEF_WITH_NAME_, ##__VA_ARGS__) |
| #define | YI_TYPE_DEF_INST_WITH_NAME(...) YI_MAKE_VARIADIC_MACRO(YI_TYPE_DEF_INST_WITH_NAME_, ##__VA_ARGS__) |
Functions | |
| template<typename TARGET , typename SOURCE > | |
| TARGET * | YiDynamicCast (SOURCE *pObject) |
| Casts the pointer pObject to type T*. More... | |
| template<typename TARGET , typename SOURCE > | |
| std::shared_ptr< TARGET > | YiDynamicPointerCast (const std::shared_ptr< SOURCE > &pObject) |
| Casts the shared pointer pObject to shared pointer type T*. More... | |
| template<typename TARGET , typename SOURCE > | |
| std::shared_ptr< TARGET > | YiDynamicCast (const std::shared_ptr< SOURCE > &pObject) |
| Casts the shared pointer pObject to shared pointer type T*. More... | |
| template<typename T > | |
| std::unique_ptr< T > | YiRTTINew (const CYIString &name) |
| Creates a new instance of the type identifed by name. More... | |
| const CYIRuntimeTypeInfo * | YiGetTypeInfo (const char *pTypeName) |
| const CYIRuntimeTypeInfo * | YiGetTypeInfo (const CYIString &typeName) |
| template<typename T > | |
| const CYIRuntimeTypeInfo * | YiGetTypeInfo (T *pObject) |
This file contains the classes and macros used to implement RTTI in You.i Engine.
The two main uses of the You.i Engine RTTI are to enable runtime-instantiation of classes based on their name, and to allow downcasting runtime types. This is implemented in the YiRTTINew<T>() and YiDynamicCast<T>(P*) functions.
All subclasses of CYISceneView must contain RTTI type information in order to enable runtime instantiation of those views.
To declare a custom type as being an RTTI type, add the YI_TYPE_BASES(...) macro to its class declaration (header), and either the YI_TYPE_DEF(...) or the YI_TYPE_DEF_INST(...) macro to its class definition (implementation).
This is an example of the use of RTTI: