From d117e5c274597734b8c78ff73708b4b818226af8 Mon Sep 17 00:00:00 2001 From: Fabian Posch Date: Thu, 11 Jan 2024 13:27:57 -0500 Subject: [PATCH] inline macros that shouldn't have been there --- include/db_types.hpp | 18 +++++++++++++++++- src/util.h | 20 -------------------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/include/db_types.hpp b/include/db_types.hpp index 3f64c53..5fd0c08 100644 --- a/include/db_types.hpp +++ b/include/db_types.hpp @@ -107,7 +107,23 @@ static std::unordered_map job_status_type_st { {"unknown", JobStatusType::UNKNOWN} }; -ENUM_CLASS_OPS(JobStatusType, job_status_type_st); +inline std::string to_string(JobStatusType const &value) { + std::string str = "unknown"; + + for (auto& it : job_status_type_st) { + if (it.second == value) { + str = it.first; + break; + } + } + + return str; +}; + +inline std::ostream& operator<<(std::ostream& os, JobStatusType const &rhs) { + os << to_string(rhs); + return os; +} // macro for registering enum classes for PQXX diff --git a/src/util.h b/src/util.h index 87d2123..c057325 100644 --- a/src/util.h +++ b/src/util.h @@ -35,24 +35,4 @@ #define DEBUG_PRINT(msg) do {} while (0) #endif -#define ENUM_CLASS_OPS(T, lookup_table) \ - \ - inline std::string to_string(T const &value) { \ - std::string str = "unknown"; \ - \ - for (auto& it : lookup_table) { \ - if (it.second == value) { \ - str = it.first; \ - break; \ - } \ - } \ - \ - return str; \ - }; \ - \ - inline std::ostream& operator<<(std::ostream& os, T const &rhs) { \ - os << to_string(rhs); \ - return os; \ - }; - #endif \ No newline at end of file