Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Enum< E, OWNER > Struct Template Reference

A container for a static dictionary of enumeration values. More...

#include <Enum.h>

Collaboration diagram for Enum< E, OWNER >:
Collaboration graph
[legend]

Public Types

typedef drain::Dictionary< std::string, E > dict_t
 

Public Member Functions

const drain::Enum< ProductConf::OutputDataVerbosity >::dict_t dict
 
const drain::Enum< ProductConf::OutputDataVerbosity >::dict_t dict
 
const drain::Enum< FileGeoTIFF::TiffCompliance >::dict_t dict
 
const drain::Enum< Status >::dict_t dict
 
const drain::Enum< Status >::dict_t dict
 
const drain::Enum< TextStyle::Style >::dict_t dict
 
const drain::Enum< TextStyle::Colour >::dict_t dict
 
const drain::Enum< TextStyle::Line >::dict_t dict
 
const drain::Enum< Reader::Mode >::dict_t dict
 
const drain::Enum< hi5::Reader::Mode >::dict_t dict
 
const drain::Enum< rack::ODIM::Version, CmdOutputFile >::dict_t dict
 
const drain::Enum< Hdf5Context::Hi5Role >::dict_t dict
 
const drain::Enum< Hdf5Context::Hi5RoleFlagger >::dict_t dict
 

Static Public Member Functions

static const dict_tgetDict ()
 
static const std::string & str (const E &value)
 Convenience.
 
static bool setValue (const std::string &key, E &value)
 Assign string values to an enumeration type.
 
static E getValue (const E &value, bool lenient=true)
 Convenience for object.set(...) like commands.
 
static E getValue (const std::string &key, bool lenient=true)
 Convenience for object.set(...) like commands.
 
static E getValue (const char *key, bool lenient=true)
 Convenience for object.set(...) like commands.
 
static const std::string & getKey (const std::string &s, bool lenient=true)
 Convenience for object.set(...) like commands.
 
static const char * getKey (const char *s, bool lenient=true)
 
static const std::string & getKey (const E &value, bool lenient=true)
 
static void convert (const E &value, std::string &s)
 Experimental. Convenience for object.set(...) like commands.
 
static void convert (const std::string &s, E &value)
 

Static Public Attributes

static const dict_t dict
 

Detailed Description

template<class E, class OWNER = E>
struct drain::Enum< E, OWNER >

A container for a static dictionary of enumeration values.

DrainCore

Template Parameters
E- enumeration or integer type
OWNER- identifier type (separate type, typically a class, can be used if several dictionaries needed for the same enumeration type)

Template is needed to create a unique, shared (static) dict object for each template.

Member Function Documentation

◆ convert()

template<class E , class OWNER = E>
static void convert ( const E &  value,
std::string &  s 
)
inlinestatic

Experimental. Convenience for object.set(...) like commands.

 \param lenient - when value not found, only return empty, do not throw exception.
 \return enum value of the key

static inline const std::string & getKey(const std::string & value, bool lenient=true){ return value; }

◆ dict()

const drain::Enum< rack::ODIM::Version, CmdOutputFile >::dict_t dict

A "private" dictionary, distinguished with the 2nd template argument referring to the owner.

◆ getKey()

template<class E , class OWNER = E>
static const std::string & getKey ( const std::string &  s,
bool  lenient = true 
)
inlinestatic

Convenience for object.set(...) like commands.

 \return enum value of the key

 Note: cannot return (const E &) as storage type is (long) int.

static inline E getKey(const E & value, bool lenient=true){ return value; } Experimental. Convenience for object.set(...) like commands.

Parameters
lenient- when key not found, only return empty, do not throw exception.
Returns
enum value of the key

◆ getValue() [1/3]

template<class E , class OWNER = E>
static E getValue ( const char *  key,
bool  lenient = true 
)
inlinestatic

Convenience for object.set(...) like commands.

Parameters
lenient- when value not found, only return empty, do not throw exception.
Returns
enum value of the key

◆ getValue() [2/3]

template<class E , class OWNER = E>
static E getValue ( const E &  value,
bool  lenient = true 
)
inlinestatic

Convenience for object.set(...) like commands.

Returns
enum value of the key

Note: cannot return (const E &) as storage type is (long) int.

◆ getValue() [3/3]

template<class E , class OWNER = E>
static E getValue ( const std::string &  key,
bool  lenient = true 
)
inlinestatic

Convenience for object.set(...) like commands.

Parameters
lenient- when key not found, only return empty, do not throw exception.
Returns
enum value of the key

◆ setValue()

template<class E , class OWNER = E>
static bool setValue ( const std::string &  key,
E &  value 
)
inlinestatic

Assign string values to an enumeration type.

Template Parameters
E- some enumeration type for which Dictionary dict has been defined.

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