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
6
namespace
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>
13
Rtti
<Type, BaseTypes...>&
Rtti<Type, BaseTypes...>::instance
()
14
{
15
static
Rtti
& instance = RttiDatabase::get<Type, BaseTypes...>();
16
return
instance;
17
}
18
19
template
<
typename
Type,
typename
... BaseTypes>
20
std::vector<RttiBase*>
Rtti<Type, BaseTypes...>::parents
()
21
{
22
return
details::GetParentRtti<BaseTypes...>::exec
();
23
}
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
}
Rtti
Definition
RttiDatabase.h:11
spark::rtti::RttiBase
The abstract class used as base for the RTTI data.
Definition
RttiBase.h:16
spark::rtti::Rtti
The RTTI object containing all the needed data.
Definition
Rtti.h:16
spark::rtti::details::GetParentRtti
Definition
Rtti.h:65
sources
spark
rtti
include
spark
rtti
impl
Rtti.h
Generated by
1.11.0