42 utility::IJsonConvertible &
object);
48 const utility::IJsonConvertible &
object);
51 utility::IJsonConvertible &
object);
54 const utility::IJsonConvertible &
object);
57 utility::IJsonConvertible &
object);
60 const utility::IJsonConvertible &
object);
79 #define DECLARE_STRINGIFY_ENUM(ENUM_TYPE) \ 80 std::string enum_to_string(ENUM_TYPE e); \ 81 void enum_from_string(const std::string &str, ENUM_TYPE &e); 83 #define STRINGIFY_ENUM(ENUM_TYPE, ...) \ 84 std::string enum_to_string(ENUM_TYPE e) { \ 85 static_assert(std::is_enum<ENUM_TYPE>::value, \ 86 #ENUM_TYPE " must be an enum!"); \ 87 static const std::pair<ENUM_TYPE, std::string> m[] = __VA_ARGS__; \ 88 auto it = std::find_if( \ 89 std::begin(m), std::end(m), \ 90 [e](const std::pair<ENUM_TYPE, std::string> &es_pair) \ 91 -> bool { return es_pair.first == e; }); \ 92 return ((it != std::end(m)) ? it : std::begin(m))->second; \ 94 void enum_from_string(const std::string &str, ENUM_TYPE &e) { \ 95 static_assert(std::is_enum<ENUM_TYPE>::value, \ 96 #ENUM_TYPE " must be an enum!"); \ 97 static const std::pair<ENUM_TYPE, std::string> m[] = __VA_ARGS__; \ 98 auto it = std::find_if( \ 99 std::begin(m), std::end(m), \ 100 [&str](const std::pair<ENUM_TYPE, std::string> &es_pair) \ 101 -> bool { return es_pair.second == str; }); \ 102 e = ((it != std::end(m)) ? it : std::begin(m))->first; \ 103 utility::LogDebug("{} -> {}", str, e); \ bool ReadIJsonConvertibleFromJSON(const std::string &filename, utility::IJsonConvertible &object)
Definition: FileJSON.cpp:73
bool ReadIJsonConvertible(const std::string &filename, utility::IJsonConvertible &object)
Definition: IJsonConvertibleIO.cpp:58
bool WriteIJsonConvertibleToJSONString(std::string &json_string, const utility::IJsonConvertible &object)
Definition: FileJSON.cpp:105
bool WriteIJsonConvertibleToJSON(const std::string &filename, const utility::IJsonConvertible &object)
Definition: FileJSON.cpp:86
bool WriteIJsonConvertible(const std::string &filename, const utility::IJsonConvertible &object)
Definition: IJsonConvertibleIO.cpp:79
bool ReadIJsonConvertibleFromJSONString(const std::string &json_string, utility::IJsonConvertible &object)
Definition: FileJSON.cpp:99
Definition: PinholeCameraIntrinsic.cpp:35