Fawkes API  Fawkes Development Version
config.h
1 
2 /***************************************************************************
3  * config.h - Fawkes configuration interface
4  *
5  * Created: Mon Dec 04 17:38:32 2006
6  * Copyright 2006 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef _CONFIG_CONFIG_H_
25 #define _CONFIG_CONFIG_H_
26 
27 #include <core/exception.h>
28 #include <utils/misc/string_compare.h>
29 
30 #include <list>
31 #include <map>
32 #include <string>
33 #include <vector>
34 
35 namespace fawkes {
36 
37 class ConfigurationChangeHandler;
38 
40 {
41 public:
42  ConfigurationException(const char *msg);
43  ConfigurationException(const char *prefix, const char *msg);
44 };
45 
47 {
48 public:
49  ConfigEntryNotFoundException(const char *path);
50 };
51 
53 {
54 public:
55  ConfigTypeMismatchException(const char *path, const char *actual, const char *requested);
56 };
57 
59 {
60 public:
61  CouldNotOpenConfigException(const char *format, ...);
62 };
63 
65 {
66 public:
67  virtual ~Configuration()
68  {
69  }
70 
72  {
73  public:
74  virtual ~ValueIterator()
75  {
76  }
77  virtual bool next() = 0;
78  virtual bool valid() const = 0;
79 
80  virtual const char *path() const = 0;
81  virtual const char *type() const = 0;
82 
83  virtual bool is_float() const = 0;
84  virtual bool is_uint() const = 0;
85  virtual bool is_int() const = 0;
86  virtual bool is_bool() const = 0;
87  virtual bool is_string() const = 0;
88  virtual bool is_list() const = 0;
89  virtual size_t get_list_size() const = 0;
90 
91  virtual float get_float() const = 0;
92  virtual unsigned int get_uint() const = 0;
93  virtual int get_int() const = 0;
94  virtual bool get_bool() const = 0;
95  virtual std::string get_string() const = 0;
96  virtual std::vector<float> get_floats() const = 0;
97  virtual std::vector<unsigned int> get_uints() const = 0;
98  virtual std::vector<int> get_ints() const = 0;
99  virtual std::vector<bool> get_bools() const = 0;
100  virtual std::vector<std::string> get_strings() const = 0;
101  virtual std::string get_as_string() const = 0;
102 
103  virtual std::string get_comment() const = 0;
104 
105  virtual bool is_default() const = 0;
106  };
107 
108  virtual void copy(Configuration *copyconf) = 0;
109 
112 
113  virtual void load(const char *file_path) = 0;
114 
115  virtual bool exists(const char *path) = 0;
116  virtual bool is_float(const char *path) = 0;
117  virtual bool is_uint(const char *path) = 0;
118  virtual bool is_int(const char *path) = 0;
119  virtual bool is_bool(const char *path) = 0;
120  virtual bool is_string(const char *path) = 0;
121  virtual bool is_list(const char *path) = 0;
122 
123  virtual bool is_default(const char *path) = 0;
124 
125  virtual float get_float(const char *path) = 0;
126  virtual unsigned int get_uint(const char *path) = 0;
127  virtual int get_int(const char *path) = 0;
128  virtual bool get_bool(const char *path) = 0;
129  virtual std::string get_string(const char *path) = 0;
130  virtual float get_float_or_default(const char *path, const float &default_val);
131  virtual unsigned int get_uint_or_default(const char *path, const unsigned int &default_val);
132  virtual int get_int_or_default(const char *path, const int &default_val);
133  virtual bool get_bool_or_default(const char *path, const bool &default_val);
134  virtual std::string get_string_or_default(const char *path, const std::string &default_val);
135  virtual std::vector<float> get_floats(const char *path) = 0;
136  virtual std::vector<unsigned int> get_uints(const char *path) = 0;
137  virtual std::vector<int> get_ints(const char *path) = 0;
138  virtual std::vector<bool> get_bools(const char *path) = 0;
139  virtual std::vector<std::string> get_strings(const char *path) = 0;
140  virtual std::vector<float> get_floats_or_defaults(const char * path,
141  const std::vector<float> &default_val);
142  virtual std::vector<unsigned int>
143  get_uints_or_defaults(const char *path, const std::vector<unsigned int> &default_val);
144  virtual std::vector<int> get_ints_or_defaults(const char * path,
145  const std::vector<int> &default_val);
146  virtual std::vector<bool> get_bools_or_defaults(const char * path,
147  const std::vector<bool> &default_val);
148  virtual std::vector<std::string>
149  get_strings_or_defaults(const char *path, const std::vector<std::string> &default_val);
150  virtual ValueIterator *get_value(const char *path) = 0;
151  virtual std::string get_type(const char *path) = 0;
152  virtual std::string get_comment(const char *path) = 0;
153  virtual std::string get_default_comment(const char *path) = 0;
154 
155  virtual void set_float(const char *path, float f) = 0;
156  virtual void set_uint(const char *path, unsigned int uint) = 0;
157  virtual void set_int(const char *path, int i) = 0;
158  virtual void set_bool(const char *path, bool b) = 0;
159  virtual void set_string(const char *path, std::string &s) = 0;
160  virtual void set_string(const char *path, const char *s) = 0;
161  virtual void set_floats(const char *path, std::vector<float> &f) = 0;
162  virtual void set_uints(const char *path, std::vector<unsigned int> &uint) = 0;
163  virtual void set_ints(const char *path, std::vector<int> &i) = 0;
164  virtual void set_bools(const char *path, std::vector<bool> &b) = 0;
165  virtual void set_strings(const char *path, std::vector<std::string> &s) = 0;
166  virtual void set_strings(const char *path, std::vector<const char *> &s) = 0;
167  virtual void set_comment(const char *path, const char *comment) = 0;
168  virtual void set_comment(const char *path, std::string &comment) = 0;
169 
170  virtual void erase(const char *path) = 0;
171 
172  virtual void set_default_float(const char *path, float f) = 0;
173  virtual void set_default_uint(const char *path, unsigned int uint) = 0;
174  virtual void set_default_int(const char *path, int i) = 0;
175  virtual void set_default_bool(const char *path, bool b) = 0;
176  virtual void set_default_string(const char *path, std::string &s) = 0;
177  virtual void set_default_string(const char *path, const char *s) = 0;
178 
179  virtual void set_default_comment(const char *path, const char *comment) = 0;
180  virtual void set_default_comment(const char *path, std::string &comment) = 0;
181 
182  virtual void erase_default(const char *path) = 0;
183 
184  virtual ValueIterator *iterator() = 0;
185 
186  virtual ValueIterator *search(const char *path) = 0;
187 
188  virtual void lock() = 0;
189  virtual bool try_lock() = 0;
190  virtual void unlock() = 0;
191 
192  virtual void try_dump() = 0;
193 
194  /// @cond CONVENIENCE_METHODS
195  virtual bool
196  exists(const std::string &path)
197  {
198  return exists(path.c_str());
199  }
200 
201  virtual bool
202  is_float(const std::string &path)
203  {
204  return is_float(path.c_str());
205  }
206  virtual bool
207  is_uint(const std::string &path)
208  {
209  return is_uint(path.c_str());
210  }
211  virtual bool
212  is_int(const std::string &path)
213  {
214  return is_int(path.c_str());
215  }
216  virtual bool
217  is_bool(const std::string &path)
218  {
219  return is_bool(path.c_str());
220  }
221  virtual bool
222  is_string(const std::string &path)
223  {
224  return is_string(path.c_str());
225  }
226  virtual bool
227  is_list(const std::string &path)
228  {
229  return is_list(path.c_str());
230  }
231 
232  virtual bool
233  is_default(const std::string &path)
234  {
235  return is_default(path.c_str());
236  }
237 
238  virtual float
239  get_float(const std::string &path)
240  {
241  return get_float(path.c_str());
242  }
243  virtual unsigned int
244  get_uint(const std::string &path)
245  {
246  return get_uint(path.c_str());
247  }
248  virtual int
249  get_int(const std::string &path)
250  {
251  return get_int(path.c_str());
252  }
253  virtual bool
254  get_bool(const std::string &path)
255  {
256  return get_bool(path.c_str());
257  }
258  virtual std::string
259  get_string(const std::string &path)
260  {
261  return get_string(path.c_str());
262  }
263  virtual std::vector<float>
264  get_floats(const std::string &path)
265  {
266  return get_floats(path.c_str());
267  }
268  virtual std::vector<unsigned int>
269  get_uints(const std::string &path)
270  {
271  return get_uints(path.c_str());
272  }
273  virtual std::vector<int>
274  get_ints(const std::string &path)
275  {
276  return get_ints(path.c_str());
277  }
278  virtual std::vector<bool>
279  get_bools(const std::string &path)
280  {
281  return get_bools(path.c_str());
282  }
283  virtual std::vector<std::string>
284  get_strings(const std::string &path)
285  {
286  return get_strings(path.c_str());
287  }
288  virtual ValueIterator *
289  get_value(const std::string &path)
290  {
291  return get_value(path.c_str());
292  }
293  virtual std::string
294  get_type(const std::string &path)
295  {
296  return get_type(path.c_str());
297  }
298  virtual std::string
299  get_comment(const std::string &path)
300  {
301  return get_comment(path.c_str());
302  }
303  virtual std::string
304  get_default_comment(const std::string &path)
305  {
306  return get_default_comment(path.c_str());
307  }
308 
309  virtual void
310  set_float(const std::string &path, float f)
311  {
312  set_float(path.c_str(), f);
313  }
314  virtual void
315  set_uint(const std::string &path, unsigned int uint)
316  {
317  set_uint(path.c_str(), uint);
318  }
319  virtual void
320  set_int(const std::string &path, int i)
321  {
322  set_int(path.c_str(), i);
323  }
324  virtual void
325  set_bool(const std::string &path, bool b)
326  {
327  set_bool(path.c_str(), b);
328  }
329  virtual void
330  set_string(const std::string &path, std::string &s)
331  {
332  set_string(path.c_str(), s);
333  }
334  virtual void
335  set_string(const std::string &path, const char *s)
336  {
337  set_string(path.c_str(), s);
338  }
339  virtual void
340  set_floats(const std::string &path, std::vector<float> &f)
341  {
342  set_floats(path.c_str(), f);
343  }
344  virtual void
345  set_uints(const std::string &path, std::vector<unsigned int> &uint)
346  {
347  set_uints(path.c_str(), uint);
348  }
349  virtual void
350  set_ints(const std::string &path, std::vector<int> &i)
351  {
352  set_ints(path.c_str(), i);
353  }
354  virtual void
355  set_bools(const std::string &path, std::vector<bool> &b)
356  {
357  set_bools(path.c_str(), b);
358  }
359  virtual void
360  set_strings(const std::string &path, std::vector<std::string> &s)
361  {
362  set_strings(path.c_str(), s);
363  }
364  virtual void
365  set_strings(const std::string &path, std::vector<const char *> &s)
366  {
367  set_strings(path.c_str(), s);
368  }
369  virtual void
370  set_comment(const std::string &path, const char *comment)
371  {
372  set_comment(path.c_str(), comment);
373  }
374  virtual void
375  set_comment(const std::string &path, std::string &comment)
376  {
377  set_comment(path.c_str(), comment);
378  }
379 
380  virtual void
381  erase(const std::string &path)
382  {
383  erase(path.c_str());
384  }
385 
386  virtual void
387  set_default_float(const std::string &path, float f)
388  {
389  set_default_float(path.c_str(), f);
390  }
391  virtual void
392  set_default_uint(const std::string &path, unsigned int uint)
393  {
394  set_default_uint(path.c_str(), uint);
395  }
396  virtual void
397  set_default_int(const std::string &path, int i)
398  {
399  set_default_int(path.c_str(), i);
400  }
401  virtual void
402  set_default_bool(const std::string &path, bool b)
403  {
404  set_default_bool(path.c_str(), b);
405  }
406  virtual void
407  set_default_string(const std::string &path, std::string &s)
408  {
409  set_default_string(path.c_str(), s);
410  }
411  virtual void
412  set_default_string(const std::string &path, const char *s)
413  {
414  set_default_string(path.c_str(), s);
415  }
416 
417  virtual void
418  set_default_comment(const std::string &path, const char *comment)
419  {
420  set_default_comment(path.c_str(), comment);
421  }
422  virtual void
423  set_default_comment(const std::string &path, std::string &comment)
424  {
425  set_default_comment(path.c_str(), comment);
426  }
427 
428  virtual void
429  erase_default(const std::string &path)
430  {
431  erase_default(path.c_str());
432  }
433 
434  virtual ValueIterator *
435  search(const std::string &path)
436  {
437  return search(path.c_str());
438  }
439  /// @endcond
440 
441 protected:
442  /** List that contains pointers to ConfigurationChangeHandler */
443  typedef std::list<ConfigurationChangeHandler *> ChangeHandlerList;
444 
445  /** Multimap string to config change handlers. */
446  typedef std::multimap<const char *, ConfigurationChangeHandler *, StringLess>
448 
449  /** Config change handler multimap range. */
450  typedef std::pair<ChangeHandlerMultimap::iterator, ChangeHandlerMultimap::iterator>
452 
453  /** Registered change handlers. */
455  /** Change handler range. */
457 
458  ChangeHandlerList *find_handlers(const char *path);
459  void notify_handlers(const char *path, bool comment_changed = false);
460 };
461 
462 } // end namespace fawkes
463 
464 #endif
fawkes::Configuration::get_ints
virtual std::vector< int > get_ints(const char *path)=0
Get list of values from configuration which is of type int.
fawkes::Configuration::ValueIterator::valid
virtual bool valid() const =0
Check if the current element is valid.
fawkes::Configuration::set_string
virtual void set_string(const char *path, std::string &s)=0
Set new value in configuration of type string.
fawkes::Configuration::get_type
virtual std::string get_type(const char *path)=0
Get type of value at given path.
fawkes::Configuration::is_default
virtual bool is_default(const char *path)=0
Check if a value was read from the default config.
fawkes::Configuration::ChangeHandlerList
std::list< ConfigurationChangeHandler * > ChangeHandlerList
List that contains pointers to ConfigurationChangeHandler.
Definition: config.h:443
fawkes::Configuration::_ch_range
ChangeHandlerMultimapRange _ch_range
Change handler range.
Definition: config.h:456
fawkes::Configuration::set_string
virtual void set_string(const char *path, const char *s)=0
Set new value in configuration of type string.
fawkes::Configuration::set_default_comment
virtual void set_default_comment(const char *path, const char *comment)=0
Set new default comment for existing default configuration value.
fawkes::Configuration::iterator
virtual ValueIterator * iterator()=0
Iterator for all values.
fawkes::Configuration::ValueIterator::get_bool
virtual bool get_bool() const =0
Get bool value.
fawkes::Configuration::lock
virtual void lock()=0
Lock the config.
fawkes::Configuration::ChangeHandlerMultimap
std::multimap< const char *, ConfigurationChangeHandler *, StringLess > ChangeHandlerMultimap
Multimap string to config change handlers.
Definition: config.h:447
fawkes::Configuration::ValueIterator::get_uints
virtual std::vector< unsigned int > get_uints() const =0
Get list of values from configuration which is of type unsigned int.
fawkes::Configuration::set_default_float
virtual void set_default_float(const char *path, float f)=0
Set new default value in configuration of type float.
fawkes::Configuration::get_float_or_default
virtual float get_float_or_default(const char *path, const float &default_val)
Get value from configuration which is of type float, or the given default if the path does not exist.
Definition: config.cpp:696
fawkes::Configuration::get_bools
virtual std::vector< bool > get_bools(const char *path)=0
Get list of values from configuration which is of type bool.
fawkes::Configuration::ValueIterator::is_string
virtual bool is_string() const =0
Check if current value is a string.
fawkes::Configuration::set_comment
virtual void set_comment(const char *path, std::string &comment)=0
Set new comment for existing value.
fawkes::Configuration::ValueIterator::get_as_string
virtual std::string get_as_string() const =0
Get value as string.
fawkes::Configuration::get_bool
virtual bool get_bool(const char *path)=0
Get value from configuration which is of type bool.
fawkes::Configuration::load
virtual void load(const char *file_path)=0
Load configuration.
fawkes::Configuration::set_default_int
virtual void set_default_int(const char *path, int i)=0
Set new default value in configuration of type int.
fawkes::Configuration::ValueIterator::get_string
virtual std::string get_string() const =0
Get string value.
fawkes::Configuration::_change_handlers
ChangeHandlerMultimap _change_handlers
Registered change handlers.
Definition: config.h:454
fawkes::ConfigurationChangeHandler
Interface for configuration change handling.
Definition: change_handler.h:32
fawkes::Configuration::is_bool
virtual bool is_bool(const char *path)=0
Check if a value is of type bool.
fawkes::Configuration::is_list
virtual bool is_list(const char *path)=0
Check if a value is a list.
fawkes::Configuration::set_floats
virtual void set_floats(const char *path, std::vector< float > &f)=0
Set new value in configuration of type float.
fawkes::Configuration::set_strings
virtual void set_strings(const char *path, std::vector< std::string > &s)=0
Set new value in configuration of type string.
fawkes::Configuration::erase_default
virtual void erase_default(const char *path)=0
Erase the given default value from the configuration.
fawkes::Configuration::ValueIterator::is_list
virtual bool is_list() const =0
Check if a value is a list.
fawkes::Configuration::find_handlers
ChangeHandlerList * find_handlers(const char *path)
Find handlers for given path.
Definition: config.cpp:651
fawkes::Configuration::get_uints
virtual std::vector< unsigned int > get_uints(const char *path)=0
Get list of values from configuration which is of type unsigned int.
fawkes::Configuration::ValueIterator::get_bools
virtual std::vector< bool > get_bools() const =0
Get list of values from configuration which is of type bool.
fawkes::Configuration::get_int
virtual int get_int(const char *path)=0
Get value from configuration which is of type int.
fawkes::Configuration::ChangeHandlerMultimapRange
std::pair< ChangeHandlerMultimap::iterator, ChangeHandlerMultimap::iterator > ChangeHandlerMultimapRange
Config change handler multimap range.
Definition: config.h:451
fawkes::Configuration::ValueIterator
Iterator interface to iterate over config values.
Definition: config.h:72
fawkes::Configuration
Interface for configuration handling.
Definition: config.h:65
fawkes::Configuration::search
virtual ValueIterator * search(const char *path)=0
Iterator with search results.
fawkes::ConfigEntryNotFoundException
Thrown if a config entry could not be found.
Definition: config.h:47
fawkes::ConfigTypeMismatchException::ConfigTypeMismatchException
ConfigTypeMismatchException(const char *path, const char *actual, const char *requested)
Constructor.
Definition: config.cpp:460
fawkes::Configuration::ValueIterator::is_bool
virtual bool is_bool() const =0
Check if current value is a bool.
fawkes::Configuration::set_int
virtual void set_int(const char *path, int i)=0
Set new value in configuration of type int.
fawkes::Configuration::set_default_bool
virtual void set_default_bool(const char *path, bool b)=0
Set new default value in configuration of type bool.
fawkes::Configuration::set_strings
virtual void set_strings(const char *path, std::vector< const char * > &s)=0
Set new value in configuration of type string.
fawkes::Configuration::ValueIterator::is_default
virtual bool is_default() const =0
Check if current value was read from the default config.
fawkes::Configuration::get_floats
virtual std::vector< float > get_floats(const char *path)=0
Get list of values from configuration which is of type float.
fawkes::ConfigEntryNotFoundException::ConfigEntryNotFoundException
ConfigEntryNotFoundException(const char *path)
Constructor.
Definition: config.cpp:445
fawkes::Configuration::set_float
virtual void set_float(const char *path, float f)=0
Set new value in configuration of type float.
fawkes::Configuration::get_bool_or_default
virtual bool get_bool_or_default(const char *path, const bool &default_val)
Get value from configuration which is of type bool, or the given default if the path does not exist.
Definition: config.cpp:726
fawkes::Configuration::set_bools
virtual void set_bools(const char *path, std::vector< bool > &b)=0
Set new value in configuration of type bool.
fawkes::Configuration::set_bool
virtual void set_bool(const char *path, bool b)=0
Set new value in configuration of type bool.
fawkes::Configuration::set_uints
virtual void set_uints(const char *path, std::vector< unsigned int > &uint)=0
Set new value in configuration of type unsigned int.
fawkes::Configuration::erase
virtual void erase(const char *path)=0
Erase the given value from the configuration.
fawkes
Fawkes library namespace.
fawkes::Configuration::ValueIterator::get_ints
virtual std::vector< int > get_ints() const =0
Get list of values from configuration which is of type int.
fawkes::Configuration::unlock
virtual void unlock()=0
Unlock the config.
fawkes::Configuration::ValueIterator::is_float
virtual bool is_float() const =0
Check if current value is a float.
fawkes::Configuration::is_uint
virtual bool is_uint(const char *path)=0
Check if a value is of type unsigned int.
fawkes::Configuration::get_strings
virtual std::vector< std::string > get_strings(const char *path)=0
Get list of values from configuration which is of type string.
fawkes::Configuration::~Configuration
virtual ~Configuration()
Virtual empty destructor.
Definition: config.h:67
fawkes::ConfigTypeMismatchException
Thrown if there a type problem was detected for example if you tried to query a float with get_int().
Definition: config.h:53
fawkes::Configuration::is_float
virtual bool is_float(const char *path)=0
Check if a value is of type float.
fawkes::Configuration::set_default_comment
virtual void set_default_comment(const char *path, std::string &comment)=0
Set new default comment for existing default configuration value.
fawkes::Configuration::ValueIterator::get_list_size
virtual size_t get_list_size() const =0
Get number of elements in list value.
fawkes::Configuration::set_default_uint
virtual void set_default_uint(const char *path, unsigned int uint)=0
Set new default value in configuration of type unsigned int.
fawkes::Configuration::rem_change_handler
virtual void rem_change_handler(ConfigurationChangeHandler *h)
Remove a configuration change handler.
Definition: config.cpp:619
fawkes::Configuration::get_uints_or_defaults
virtual std::vector< unsigned int > get_uints_or_defaults(const char *path, const std::vector< unsigned int > &default_val)
Get list of values from configuration which is of type unsigned int, or the given default if the path...
Definition: config.cpp:756
fawkes::Configuration::ValueIterator::is_int
virtual bool is_int() const =0
Check if current value is a int.
fawkes::Configuration::set_default_string
virtual void set_default_string(const char *path, std::string &s)=0
Set new default value in configuration of type string.
fawkes::Configuration::ValueIterator::~ValueIterator
virtual ~ValueIterator()
Virtual emptry destructor.
Definition: config.h:74
fawkes::Configuration::get_comment
virtual std::string get_comment(const char *path)=0
Get comment of value at given path.
fawkes::CouldNotOpenConfigException
Thrown if config could not be opened.
Definition: config.h:59
fawkes::Configuration::ValueIterator::get_comment
virtual std::string get_comment() const =0
Get comment of value.
fawkes::Configuration::get_strings_or_defaults
virtual std::vector< std::string > get_strings_or_defaults(const char *path, const std::vector< std::string > &default_val)
Get list of values from configuration which is of type string, or the given default if the path does ...
Definition: config.cpp:786
fawkes::Configuration::get_floats_or_defaults
virtual std::vector< float > get_floats_or_defaults(const char *path, const std::vector< float > &default_val)
Get list of values from configuration which is of type float, or the given default if the path does n...
Definition: config.cpp:746
fawkes::Configuration::set_comment
virtual void set_comment(const char *path, const char *comment)=0
Set new comment for existing value.
fawkes::Configuration::get_float
virtual float get_float(const char *path)=0
Get value from configuration which is of type float.
fawkes::Configuration::get_uint_or_default
virtual unsigned int get_uint_or_default(const char *path, const unsigned int &default_val)
Get value from configuration which is of type unsigned int, or the given default if the path does not...
Definition: config.cpp:706
fawkes::Configuration::copy
virtual void copy(Configuration *copyconf)=0
Copies all values from the given configuration.
fawkes::Configuration::ValueIterator::get_int
virtual int get_int() const =0
Get int value.
fawkes::Configuration::ValueIterator::type
virtual const char * type() const =0
Type of value.
fawkes::Configuration::get_uint
virtual unsigned int get_uint(const char *path)=0
Get value from configuration which is of type unsigned int.
fawkes::Configuration::set_default_string
virtual void set_default_string(const char *path, const char *s)=0
Set new default value in configuration of type string.
fawkes::Configuration::ValueIterator::get_floats
virtual std::vector< float > get_floats() const =0
Get list of values from configuration which is of type float.
fawkes::Configuration::try_lock
virtual bool try_lock()=0
Try to lock the config.
fawkes::Configuration::get_string
virtual std::string get_string(const char *path)=0
Get value from configuration which is of type string.
fawkes::Configuration::is_int
virtual bool is_int(const char *path)=0
Check if a value is of type int.
fawkes::Configuration::get_string_or_default
virtual std::string get_string_or_default(const char *path, const std::string &default_val)
Get value from configuration which is of type string, or the given default if the path does not exist...
Definition: config.cpp:736
fawkes::Configuration::get_int_or_default
virtual int get_int_or_default(const char *path, const int &default_val)
Get value from configuration which is of type int, or the given default if the path does not exist.
Definition: config.cpp:716
fawkes::ConfigurationException::ConfigurationException
ConfigurationException(const char *msg)
Constructor.
Definition: config.cpp:424
fawkes::Configuration::get_ints_or_defaults
virtual std::vector< int > get_ints_or_defaults(const char *path, const std::vector< int > &default_val)
Get list of values from configuration which is of type int, or the given default if the path does not...
Definition: config.cpp:766
fawkes::Configuration::try_dump
virtual void try_dump()=0
Try to dump configuration.
fawkes::Configuration::get_default_comment
virtual std::string get_default_comment(const char *path)=0
Get comment of value at given path.
fawkes::CouldNotOpenConfigException::CouldNotOpenConfigException
CouldNotOpenConfigException(const char *format,...)
Constructor.
Definition: config.cpp:476
fawkes::ConfigurationException
Generic configuration exception.
Definition: config.h:40
fawkes::Configuration::ValueIterator::get_strings
virtual std::vector< std::string > get_strings() const =0
Get list of values from configuration which is of type string.
fawkes::Configuration::get_bools_or_defaults
virtual std::vector< bool > get_bools_or_defaults(const char *path, const std::vector< bool > &default_val)
Get list of values from configuration which is of type bool, or the given default if the path does no...
Definition: config.cpp:776
fawkes::Configuration::exists
virtual bool exists(const char *path)=0
Check if a given value exists.
fawkes::Configuration::add_change_handler
virtual void add_change_handler(ConfigurationChangeHandler *h)
Add a configuration change handler.
Definition: config.cpp:603
fawkes::Configuration::notify_handlers
void notify_handlers(const char *path, bool comment_changed=false)
Notify handlers for given path.
Definition: config.cpp:674
fawkes::Configuration::ValueIterator::path
virtual const char * path() const =0
Path of value.
fawkes::Configuration::set_uint
virtual void set_uint(const char *path, unsigned int uint)=0
Set new value in configuration of type unsigned int.
fawkes::Configuration::set_ints
virtual void set_ints(const char *path, std::vector< int > &i)=0
Set new value in configuration of type int.
fawkes::Configuration::get_value
virtual ValueIterator * get_value(const char *path)=0
Get value from configuration.
fawkes::Configuration::ValueIterator::get_uint
virtual unsigned int get_uint() const =0
Get unsigned int value.
fawkes::Configuration::ValueIterator::next
virtual bool next()=0
Check if there is another element and advance to this if possible.
fawkes::Configuration::ValueIterator::is_uint
virtual bool is_uint() const =0
Check if current value is a unsigned int.
fawkes::Configuration::ValueIterator::get_float
virtual float get_float() const =0
Get float value.
fawkes::Configuration::is_string
virtual bool is_string(const char *path)=0
Check if a value is of type string.
fawkes::Exception
Base class for exceptions in Fawkes.
Definition: exception.h:36