32#ifndef DRAIN_ENUM_FLAGS
33#define DRAIN_ENUM_FLAGS
68template <
class E,
class OWNER=E>
86 const std::string &
str(
const E & value){
96 bool setValue(
const std::string & key, E & value){
124 E
getValue(
const std::string &key,
bool lenient=
true){
145#define DRAIN_ENUM_ENTRY(nspace, key) {#key, nspace::key}
147#define DRAIN_ENUM_OSTREAM(enumtype) inline std::ostream & operator<<(std::ostream &ostr, const enumtype & e){return ostr << drain::EnumDict<enumtype>::dict.getKey(e);}
187 typedef typename F::value_t value_t;
188 typedef typename F::storage_t storage_t;
189 typedef typename F::dict_t dict_t;
190 typedef FlagResolver::ivalue_t ivalue_t;
210 template <
typename ... T>
264 this->set(flagger.value);
Two-way mapping between strings and objects of template class T.
Definition Dictionary.h:63
const K & getKey(const V &value, bool lenient=true) const
Identity mapping useful for type deduction of template arguments in functions.
Definition Dictionary.h:172
const V & getValue(const K &key, bool lenient=true) const
Given a key, return the first value associated with it.
Definition Dictionary.h:149
Flagger accepting values of enum type E.
Definition EnumFlags.h:182
EnumFlagger(const storage_t &v)
Constructor with initial value.
Definition EnumFlags.h:199
EnumFlagger()
Default constructor.
Definition EnumFlags.h:194
EnumFlagger< F > & operator=(const EnumFlagger< F > &flagger)
Definition EnumFlags.h:263
static ivalue_t getValueNEW(const std::string &key)
Returns the static dictionary created for this value_t .
Definition EnumFlags.h:238
Definition DataSelector.cpp:1277
A container for a static dictionary of enumeration values.
Definition EnumFlags.h:69
static E getValue(const char *key, bool lenient=true)
Convenience for object.set(...) like commands.
Definition EnumFlags.h:134
static const std::string & str(const E &value)
Convenience.
Definition EnumFlags.h:86
static E getValue(const E &value, bool lenient=true)
Convenience for object.set(...) like commands.
Definition EnumFlags.h:114
static bool setValue(const std::string &key, E &value)
Assign string values to an enumeration type.
Definition EnumFlags.h:96
static E getValue(const std::string &key, bool lenient=true)
Convenience for object.set(...) like commands.
Definition EnumFlags.h:124