39 virtual bool isA(
const size_t id)
const
49 template <
typename TType>
52 if (is(TType::getClassType()))
63 template <
typename TType>
64 const TType*
as()
const
66 if (is(TType::getClassType()))
73 #define KSF_RTTI_DECLARATIONS(_Type, _ParentType) \
75 virtual const size_t getInstanceType() const \
77 return _Type::getClassType(); \
79 static const size_t getClassType() \
81 static int d{0}; return (size_t)&d; \
83 virtual bool isA(const size_t id) const \
85 if (id == getClassType()) \
88 return _ParentType::isA(id); \
Implements RTTI (run-time type information) for objects.
Definition ksRtti.h:26
const TType * as() const
Tries to cast object to the type provided as a template parameter (const version).
Definition ksRtti.h:64
TType * as()
Tries to cast object to the type provided as a template parameter.
Definition ksRtti.h:50
virtual bool isA(const size_t id) const
Checks whether object is of given type.
Definition ksRtti.h:39
virtual const size_t getInstanceType() const =0
Retrieves type ID of the object.