HOPS
HOPS class reference
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
hops::MHO_JSONWrapper Class Reference

#include <MHO_JSONHeaderWrapper.hh>

Inheritance diagram for hops::MHO_JSONWrapper:
[legend]

Public Member Functions

virtual ~MHO_JSONWrapper ()
 
void Clear ()
 Clears the internal object. More...
 
bool ContainsKey (const std::string &key) const
 Checks if a map contains a specific key. More...
 
std::vector< std::string > DumpKeys () const
 Dumps all keys from the internal object. More...
 
void DumpMap () const
 Dumps the contents of the map fObject to standard output. More...
 
bool HasKey (const char *char_key) const
 Checks if a key exists in the internal map. More...
 
bool HasKey (const std::string &key) const
 Checks if a key exists in the internal map. More...
 
template<typename XValueType >
void Insert (const std::string &key, const XValueType &value)
 Inserts or replaces an object in a map using a key and value. More...
 
MHO_JSONWrapperoperator= (const MHO_JSONWrapper &rhs)
 
template<>
bool Retrieve (const std::string &key, mho_json &value) const
 Retrieves a value from the JSON object by key and stores it in the provided reference. More...
 
template<typename XValueType >
bool Retrieve (const std::string &key, XValueType &value) const
 Retrieves a value from an object by key and casts it to the specified type. More...
 

Protected Member Functions

 MHO_JSONWrapper ()
 
 MHO_JSONWrapper (const MHO_JSONWrapper &copy)
 
void SetObject (mho_json obj)
 Setter for object. More...
 

Protected Attributes

mho_json fObject
 

Constructor & Destructor Documentation

◆ MHO_JSONWrapper() [1/2]

hops::MHO_JSONWrapper::MHO_JSONWrapper ( )
inlineprotected

◆ MHO_JSONWrapper() [2/2]

hops::MHO_JSONWrapper::MHO_JSONWrapper ( const MHO_JSONWrapper copy)
inlineprotected

◆ ~MHO_JSONWrapper()

virtual hops::MHO_JSONWrapper::~MHO_JSONWrapper ( )
inlinevirtual

Member Function Documentation

◆ Clear()

void hops::MHO_JSONWrapper::Clear ( )
inline

Clears the internal object.

◆ ContainsKey()

bool hops::MHO_JSONWrapper::ContainsKey ( const std::string &  key) const
inline

Checks if a map contains a specific key.

Parameters
keyThe key to search for in the map.
Returns
True if the key is found, false otherwise.

◆ DumpKeys()

std::vector< std::string > hops::MHO_JSONWrapper::DumpKeys ( ) const
inline

Dumps all keys from the internal object.

Returns
Vector of strings containing all keys

◆ DumpMap()

void hops::MHO_JSONWrapper::DumpMap ( ) const
inline

Dumps the contents of the map fObject to standard output.

◆ HasKey() [1/2]

bool hops::MHO_JSONWrapper::HasKey ( const char *  char_key) const
inline

Checks if a key exists in the internal map.

Parameters
char_key(const char*)
Returns
True if the key is found, false otherwise.

◆ HasKey() [2/2]

bool hops::MHO_JSONWrapper::HasKey ( const std::string &  key) const
inline

Checks if a key exists in the internal map.

Parameters
keyThe key to search for in the map.
Returns
True if the key is found, false otherwise.

◆ Insert()

template<typename XValueType >
void hops::MHO_JSONWrapper::Insert ( const std::string &  key,
const XValueType &  value 
)
inline

Inserts or replaces an object in a map using a key and value.

Parameters
keyThe unique identifier for the object to be inserted/replaced.
value(const XValueType&)
Returns
No return value (void)

◆ operator=()

MHO_JSONWrapper& hops::MHO_JSONWrapper::operator= ( const MHO_JSONWrapper rhs)
inline

◆ Retrieve() [1/2]

template<>
bool hops::MHO_JSONWrapper::Retrieve ( const std::string &  key,
mho_json value 
) const
inline

Retrieves a value from the JSON object by key and stores it in the provided reference.

Parameters
keyKey to search for in the JSON object
valueReference to store the retrieved value
Returns
True if retrieval was successful, false otherwise

◆ Retrieve() [2/2]

template<typename XValueType >
bool hops::MHO_JSONWrapper::Retrieve ( const std::string &  key,
XValueType &  value 
) const
inline

Retrieves a value from an object by key and casts it to the specified type.

Parameters
keyKey used to lookup the value in the object
value(XValueType&)
Returns
True if retrieval was successful, false otherwise

◆ SetObject()

void hops::MHO_JSONWrapper::SetObject ( mho_json  obj)
inlineprotected

Setter for object.

Parameters
objInput mho_json object to set

Member Data Documentation

◆ fObject

mho_json hops::MHO_JSONWrapper::fObject
protected

The documentation for this class was generated from the following file: