-
Notifications
You must be signed in to change notification settings - Fork 3
/
golpe.h.tt
79 lines (57 loc) · 1.48 KB
/
golpe.h.tt
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#pragma once
#include <stdint.h>
#include <string>
#include <limits>
#include <hoytech/hex.h>
#include <hoytech/error.h>
[% IF golpe.features.config %]
#include <tao/config/value.hpp>
[% END %]
[% IF golpe.features.flatbuffers || golpe.features.db %]
#include "flatbuffers/flatbuffers.h"
#include "flatbuffers/minireflect.h"
[% END %]
[% FOREACH h IN generatedHeaders -%]
#include "[% h %]"
[% END %]
[% IF golpe.features.db %]
#include "defaultDb.h"
[% END %]
[% IF golpe.features.onAppStartup %]
void onAppStartup(lmdb::txn &txn, const std::string &cmd);
[% END %]
// Logging
#define LOGURU_WITH_STREAMS 1
#include <loguru.hpp>
#define LE LOG_S(ERROR)
#define LW LOG_S(WARNING)
#define LI LOG_S(INFO)
template<class... T>
inline void setThreadName(const T&... value) {
std::ostringstream o;
hoytech::build_string(o, value...);
loguru::set_thread_name(o.str().c_str());
}
// Convenience
using hoytech::to_hex;
using hoytech::from_hex;
#define herr hoytech::error
struct NonCopyable {
NonCopyable & operator=(const NonCopyable&) = delete;
NonCopyable(const NonCopyable&) = delete;
NonCopyable(NonCopyable&&) = default;
NonCopyable() = default;
};
const uint64_t MAX_U64 = std::numeric_limits<uint64_t>::max();
// Globals
[% IF golpe.features.config %]
#include "config.h"
extern std::string configFile;
[% END %]
[% IF golpe.features.db %]
extern std::string dbDir;
extern defaultDb::environment env;
[% END %]
[% IF useGlobalH %]
#include "global.h"
[% END %]