Fawkes API
Fawkes Development Version
|
#include <>>
Public Member Functions | |
MemoryConfiguration () | |
Constructor. More... | |
virtual | ~MemoryConfiguration () |
Destructor. More... | |
virtual void | copy (Configuration *copyconf) |
virtual void | load (const char *file_path) |
virtual bool | exists (const char *path) |
virtual bool | is_float (const char *path) |
virtual bool | is_uint (const char *path) |
virtual bool | is_int (const char *path) |
virtual bool | is_bool (const char *path) |
virtual bool | is_string (const char *path) |
virtual bool | is_list (const char *path) |
virtual bool | is_default (const char *path) |
virtual std::string | get_type (const char *path) |
virtual float | get_float (const char *path) |
virtual unsigned int | get_uint (const char *path) |
virtual int | get_int (const char *path) |
virtual bool | get_bool (const char *path) |
virtual std::string | get_string (const char *path) |
virtual std::vector< float > | get_floats (const char *path) |
virtual std::vector< unsigned int > | get_uints (const char *path) |
virtual std::vector< int > | get_ints (const char *path) |
virtual std::vector< bool > | get_bools (const char *path) |
virtual std::vector< std::string > | get_strings (const char *path) |
virtual ValueIterator * | get_value (const char *path) |
virtual std::string | get_comment (const char *path) |
virtual std::string | get_default_comment (const char *path) |
virtual void | set_float (const char *path, float f) |
virtual void | set_uint (const char *path, unsigned int uint) |
virtual void | set_int (const char *path, int i) |
virtual void | set_bool (const char *path, bool b) |
virtual void | set_string (const char *path, std::string &s) |
virtual void | set_string (const char *path, const char *s) |
virtual void | set_floats (const char *path, std::vector< float > &f) |
virtual void | set_uints (const char *path, std::vector< unsigned int > &uint) |
virtual void | set_ints (const char *path, std::vector< int > &i) |
virtual void | set_bools (const char *path, std::vector< bool > &b) |
virtual void | set_strings (const char *path, std::vector< std::string > &s) |
virtual void | set_strings (const char *path, std::vector< const char * > &s) |
virtual void | set_comment (const char *path, std::string &comment) |
virtual void | set_comment (const char *path, const char *comment) |
virtual void | erase (const char *path) |
virtual void | set_default_float (const char *path, float f) |
virtual void | set_default_uint (const char *path, unsigned int uint) |
virtual void | set_default_int (const char *path, int i) |
virtual void | set_default_bool (const char *path, bool b) |
virtual void | set_default_string (const char *path, std::string &s) |
virtual void | set_default_string (const char *path, const char *s) |
virtual void | set_default_comment (const char *path, const char *comment) |
virtual void | set_default_comment (const char *path, std::string &comment) |
virtual void | erase_default (const char *path) |
ValueIterator * | iterator () |
ValueIterator * | iterator_default () |
Get iterator over default values. More... | |
ValueIterator * | iterator_hostspecific () |
Get iterator over host-specific values. More... | |
ValueIterator * | search (const char *path) |
void | lock () |
Lock the config. More... | |
bool | try_lock () |
Try to lock the config. More... | |
void | unlock () |
Unlock the config. More... | |
virtual void | try_dump () |
![]() | |
virtual | ~Configuration () |
virtual void | add_change_handler (ConfigurationChangeHandler *h) |
Add a configuration change handler. More... | |
virtual void | rem_change_handler (ConfigurationChangeHandler *h) |
Remove a configuration change handler. More... | |
virtual float | get_float_or_default (const char *path, const float &default_val) |
virtual unsigned int | get_uint_or_default (const char *path, const unsigned int &default_val) |
virtual int | get_int_or_default (const char *path, const int &default_val) |
virtual bool | get_bool_or_default (const char *path, const bool &default_val) |
virtual std::string | get_string_or_default (const char *path, const std::string &default_val) |
virtual std::vector< float > | get_floats_or_defaults (const char *path, const std::vector< float > &default_val) |
virtual std::vector< unsigned int > | get_uints_or_defaults (const char *path, const std::vector< unsigned int > &default_val) |
virtual std::vector< int > | get_ints_or_defaults (const char *path, const std::vector< int > &default_val) |
virtual std::vector< bool > | get_bools_or_defaults (const char *path, const std::vector< bool > &default_val) |
virtual std::vector< std::string > | get_strings_or_defaults (const char *path, const std::vector< std::string > &default_val) |
Additional Inherited Members | |
![]() | |
typedef std::list< ConfigurationChangeHandler * > | ChangeHandlerList |
List that contains pointers to ConfigurationChangeHandler. More... | |
typedef std::multimap< const char *, ConfigurationChangeHandler *, StringLess > | ChangeHandlerMultimap |
Multimap string to config change handlers. More... | |
typedef std::pair< ChangeHandlerMultimap::iterator, ChangeHandlerMultimap::iterator > | ChangeHandlerMultimapRange |
Config change handler multimap range. More... | |
![]() | |
ChangeHandlerList * | find_handlers (const char *path) |
Find handlers for given path. More... | |
void | notify_handlers (const char *path, bool comment_changed=false) |
Notify handlers for given path. More... | |
![]() | |
ChangeHandlerMultimap | _change_handlers |
Registered change handlers. More... | |
ChangeHandlerMultimapRange | _ch_range |
Change handler range. More... | |
fawkes::MemoryConfiguration::MemoryConfiguration | ( | ) |
Constructor.
Definition at line 47 of file memory.cpp.
|
virtual |
Destructor.
Definition at line 54 of file memory.cpp.
|
virtual |
Copies all values from the given configuration. All values from the given configuration are copied. Old values are not erased so that the copied values will overwrite existing values, new values are created, but values existent in current config but not in the copied config will remain unchanged.
copyconf | configuration to copy |
Implements fawkes::Configuration.
Definition at line 65 of file memory.cpp.
|
virtual |
Erase the given value from the configuration. It is not an error if the value does not exists before deletion.
path | path to value |
Implements fawkes::Configuration.
Definition at line 382 of file memory.cpp.
|
virtual |
Erase the given default value from the configuration. It is not an error if the value does not exists before deletion.
path | path to value |
Implements fawkes::Configuration.
Definition at line 439 of file memory.cpp.
References fawkes::Mutex::lock().
|
virtual |
Check if a given value exists.
path | path to value |
Implements fawkes::Configuration.
Definition at line 71 of file memory.cpp.
|
virtual |
Get value from configuration which is of type bool
path | path to value |
Implements fawkes::Configuration.
Definition at line 153 of file memory.cpp.
Referenced by fawkes::NetworkConfiguration::get_bool().
|
virtual |
Get list of values from configuration which is of type bool
path | path to value |
Implements fawkes::Configuration.
Definition at line 183 of file memory.cpp.
|
virtual |
Get comment of value at given path. The value at the given path must exist in the host-specific configuration.
path | path to value |
ConfigEntryNotFoundException | shall be thrown if value does not exist |
ConfigurationException | shall be thrown on any other error |
Implements fawkes::Configuration.
Definition at line 93 of file memory.cpp.
Referenced by fawkes::NetworkConfiguration::get_comment().
|
virtual |
Get comment of value at given path. The value at the given path must exist in the default configuration.
path | path to value |
ConfigEntryNotFoundException | shall be thrown if value does not exist |
ConfigurationException | shall be thrown on any other error |
Implements fawkes::Configuration.
Definition at line 251 of file memory.cpp.
Referenced by fawkes::NetworkConfiguration::get_default_comment().
|
virtual |
Get value from configuration which is of type float
path | path to value |
Implements fawkes::Configuration.
Definition at line 135 of file memory.cpp.
Referenced by fawkes::NetworkConfiguration::get_float().
|
virtual |
Get list of values from configuration which is of type float
path | path to value |
Implements fawkes::Configuration.
Definition at line 165 of file memory.cpp.
|
virtual |
Get value from configuration which is of type int
path | path to value |
Implements fawkes::Configuration.
Definition at line 147 of file memory.cpp.
Referenced by fawkes::NetworkConfiguration::get_int().
|
virtual |
Get list of values from configuration which is of type int
path | path to value |
Implements fawkes::Configuration.
Definition at line 177 of file memory.cpp.
|
virtual |
Get value from configuration which is of type string
path | path to value |
Implements fawkes::Configuration.
Definition at line 159 of file memory.cpp.
Referenced by fawkes::NetworkConfiguration::get_string().
|
virtual |
Get list of values from configuration which is of type string
path | path to value |
Implements fawkes::Configuration.
Definition at line 189 of file memory.cpp.
|
virtual |
Get type of value at given path.
path | path to value |
ConfigurationException | shall be thrown if value does not exist or on any other error. |
Implements fawkes::Configuration.
Definition at line 82 of file memory.cpp.
Referenced by fawkes::NetworkConfiguration::get_type().
|
virtual |
Get value from configuration which is of type unsigned int
path | path to value |
Implements fawkes::Configuration.
Definition at line 141 of file memory.cpp.
Referenced by fawkes::NetworkConfiguration::get_uint().
|
virtual |
Get list of values from configuration which is of type unsigned int
path | path to value |
Implements fawkes::Configuration.
Definition at line 171 of file memory.cpp.
|
virtual |
Get value from configuration.
path | path to value |
Implements fawkes::Configuration.
Definition at line 273 of file memory.cpp.
Referenced by fawkes::NetworkConfiguration::get_value().
|
virtual |
Check if a value is of type bool
path | path to value |
Implements fawkes::Configuration.
Definition at line 229 of file memory.cpp.
|
virtual |
Check if a value was read from the default config.
path | path to value |
Implements fawkes::Configuration.
Definition at line 257 of file memory.cpp.
|
virtual |
Check if a value is of type float
path | path to value |
Implements fawkes::Configuration.
Definition at line 211 of file memory.cpp.
|
virtual |
Check if a value is of type int
path | path to value |
Implements fawkes::Configuration.
Definition at line 223 of file memory.cpp.
|
virtual |
Check if a value is a list.
path | path to value |
Implements fawkes::Configuration.
Definition at line 241 of file memory.cpp.
|
virtual |
Check if a value is of type string
path | path to value |
Implements fawkes::Configuration.
Definition at line 235 of file memory.cpp.
|
virtual |
Check if a value is of type unsigned int
path | path to value |
Implements fawkes::Configuration.
Definition at line 217 of file memory.cpp.
|
virtual |
Iterator for all values. Returns an iterator that can be used to iterate over all values in the current configuration, it will value the overlay. If a default and a host-specific value exists you will only see the host-specific value.
Implements fawkes::Configuration.
Definition at line 479 of file memory.cpp.
Referenced by fawkes::NetworkConfiguration::iterator().
Configuration::ValueIterator * fawkes::MemoryConfiguration::iterator_default | ( | ) |
Get iterator over default values.
Definition at line 490 of file memory.cpp.
Referenced by fawkes::NetworkConfiguration::iterator_default().
Configuration::ValueIterator * fawkes::MemoryConfiguration::iterator_hostspecific | ( | ) |
Get iterator over host-specific values.
Definition at line 512 of file memory.cpp.
Referenced by fawkes::NetworkConfiguration::iterator_hostspecific().
|
virtual |
Load configuration. Loads configuration data, or opens a file, depending on the implementation. After this call access to all other methods shall be possible.
file_path | path of the configuration file. |
Implements fawkes::Configuration.
Definition at line 60 of file memory.cpp.
|
virtual |
Lock the config.
No further changes or queries can be executed on the configuration and will block until the config is unlocked.
Implements fawkes::Configuration.
Definition at line 449 of file memory.cpp.
References fawkes::Mutex::try_lock().
|
virtual |
Iterator with search results. Returns an iterator that can be used to iterate over the search results. All values whose path start with the given strings are returned. A call like
is effectively the same as a call to iterator().
path | start of path |
Implements fawkes::Configuration.
Definition at line 531 of file memory.cpp.
Referenced by fawkes::NetworkConfiguration::search().
|
virtual |
Set new value in configuration of type bool
path | path to value |
b | new bool value |
Implements fawkes::Configuration.
Definition at line 310 of file memory.cpp.
|
virtual |
Set new value in configuration of type bool
path | path to value |
b | new bool values |
Implements fawkes::Configuration.
Definition at line 351 of file memory.cpp.
|
virtual |
Set new comment for existing value. Works like the aforementioned method. Just takes an good ol' char array instead of a std::string.
path | path to value |
comment | new comment string |
Implements fawkes::Configuration.
Definition at line 372 of file memory.cpp.
|
virtual |
Set new comment for existing value.
path | path to value |
comment | new comment string |
Implements fawkes::Configuration.
Definition at line 377 of file memory.cpp.
|
virtual |
Set new default value in configuration of type bool
path | path to value |
b | new bool value |
Implements fawkes::Configuration.
Definition at line 409 of file memory.cpp.
|
virtual |
Set new default comment for existing default configuration value. Works like the aforementioned method. Just takes an good ol' char array instead of a std::string.
path | path to value |
comment | new comment string |
Implements fawkes::Configuration.
Definition at line 429 of file memory.cpp.
|
virtual |
Set new default comment for existing default configuration value.
path | path to value |
comment | new comment string |
Implements fawkes::Configuration.
Definition at line 434 of file memory.cpp.
|
virtual |
Set new default value in configuration of type float
path | path to value |
f | new float value |
Implements fawkes::Configuration.
Definition at line 388 of file memory.cpp.
|
virtual |
Set new default value in configuration of type int
path | path to value |
i | new int value |
Implements fawkes::Configuration.
Definition at line 402 of file memory.cpp.
|
virtual |
Set new default value in configuration of type string. Works like the aforementioned method. Just takes an good ol' char array instead of a std::string.
path | path to value |
s | new string value |
Implements fawkes::Configuration.
Definition at line 416 of file memory.cpp.
References set_default_string().
|
virtual |
Set new default value in configuration of type string
path | path to value |
s | new string value |
Implements fawkes::Configuration.
Definition at line 423 of file memory.cpp.
Referenced by set_default_string().
|
virtual |
Set new default value in configuration of type unsigned int
path | path to value |
uint | new unsigned int value |
Implements fawkes::Configuration.
Definition at line 395 of file memory.cpp.
|
virtual |
Set new value in configuration of type float
path | path to value |
f | new float value |
Implements fawkes::Configuration.
Definition at line 289 of file memory.cpp.
|
virtual |
Set new value in configuration of type float
path | path to value |
f | new float values |
Implements fawkes::Configuration.
Definition at line 330 of file memory.cpp.
|
virtual |
Set new value in configuration of type int
path | path to value |
i | new int value |
Implements fawkes::Configuration.
Definition at line 303 of file memory.cpp.
|
virtual |
Set new value in configuration of type int
path | path to value |
i | new int values |
Implements fawkes::Configuration.
Definition at line 344 of file memory.cpp.
|
virtual |
Set new value in configuration of type string. Works like the aforementioned method. Just takes an good ol' char array instead of a std::string.
path | path to value |
s | new string value |
Implements fawkes::Configuration.
Definition at line 317 of file memory.cpp.
References set_string().
|
virtual |
Set new value in configuration of type string
path | path to value |
s | new string value |
Implements fawkes::Configuration.
Definition at line 324 of file memory.cpp.
Referenced by set_string().
|
virtual |
Set new value in configuration of type string. Works like the aforementioned method. Just takes an good ol' char array instead of a std::string.
path | path to value |
s | new string values |
Implements fawkes::Configuration.
Definition at line 365 of file memory.cpp.
|
virtual |
Set new value in configuration of type string
path | path to value |
s | new string values |
Implements fawkes::Configuration.
Definition at line 358 of file memory.cpp.
|
virtual |
Set new value in configuration of type unsigned int
path | path to value |
uint | new unsigned int value |
Implements fawkes::Configuration.
Definition at line 296 of file memory.cpp.
|
virtual |
Set new value in configuration of type unsigned int
path | path to value |
uint | new unsigned int values |
Implements fawkes::Configuration.
Definition at line 337 of file memory.cpp.
|
virtual |
Try to dump configuration. For configuration methods that transform configuration files in a binary format this can be used to write out the text representation on shutdown of Fawkes.
Exception | thrown if dumping fails |
Implements fawkes::Configuration.
Definition at line 474 of file memory.cpp.
|
virtual |
Try to lock the config.
Implements fawkes::Configuration.
Definition at line 459 of file memory.cpp.
References fawkes::Mutex::unlock().
|
virtual |
Unlock the config.
Modifications and queries are possible again.
Implements fawkes::Configuration.
Definition at line 468 of file memory.cpp.