Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
FlaggerBase< E, T > Class Template Referenceabstract

#include <FlagBase.h>

Inheritance diagram for FlaggerBase< E, T >:
Inheritance graph
[legend]

Public Types

typedef E value_t
 
typedef T storage_t
 
typedef Dictionary< std::string, E > dict_t
 
typedef dict_t::key_t key_t
 

Public Member Functions

virtual const dict_tgetDict () const =0
 Returns the static dictionary created for this value_t .
 
virtual void reset ()
 
virtual bool isSet (const storage_t &x) const =0
 Checks if a given bit, or any of given bits, is set.
 
bool isSet (const key_t &key) const
 
const storage_t & getValue () const
 
 operator const storage_t & () const
 
 operator storage_t & ()
 
 operator bool () const
 
virtual const key_t & str () const =0
 String corresponding the current value. Returns empty, if not found.
 
 operator const key_t & () const
 
void debug (std::ostream &ostr) const
 

Public Attributes

storage_t & value
 
char separator
 

Protected Member Functions

 FlaggerBase (char separator=',')
 
 FlaggerBase (storage_t &v, char separator=',')
 Value-referencing constructor.
 

Detailed Description

template<typename E = std::size_t, typename T = E>
class drain::FlaggerBase< E, T >

A Flag mapper designed for global use, also supporting ENUM types. @See Perhaps replacing GlobalFlagger later.

Example:

enum Crit {DATA, ELANGLE, TIME};
template <>
const SingleFlagger<Crit>::dict_t SingleFlagger<Crit>::dict = {{"DATA", DATA}, {"ELANGLE", ELANGLE}, {"TIME", TIME}};
Two-way mapping between strings and objects of template class T.
Definition Dictionary.h:63
Definition Flags.h:70

Inside a class:

class Reader {
public:
enum Mode {ATTRIBUTES=1, DATASETS=2};
}
// In the same or another header file:
template <>
// In the definition file:
template <>
{{"ATTRIBUTES", Reader::ATTRIBUTES}, {"DATASETS", Reader::DATASETS}};
Template Parameters
E- single-value type: enum or integer
T- storage type (bit vector, "state"). T should not be enum, if E is numeric.

Constructor & Destructor Documentation

◆ FlaggerBase()

template<typename E = std::size_t, typename T = E>
FlaggerBase ( storage_t &  v,
char  separator = ',' 
)
inlineprotected

Value-referencing constructor.

An external value will be used, leaving protected ownValue unused . Reconsider design. Should the value ever be referenced?

Member Function Documentation

◆ getDict()

template<typename E = std::size_t, typename T = E>
virtual const dict_t & getDict ( ) const
pure virtual

◆ isSet()

template<typename E = std::size_t, typename T = E>
virtual bool isSet ( const storage_t &  x) const
pure virtual

Checks if a given bit, or any of given bits, is set.

SingleFlagger: exact match MultiFlagger: bitwise OR > 0

Implemented in SingleFlagger< E >, and MultiFlagger< E, T >.

◆ str()

template<typename E = std::size_t, typename T = E>
virtual const key_t & str ( ) const
pure virtual

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