forked from galois-advertising/gparallel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeta.h
60 lines (53 loc) · 1.82 KB
/
meta.h
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
55
56
57
58
59
60
#pragma once
#include "util.h"
#include "log.h"
namespace galois::gparallel {
template <class T, class _meta_storage_t,
template <class> class _meta_name,
template <class> class... _super_meta_names>
struct meta_traits : public T {
typedef meta_info_t<_meta_storage_t, _meta_name, _super_meta_names...> meta_info;
typedef _meta_storage_t meta_storage_t;
};
#define DECL_META(meta_name, meta_storage_t, super_meta_names...) template <class T> \
struct meta_name : public meta_traits<T, meta_storage_t, meta_name, ##super_meta_names>
// DECL_MEAT(MetaName, MetaType, OtherMetaName...)
// MetaName<auto_type>[getters, setters] -> meta_traits[meta_info, meta_storage_t] -> auto_type
// `data_meta_name` is essentially a T.
// Between `data_meta_name` and T, there a meta_traits
// for describe:
// 1. Other data_meta_names which it depends.
// 2. Type of this data_meta
//template <int I, class T>
//struct meta_storage_t {
// meta_storage_t() = delete;
// template <class U>
// meta_storage_t(const U & u) : data(u) {
// INFO("[ENTRY] meta_storage_t<%d, %s>::meta_storage_t<%s>()",
// I, demangle(typeid(T).name()).c_str(), demangle(typeid(U).name()).c_str());
// }
// T data;
//};
//template <int I, class... TS>
//struct storage_helper {};
//
//template <int I, class T, class... TS>
//struct storage_helper <I, T, TS...> :
// public meta_storage_t <I, T>,
// public storage_helper<I + 1, TS...> {
// template <class U>
// storage_helper(const U & u) :
// meta_storage_t<I, T>(u), storage_helper<I + 1, TS...>(u) {};
//};
//
//template <int I>
//struct storage_helper<I> {
// template <class U>
// storage_helper(const U &) {}
//};
//template <int I, class T>
//T* get_state(meta_storage_t<I, T> & states) {
// return &states.data;
//}
}