Public Member Functions | Protected Attributes | List of all members
Flags Class Reference

Self-contained Flagger – with an own dictionary and value. More...

#include <FlagsOld.h>

Inheritance diagram for Flags:
Inheritance graph
[legend]
Collaboration diagram for Flags:
Collaboration graph
[legend]

Public Member Functions

virtual const dict_tgetDict () const
 
virtual dict_tgetDict ()
 
 Flags (char separator=',')
 
 Flags (const Flags &flags)
 
 Flags (std::initializer_list< dict_t::entry_t > d, char separator=',')
 Initialize with {{"first", 123}, {"second", 456}}.
 
template<class T >
Flagsoperator= (const T &x)
 Sets value, ie. set or unsets all the flags.
 
ivalue_t addEntry (const dict_t::key_t &key, ivalue_t i=0)
 Add a new entry in the dictionary. More...
 
- Public Member Functions inherited from Flagger
 Flagger (const dict_t &dict, char separator=0)
 
 Flagger (ivalue_t &value, const dict_t &dict, char separator=0)
 
 Flagger (const Flagger &flags)
 
template<typename T , typename ... TT>
Flaggerset (const T &arg, const TT &... args)
 Set desired flags. Does not reset any flag (zero value has no effect). More...
 
Flaggerunset (ivalue_t x)
 Unset desired flags. Does not set any flag.
 
Flaggerunset (const key_t &key)
 Unset desired flags. Does not set any flag.
 
Flaggerreset ()
 Reset all the flags.
 
bool isSet (ivalue_t x) const
 Checks if a given bit, or any of given bits, is set.
 
bool isSet (const key_t &key) const
 
Flaggeroperator= (const Flagger &x)
 
template<class T >
Flaggeroperator= (const T &x)
 Sets value, ie. set or unsets all the flags. More...
 
void assign (ivalue_t x)
 Sets value, ie. set or unsets all the flags. More...
 
void assign (const Flagger &flags)
 Copies flags as an integer value. Same dictionary not checked. More...
 
void assign (const std::string &params)
 Set flags, like 'FILEOK=1,WARN=0'. More...
 
 operator ivalue_t () const
 
 operator bool () const
 
 operator std::string () const
 
ivalue_t getValue (const std::string &key, char separator=0) const
 Computes bitwise OR function on the numeric or alphabetic value(s) presented by a string. More...
 
std::string getKeys (ivalue_t value, char separator=0) const
 Given an integer, retrieves dictionary keys corresponding to each index of set bits.
 
std::string getKeys (char separator=0) const
 Given an integer, retrieves dictionary keys corresponding to each index of set bits.
 
const dict_t::keylist_t & keys () const
 
std::ostream & keysToStream (std::ostream &ostr=std::cout, char separator=0) const
 Display current value as key values of which the value is composed with OR function. More...
 
template<class T >
void exportStatus (std::map< std::string, T > &statusMap) const
 
- Public Member Functions inherited from FlagResolver
template<typename T >
FlagResolver::ivalue_t addEntry (drain::Dictionary< key_t, T > &dict, const typename dict_t::key_t &key, ivalue_t i)
 

Protected Attributes

dict_t ownDictionary
 
- Protected Attributes inherited from Flagger
dict_t::keylist_t keyList
 

Additional Inherited Members

- Public Types inherited from FlagResolver
typedef std::string key_t
 
typedef unsigned long int ivalue_t
 
typedef drain::Dictionary< key_t, ivalue_t > dict_t
 "Recommended" dictionary type. All the methods are templates, however.
 
- Static Public Member Functions inherited from FlagResolver
template<typename T >
static ivalue_t getValue (const drain::Dictionary< key_t, T > &dict, const std::string &key, char separator=',')
 Computes bitwise OR function on the numeric or alphabetic value(s) presented by a string. More...
 
template<typename T >
static std::string getKeys (const drain::Dictionary< key_t, T > &dict, ivalue_t, char separator=',')
 Given an integer, retrieves dictionary keys corresponding to each index of set bits. More...
 
template<typename T >
static std::ostream & keysToStream (const drain::Dictionary< key_t, T > &dict, ivalue_t value, std::ostream &ostr, char separator=',')
 Write keys in a stream, in numeric order. More...
 
template<typename T , typename V >
static void valuesToList (ivalue_t value, const drain::Dictionary< key_t, T > &dict, std::list< V > &container)
 Given a bit vector (integer value), extracts separate flag values to a list. More...
 
template<typename T >
static ivalue_t addEntry (drain::Dictionary< key_t, T > &dict, const key_t &key, ivalue_t i=0)
 Add a new entry in the dictionary. More...
 
template<typename T >
static ivalue_t getFreeBit (const drain::Dictionary< key_t, T > &dict)
 Return an interger (bit vector) with a new, previously unused value. More...
 
- Public Attributes inherited from Flagger
ivalue_t ownValue
 
ivalue_t & value
 
const dict_tdictionary
 
char separator
 
- Static Public Attributes inherited from Flagger
static const drain::SprinterLayout flagDictLayout
 
- Static Public Attributes inherited from FlagResolver
static const ivalue_t ALL = ~FlagResolver::ivalue_t(0)
 
- Protected Member Functions inherited from Flagger
Flaggerset ()
 
FlaggerdeepSet (ivalue_t x)
 
FlaggerdeepSet (const key_t &key)
 Set desired flags. Does not reset any flag. More...
 

Detailed Description

Self-contained Flagger – with an own dictionary and value.

Member Function Documentation

◆ addEntry()

ivalue_t addEntry ( const dict_t::key_t &  key,
ivalue_t  i = 0 
)
inline

Add a new entry in the dictionary.

Parameters
i- if zero, call getFreeBit() to reserve a new, unused bit.

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