SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
Rtti.h
1#pragma once
2
3#include "spark/rtti/RttiDatabase.h"
4#include "spark/rtti/details/Rtti.h"
5
6namespace spark::rtti
7{
8 template <typename Type, typename... BaseTypes>
9 Rtti<Type, BaseTypes...>::Rtti(std::string class_name)
10 : RttiBase(std::move(class_name)) {}
11
12 template <typename Type, typename... BaseTypes>
14 {
15 static Rtti& instance = RttiDatabase::get<Type, BaseTypes...>();
16 return instance;
17 }
18
19 template <typename Type, typename... BaseTypes>
24
25 template <typename Type, typename... BaseTypes>
26 bool Rtti<Type, BaseTypes...>::isSubTypeOf(const RttiBase* potential_parent_type)
27 {
28 if (potential_parent_type == this)
29 return true;
30
31 for (std::size_t i = 0; i < sizeof...(BaseTypes); ++i)
32 if (parents()[i]->isSubTypeOf(potential_parent_type))
33 return true;
34 return false;
35 }
36}
Definition RttiDatabase.h:11
The abstract class used as base for the RTTI data.
Definition RttiBase.h:16
The RTTI object containing all the needed data.
Definition Rtti.h:16