PODIO v00-16-03
An Event-Data-Model Toolkit for High Energy Physics Experiments
|
#include <GenericParameters.h>
Public Types | |
template<typename T > | |
using | MapType = std::map< std::string, std::vector< T > > |
Public Member Functions | |
GenericParameters () | |
GenericParameters (const GenericParameters &) | |
GenericParameters & | operator= (const GenericParameters &)=delete |
GenericParameters (GenericParameters &&)=default | |
GenericParameters are default moveable. | |
GenericParameters & | operator= (GenericParameters &&)=default |
~GenericParameters ()=default | |
template<typename T , typename = EnableIfValidGenericDataType<T>> | |
GenericDataReturnType< T > | getValue (const std::string &) const |
template<typename T , typename = EnableIfValidGenericDataType<T>> | |
void | setValue (const std::string &key, T value) |
Store (a copy of) the passed value under the given key. | |
void | setValue (const std::string &key, std::string value) |
Overload for catching const char* setting for string values. | |
void | setValue (const std::string &key, std::vector< std::string > values) |
Overlaod for catching initializer list setting of string vector values. | |
template<typename T , typename = std::enable_if_t<detail::isInTuple<T, SupportedGenericDataTypes>>> | |
void | setValue (const std::string &key, std::initializer_list< T > &&values) |
Overload for catching initializer list setting for vector values. | |
template<typename T , typename = EnableIfValidGenericDataType<T>> | |
size_t | getN (const std::string &key) const |
Get the number of elements stored under the given key for a type. | |
template<typename T , typename = EnableIfValidGenericDataType<T>> | |
std::vector< std::string > | getKeys () const |
Get all available keys for a given type. | |
DEPRECATED_ACCESS int | getIntVal (const std::string &key) const |
DEPRECATED_ACCESS float | getFloatVal (const std::string &key) const |
DEPRECATED_ACCESS const std::string & | getStringVal (const std::string &key) const |
DEPRECATED_ACCESS IntVec & | getIntVals (const std::string &key, IntVec &values) const |
DEPRECATED_ACCESS FloatVec & | getFloatVals (const std::string &key, FloatVec &values) const |
DEPRECATED_ACCESS StringVec & | getStringVals (const std::string &key, StringVec &values) const |
DEPRECATED_ACCESS const StringVec & | getIntKeys (StringVec &keys) const |
DEPRECATED_ACCESS const StringVec & | getFloatKeys (StringVec &keys) const |
DEPRECATED_ACCESS const StringVec & | getStringKeys (StringVec &keys) const |
DEPRECATED_ACCESS int | getNInt (const std::string &key) const |
DEPRECATED_ACCESS int | getNFloat (const std::string &key) const |
DEPRECATED_ACCESS int | getNString (const std::string &key) const |
DEPRECATED_ACCESS void | setValues (const std::string &key, const IntVec &values) |
DEPRECATED_ACCESS void | setValues (const std::string &key, const FloatVec &values) |
DEPRECATED_ACCESS void | setValues (const std::string &key, const StringVec &values) |
void | clear () |
erase all elements | |
void | print (std::ostream &os=std::cout, bool flush=true) |
bool | empty () const |
Check if no parameter is stored (i.e. if all internal maps are empty) | |
const IntMap & | getIntMap () const |
IntMap & | getIntMap () |
const FloatMap & | getFloatMap () const |
FloatMap & | getFloatMap () |
const DoubleMap & | getDoubleMap () const |
DoubleMap & | getDoubleMap () |
const StringMap & | getStringMap () const |
StringMap & | getStringMap () |
GenericParameters objects allow to store generic named parameters of type int, float and string or vectors of these types. They can be used to store (user) meta data that is run, event or collection dependent. (based on lcio::LCParameters)
Definition at line 74 of file GenericParameters.h.
using podio::GenericParameters::MapType = std::map<std::string, std::vector<T> > |
Definition at line 77 of file GenericParameters.h.
podio::GenericParameters::GenericParameters | ( | ) |
Definition at line 8 of file GenericParameters.cc.
podio::GenericParameters::GenericParameters | ( | const GenericParameters & | other | ) |
GenericParameters are copyable NOTE: This is currently mainly done to keep the ROOT I/O happy, because that needs a copy constructor
Definition at line 15 of file GenericParameters.cc.
|
default |
GenericParameters are default moveable.
|
default |
|
inline |
erase all elements
Definition at line 199 of file GenericParameters.h.
Referenced by podio::EventStore::clear(), and podio::EventStore::clearCollections().
|
inline |
Check if no parameter is stored (i.e. if all internal maps are empty)
Definition at line 208 of file GenericParameters.h.
Referenced by podio::EventStore::getEventMetaData(), and getValue().
|
inline |
Definition at line 238 of file GenericParameters.h.
|
inline |
Get the internal double map (necessary for serialization with SIO)
Definition at line 235 of file GenericParameters.h.
Referenced by podio::readGenericParameters(), and podio::writeGenericParameters().
Returns a list of all keys of float parameters.
Definition at line 75 of file GenericParameters.cc.
|
inline |
Definition at line 228 of file GenericParameters.h.
|
inline |
Get the internal float map (necessary for serialization with SIO)
Definition at line 225 of file GenericParameters.h.
Referenced by podio::readGenericParameters(), and podio::writeGenericParameters().
float podio::GenericParameters::getFloatVal | ( | const std::string & | key | ) | const |
Returns the first float value for the given key.
Definition at line 39 of file GenericParameters.cc.
FloatVec & podio::GenericParameters::getFloatVals | ( | const std::string & | key, |
FloatVec & | values | ||
) | const |
Adds all float values for the given key to values. Returns a reference to values for convenience.
Definition at line 54 of file GenericParameters.cc.
Returns a list of all keys of integer parameters.
Definition at line 68 of file GenericParameters.cc.
|
inline |
Definition at line 218 of file GenericParameters.h.
|
inline |
Get the internal int map (necessary for serialization with SIO)
Definition at line 215 of file GenericParameters.h.
Referenced by podio::readGenericParameters(), and podio::writeGenericParameters().
int podio::GenericParameters::getIntVal | ( | const std::string & | key | ) | const |
Returns the first integer value for the given key.
Definition at line 35 of file GenericParameters.cc.
Adds all integer values for the given key to values. Returns a reference to values for convenience.
Definition at line 47 of file GenericParameters.cc.
std::vector< std::string > podio::GenericParameters::getKeys |
Get all available keys for a given type.
Definition at line 356 of file GenericParameters.h.
size_t podio::GenericParameters::getN | ( | const std::string & | key | ) | const |
Get the number of elements stored under the given key for a type.
Definition at line 345 of file GenericParameters.h.
int podio::GenericParameters::getNFloat | ( | const std::string & | key | ) | const |
The number of float values stored for this key.
Definition at line 93 of file GenericParameters.cc.
int podio::GenericParameters::getNInt | ( | const std::string & | key | ) | const |
The number of integer values stored for this key.
Definition at line 89 of file GenericParameters.cc.
int podio::GenericParameters::getNString | ( | const std::string & | key | ) | const |
The number of string values stored for this key.
Definition at line 97 of file GenericParameters.cc.
Returns a list of all keys of string parameters.
Definition at line 82 of file GenericParameters.cc.
|
inline |
Definition at line 248 of file GenericParameters.h.
|
inline |
Get the internal string map (necessary for serialization with SIO)
Definition at line 245 of file GenericParameters.h.
Referenced by podio::readGenericParameters(), and podio::writeGenericParameters().
const std::string & podio::GenericParameters::getStringVal | ( | const std::string & | key | ) | const |
Returns the first string value for the given key.
Definition at line 43 of file GenericParameters.cc.
StringVec & podio::GenericParameters::getStringVals | ( | const std::string & | key, |
StringVec & | values | ||
) | const |
Adds all float values for the given key to values. Returns a reference to values for convenience.
Definition at line 61 of file GenericParameters.cc.
GenericDataReturnType< T > podio::GenericParameters::getValue | ( | const std::string & | key | ) | const |
Get the value that is stored under the given key, by const reference or by value depending on the desired type
Definition at line 307 of file GenericParameters.h.
Referenced by getFloatVals(), getIntVals(), and getStringVals().
|
delete |
|
default |
void podio::GenericParameters::print | ( | std::ostream & | os = std::cout , |
bool | flush = true |
||
) |
Definition at line 136 of file GenericParameters.cc.
|
inline |
Overload for catching initializer list setting for vector values.
Definition at line 123 of file GenericParameters.h.
|
inline |
Overload for catching const char* setting for string values.
Definition at line 112 of file GenericParameters.h.
|
inline |
Overlaod for catching initializer list setting of string vector values.
Definition at line 117 of file GenericParameters.h.
void podio::GenericParameters::setValue | ( | const std::string & | key, |
T | value | ||
) |
Store (a copy of) the passed value under the given key.
Definition at line 329 of file GenericParameters.h.
Referenced by setValues(), TEST_CASE(), and write().
void podio::GenericParameters::setValues | ( | const std::string & | key, |
const FloatVec & | values | ||
) |
Set float values for the given key.
Definition at line 105 of file GenericParameters.cc.
void podio::GenericParameters::setValues | ( | const std::string & | key, |
const IntVec & | values | ||
) |
Set integer values for the given key.
Definition at line 101 of file GenericParameters.cc.
void podio::GenericParameters::setValues | ( | const std::string & | key, |
const StringVec & | values | ||
) |
Set string values for the given key.
Definition at line 109 of file GenericParameters.cc.