1 #ifndef JSON_WRAPPER_HH__
2 #define JSON_WRAPPER_HH__
4 #include "nlohmann/json.hpp"
7 namespace nl = nlohmann;
54 bool HasKey(
const std::string& key)
const
70 bool HasKey(
const char* char_key)
const
72 std::string key(char_key);
97 template<
typename XValueType >
void Insert(
const std::string& key,
const XValueType&
value)
110 template<
typename XValueType >
bool Retrieve(
const std::string& key, XValueType&
value)
const
118 test[
"test"] =
value;
119 if(iter.value().type() == test.begin().value().type())
121 value = iter.value().get< XValueType >();
137 std::vector< std::string > keys;
140 keys.push_back(iter.key());
153 std::cout << iter.key() <<
" : " << iter.value() << std::endl;
Definition: MHO_JSONHeaderWrapper.hh:29
bool ContainsKey(const std::string &key) const
Checks if a map contains a specific key.
Definition: MHO_JSONHeaderWrapper.hh:163
virtual ~MHO_JSONWrapper()
Definition: MHO_JSONHeaderWrapper.hh:46
std::vector< std::string > DumpKeys() const
Dumps all keys from the internal object.
Definition: MHO_JSONHeaderWrapper.hh:135
MHO_JSONWrapper()
Definition: MHO_JSONHeaderWrapper.hh:31
bool Retrieve(const std::string &key, XValueType &value) const
Retrieves a value from an object by key and casts it to the specified type.
Definition: MHO_JSONHeaderWrapper.hh:110
MHO_JSONWrapper(const MHO_JSONWrapper ©)
Definition: MHO_JSONHeaderWrapper.hh:33
void DumpMap() const
Dumps the contents of the map fObject to standard output.
Definition: MHO_JSONHeaderWrapper.hh:149
void SetObject(mho_json obj)
Setter for object.
Definition: MHO_JSONHeaderWrapper.hh:40
bool HasKey(const char *char_key) const
Checks if a key exists in the internal map.
Definition: MHO_JSONHeaderWrapper.hh:70
void Clear()
Clears the internal object.
Definition: MHO_JSONHeaderWrapper.hh:88
MHO_JSONWrapper & operator=(const MHO_JSONWrapper &rhs)
Definition: MHO_JSONHeaderWrapper.hh:76
void Insert(const std::string &key, const XValueType &value)
Inserts or replaces an object in a map using a key and value.
Definition: MHO_JSONHeaderWrapper.hh:97
bool HasKey(const std::string &key) const
Checks if a key exists in the internal map.
Definition: MHO_JSONHeaderWrapper.hh:54
mho_json fObject
Definition: MHO_JSONHeaderWrapper.hh:43
Definition: MHO_ChannelLabeler.hh:17