![]() |
Project
|
#include <RootSerializableKeyValueStore.h>
Classes | |
struct | SerializedInfo |
Structure encapsulating the stored information: raw buffers and attached type information (combination of type_index_hash and TClass information) More... | |
Public Types | |
enum class | GetState { kOK = 0 , kNOSUCHKEY = 1 , kWRONGTYPE = 2 , kNOTCLASS = 3 } |
Public Member Functions | |
RootSerializableKeyValueStore ()=default | |
template<typename T > | |
void | put (std::string const &key, T const &value) |
template<typename T > | |
const T * | get (std::string const &key) const |
returns object pointer for this key or nullptr if error or does not exist. | |
template<typename T > | |
const T * | get (std::string const &key, GetState &state) const |
returns object pointer for this key or nullptr if error or does not exist; state is set with meaningful error code | |
template<typename T > | |
const T & | getRef (std::string const &key, GetState &state) const |
bool | has (std::string const &key) const |
checks if a key exists | |
void | clear () |
clear the store | |
void | print (bool includetypeinfo=false) const |
print list of keys, values (and optionally type information) | |
void | copyFrom (RootSerializableKeyValueStore const &other) |
resets store to the store of another object | |
Static Public Member Functions | |
static const char * | getStateString (GetState state) |
A ROOT serializable container mapping a key (string) to an object of arbitrary type.
The container allows to group objects in heterogeneous type in a key-value container. The container can be ROOT serialized which adds on-top of existing solutions such as boost::property_tree. This may be useful in various circumenstances, for instance to assemble various CCDB objects into a single aggregate to reduce the number of CCDB files/entries.
Definition at line 37 of file RootSerializableKeyValueStore.h.
|
strong |
Enumerator | |
---|---|
kOK | |
kNOSUCHKEY | |
kWRONGTYPE | |
kNOTCLASS |
Definition at line 81 of file RootSerializableKeyValueStore.h.
|
default |
|
inline |
clear the store
Definition at line 150 of file RootSerializableKeyValueStore.h.
|
inline |
resets store to the store of another object
Definition at line 159 of file RootSerializableKeyValueStore.h.
|
inline |
returns object pointer for this key or nullptr if error or does not exist.
Definition at line 115 of file RootSerializableKeyValueStore.h.
|
inline |
returns object pointer for this key or nullptr if error or does not exist; state is set with meaningful error code
Definition at line 123 of file RootSerializableKeyValueStore.h.
|
inline |
get interface returning a const reference instead of pointer; Error handling/detection is done via the state argument; Beware: In case of errors, a default object is returned.
Definition at line 131 of file RootSerializableKeyValueStore.h.
|
inlinestatic |
Definition at line 96 of file RootSerializableKeyValueStore.h.
|
inline |
checks if a key exists
Definition at line 144 of file RootSerializableKeyValueStore.h.
void RootSerializableKeyValueStore::print | ( | bool | includetypeinfo = false | ) | const |
print list of keys, values (and optionally type information)
Definition at line 28 of file RootSerializableKeyValueStore.cxx.
|
inline |
Putting a value (and overrides previous entries) T needs to be trivial non-pointer type or a type having a ROOT TClass instance
Definition at line 106 of file RootSerializableKeyValueStore.h.