-
Notifications
You must be signed in to change notification settings - Fork 0
/
component.hh
54 lines (40 loc) · 979 Bytes
/
component.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <array>
#include <list>
#include <type_traits>
#include <typeinfo>
#include <unordered_map>
#include <map>
#include <string>
#include "common.hh"
#include "util/util.hh"
#ifndef _SCRATCH_COMPONENT
#define _SCRATCH_COMPONENT
#ifdef _DEBUG
using namespace util::io;
#endif
struct BasicComponent
{
static std::string name() { return "BasicComponent"; }
std::string to_string() const { return name(); }
};
CREATE_MEMBER_FUNCTION_TEST(name);
template <class T>
using has_name = detect_mem_fn_name<T, std::string>;
template <class T>
std::enable_if_t<has_name<T>::value,
std::string>
name()
{ return T::name(); }
template <class T>
std::enable_if_t<!has_name<T>::value,
std::string>
name()
{ return typeid(T).name(); }
/** Provides unique identifiers for Components;
* Determines Component layout in entities.
*/
template <class... Cpts>
using ComponentIndex = util::TypeVector<Cpts...>;
#ifdef _BUILD_TEST
#endif
#endif