34 #define TheBESKeys_h_ 1 84 std::ifstream * _keys_file;
85 std::string _keys_file_name;
86 std::map<std::string, std::vector<std::string> > *_the_keys;
89 static std::vector<std::string> KeyList;
90 static bool LoadedKeys(
const std::string &key_file);
93 void initialize_keys();
95 bool break_pair(
const char* b, std::string& key, std::string &value,
bool &addto);
96 bool only_blanks(
const char *line);
97 void load_include_files(
const std::string &files);
98 void load_include_file(
const std::string &file);
101 _keys_file(0), _keys_file_name(
""), _the_keys(0), _own_keys(
false)
105 TheBESKeys(
const std::string &keys_file_name, std::map<std::string, std::vector<std::string> > *keys);
108 TheBESKeys(
const std::string &keys_file_name);
114 std::string keys_file_name()
const 116 return _keys_file_name;
119 void set_key(
const std::string &key,
const std::string &val,
bool addto =
false);
120 void set_key(
const std::string &pair);
122 void get_value(
const std::string& s, std::string &val,
bool &found);
123 void get_values(
const std::string& s, std::vector<std::string> &vals,
bool &found);
125 bool read_bool_key(
const std::string &key,
bool default_value);
126 std::string
read_string_key(
const std::string &key,
const std::string &default_value);
127 int read_int_key(
const std::string &key,
int default_value);
129 typedef std::map<std::string, std::vector<std::string> >::const_iterator Keys_citer;
131 Keys_citer keys_begin()
133 return _the_keys->begin();
136 Keys_citer keys_end()
138 return _the_keys->end();
141 virtual void dump(std::ostream &strm)
const;
155 #endif // TheBESKeys_h_ mapping of key/value pairs defining different behaviors of an application.
std::string read_string_key(const std::string &key, const std::string &default_value)
Read a string-valued key from the bes.conf file.
int read_int_key(const std::string &key, int default_value)
Read an integer-valued key from the bes.conf file.
void get_value(const std::string &s, std::string &val, bool &found)
Retrieve the value of a given key, if set.
Base object for bes objects.
static TheBESKeys * TheKeys()
virtual ~TheBESKeys()
cleans up the key/value pair mapping
void get_values(const std::string &s, std::vector< std::string > &vals, bool &found)
Retrieve the values of a given key, if set.
bool read_bool_key(const std::string &key, bool default_value)
Read a boolean-valued key from the bes.conf file.
virtual void dump(std::ostream &strm) const
dumps information about this object
void set_key(const std::string &key, const std::string &val, bool addto=false)
allows the user to set key/value pairs from within the application.
static std::string ConfigFile