1#ifndef SEAD_RUNTIMETYPEINFO_H_
2#define SEAD_RUNTIMETYPEINFO_H_
4#include <basis/seadTypes.h>
15static_assert(
sizeof(
Interface) == 4,
"sead::RuntimeTypeInfo::Interface size mismatch");
28template <
typename Super>
45template <
typename DerivedType,
typename Type>
50 return ptr !=
nullptr && ptr->checkDerivedRuntimeTypeInfo(typeInfo);
53template<
typename DerivedType,
typename Type>
57 if (IsDerivedTypes<DerivedType, Type>(ptr))
58 return static_cast<DerivedType*>(ptr);
63template<
typename DerivedType,
typename Type>
64inline const DerivedType*
67 if (IsDerivedTypes<DerivedType, Type>(ptr))
68 return static_cast<
const DerivedType*>(ptr);
75#define SEAD_RTTI_BASE(CLASS)
77 static const sead::RuntimeTypeInfo::Root sTypeInfo;
80 static const sead::RuntimeTypeInfo::Interface* getRuntimeTypeInfoStatic()
85 virtual bool checkDerivedRuntimeTypeInfo(const sead::RuntimeTypeInfo::Interface* type) const
87 const sead::RuntimeTypeInfo::Interface* clsTypeInfo = CLASS::getRuntimeTypeInfoStatic();
88 return type == clsTypeInfo;
91 virtual const sead::RuntimeTypeInfo::Interface* getRuntimeTypeInfo() const
93 return getRuntimeTypeInfoStatic();
96#define SEAD_RTTI_OVERRIDE(CLASS, BASE)
98 static const sead::RuntimeTypeInfo::Derive<BASE> sTypeInfo;
101 static const sead::RuntimeTypeInfo::Interface* getRuntimeTypeInfoStatic()
106 bool checkDerivedRuntimeTypeInfo(const sead::RuntimeTypeInfo::Interface* type) const override
108 const sead::RuntimeTypeInfo::Interface* clsTypeInfo = CLASS::getRuntimeTypeInfoStatic();
109 if (type == clsTypeInfo)
112 return BASE::checkDerivedRuntimeTypeInfo(type);
115 const sead::RuntimeTypeInfo::Interface* getRuntimeTypeInfo() const override
117 return getRuntimeTypeInfoStatic();
121#define SEAD_RTTI_OVERRIDE_INLINE(CLASS, BASE)
123 static inline const sead::RuntimeTypeInfo::Derive<BASE> sTypeInfo{};
126 static const sead::RuntimeTypeInfo::Interface* getRuntimeTypeInfoStatic()
131 bool checkDerivedRuntimeTypeInfo(const sead::RuntimeTypeInfo::Interface* type) const override
133 const sead::RuntimeTypeInfo::Interface* clsTypeInfo = CLASS::getRuntimeTypeInfoStatic();
134 if (type == clsTypeInfo)
137 return BASE::checkDerivedRuntimeTypeInfo(type);
140 const sead::RuntimeTypeInfo::Interface* getRuntimeTypeInfo() const override
142 return getRuntimeTypeInfoStatic();
145#define SEAD_RTTI_BASE_IMPL(CLASS)
146 const sead::RuntimeTypeInfo::Root CLASS::sTypeInfo;
148#define SEAD_RTTI_OVERRIDE_IMPL(CLASS, BASE)
149 const sead::RuntimeTypeInfo::Derive<BASE> CLASS::sTypeInfo;
Definition seadRuntimeTypeInfo.h:6
Definition seadAssert.h:44
const DerivedType * DynamicCast(const Type *ptr)
Definition seadRuntimeTypeInfo.h:65
DerivedType * DynamicCast(Type *ptr)
Definition seadRuntimeTypeInfo.h:55
bool IsDerivedTypes(const Type *ptr)
Definition seadRuntimeTypeInfo.h:47
Definition seadRuntimeTypeInfo.h:30
bool isDerived(const Interface *other) const override
Definition seadRuntimeTypeInfo.h:33
Derive()
Definition seadRuntimeTypeInfo.h:31
Definition seadRuntimeTypeInfo.h:9
Interface()
Definition seadRuntimeTypeInfo.h:10
virtual bool isDerived(const Interface *other) const =0
Definition seadRuntimeTypeInfo.h:19
Root()
Definition seadRuntimeTypeInfo.h:20
bool isDerived(const Interface *other) const override
Definition seadRuntimeTypeInfo.h:22