13 inline std::ostream& operator<<(std::ostream& os,
const ConfigFlags& cf) ;
17 friend std::ostream& operator<<(std::ostream& os,
const ConfigFlags& flags) ;
19 typedef std::pair<std::string, bool> Flag ;
20 typedef std::map< unsigned, Flag > Map ;
34 void registerOption(
unsigned key,
const std::string& name,
bool defaultValue=
false ){
36 _map[ key ] = std::make_pair( name , defaultValue ) ;
39 bool option(
unsigned key)
const {
41 Map::const_iterator it = _map.find( key ) ;
43 if( it == _map.end() )
46 return it->second.second ;
49 bool operator[](
unsigned key)
const {
50 return option( key ) ;
53 void setOption(
unsigned key ,
bool val) {
55 Map::iterator it = _map.find( key ) ;
58 it->second.second = val ;
62 std::string& optionName(
unsigned key) {
64 static std::string empty(
"UNKNOWN") ;
66 Map::iterator it = _map.find( key ) ;
68 if( it == _map.end() )
71 return it->second.first ;
82 for( ConfigFlags::Map::const_iterator it = cf._map.begin(); it != cf._map.end() ; ++it){
84 os <<
" option: " << it->second.first <<
"\t: " << it->second.second << std::endl ;
ConfigFlags()
Helper class that holds a number of boolean properties for configuration.
Definition: ConfigFlags.h:29
Definition: ConfigFlags.h:15