Public Types | Public Member Functions | Public Attributes | List of all members
FlaggerBase< E > Class Template Referenceabstract

#include <Flags.h>

Public Types

typedef E value_t
 
typedef FlagResolver::dict_t dict_t
 
typedef dict_t::key_t key_t
 
typedef dict_t::value_t dict_value_t
 

Public Member Functions

 FlaggerBase (dict_value_t &v)
 Own value will be unused (and invisible). More...
 
virtual const dict_tgetDict () const =0
 
void reset ()
 
virtual void set (const key_t &key)
 
virtual void set (const dict_value_t &value)
 
virtual void set (const FlaggerBase< E > &flagger)
 
virtual void assign (const std::string &s)=0
 
bool isSet (dict_value_t x) const
 Checks if a given bit, or any of given bits, is set.
 
bool isSet (const key_t &key) const
 
const dict_value_t & getValue () const
 
 operator const dict_value_t & () const
 Given an integer, retrieves dictionary keys corresponding to each index of set bits.
 
 operator dict_value_t & ()
 
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

dict_value_t & value
 
char separator
 

Detailed Description

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

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}};

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}};
Definition: Flags.h:518
Template Parameters
E- enum or integer
D- dictionary, possibly const

Constructor & Destructor Documentation

◆ FlaggerBase()

FlaggerBase ( dict_value_t &  v)
inline

Own value will be unused (and invisible).

Reconsider design. Should the value ever be referenced?


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