7 #ifndef GRAPHGEN_UTILITIES_H_
8 #define GRAPHGEN_UTILITIES_H_
23 std::string
binary(
size_t u,
size_t nbits);
28 #define DEFINE_ENUM_CLASS_OR_OPERATOR(class_name) \
29 constexpr enum class_name operator|(const enum class_name self_value, const enum class_name in_value) { \
30 return static_cast<enum class_name>(static_cast<uint32_t>(self_value) | static_cast<uint32_t>(in_value)); \
36 #define DEFINE_ENUM_CLASS_AND_OPERATOR(class_name) \
37 constexpr bool operator&(const enum class_name self_value, const enum class_name in_value) { \
38 return static_cast<bool>(static_cast<uint32_t>(self_value) & static_cast<uint32_t>(in_value)); \
41 #define DEFINE_ENUM_CLASS_FLAGS(class_name, ...) \
42 enum class class_name : uint32_t { \
45 DEFINE_ENUM_CLASS_OR_OPERATOR(class_name) \
46 DEFINE_ENUM_CLASS_AND_OPERATOR(class_name) \
63 static inline void RemoveCharacter(std::string& s,
const char c) {
64 s.erase(std::remove(s.begin(), s.end(), c), s.end());
69 std::string
zerostr(
const T& val,
size_t n) {
71 ss << std::setw(n) << std::setfill(
'0') << val;
77 void StringSplit(
const std::string& str, T& cont,
char delim =
'+')
79 std::stringstream ss(str);
81 while (std::getline(ss, token, delim)) {
82 cont.push_back(token);
90 #define LOG(message, instructions) std::cout << (message) << "... "; instructions std::cout << "done.\n"
93 #define TLOG(message, instructions) std::cout << (message) << "... "; tlog_pe.start(); instructions std::cout << "done. " << tlog_pe.stop() << " ms.\n";
This class stores the configuration data loaded from file. All data are placed in the config global v...
void SetId(size_t new_id)
std::string zerostr(const T &val, size_t n)
void StringSplit(const std::string &str, T &cont, char delim='+')
std::string binary(size_t u, size_t nbits)