Orxonox
0.0.5 Codename: Arcturus
|
Definition of macros and functions for config-values. More...
Go to the source code of this file.
Namespaces | |
orxonox | |
Die Wagnis Klasse hat die folgenden Aufgaben: | |
Macros | |
#define | ModifyConfigValue(varname, modifier, ...) ModifyConfigValueGeneric(this, &varname, #varname, modifier, __VA_ARGS__) |
Modifies a runtime configurable value by using a modifier and some arguments. More... | |
#define | ModifyConfigValueExternal(variable, entryName, modifier, ...) ModifyConfigValueGeneric(this, &variable, entryName, modifier, __VA_ARGS__) |
Modifies a runtime configurable value by using a modifier and some arguments. More... | |
#define | ModifyConfigValueGeneric(object, variable, entryName, modifier, ...) |
Modifies a runtime configurable value by using a modifier and some arguments. More... | |
#define | ResetConfigValue(varname) orxonox::resetConfigValueGeneric(this, &varname, #varname) |
Resets a runtime configurable value to its default (simplified macro version of modifyConfigValueGeneric) If the container for the value doesn't yet exist, a warning is displayed. More... | |
#define | SetConfigValue(varname, defaultValue) orxonox::setConfigValueGeneric(this, &varname, ConfigFileType::Settings, this->getIdentifier()->getName(), #varname, defaultValue) |
Sets a runtime configurable value (simplified macro version of setConfigValueGeneric) If the container for the value doesn't yet exist, a new one is created. More... | |
#define | SetConfigValueAlias(variable, entryName, defaultValue) orxonox::setConfigValueGeneric(this, &variable, ConfigFileType::Settings, this->getIdentifier()->getName(), entryName, defaultValue) |
Sets a runtime configurable value (simplified macro version of setConfigValueGeneric) If the container for the value doesn't yet exist, a new one is created. More... | |
#define | SetConfigValueExternal(variable, sectionName, entryName, defaultValue) orxonox::setConfigValueGeneric(this, &variable, ConfigFileType::Settings, sectionName, entryName, defaultValue) |
Sets a runtime configurable value (simplified macro version of setConfigValueGeneric) If the container for the value doesn't yet exist, a new one is created. More... | |
Functions | |
template<class T , class V > | |
void | orxonox::resetConfigValueGeneric (T *object, V *variable, const std::string &entryName) |
Resets a runtime configurable value to its default. More... | |
template<class T , class D , class V > | |
ConfigValueContainer & | orxonox::setConfigValueGeneric (T *object, V *variable, ConfigFileType::Value type, const std::string §ionName, const std::string &entryName, const D &defaultValue) |
Sets a runtime configurable value. More... | |
Definition of macros and functions for config-values.
An example of how to use SetConfigValue():
Definition of a class in the header-file:
Implementation of the class source-file:
Extract of orxonox.ini:
Some other code:
Output:
#define ModifyConfigValue | ( | varname, | |
modifier, | |||
... | |||
) | ModifyConfigValueGeneric(this, &varname, #varname, modifier, __VA_ARGS__) |
Modifies a runtime configurable value by using a modifier and some arguments.
If the container for the value doesn't yet exist, a warning is displayed. Also, the varname argument will be modified and set to the current value.
varname | Variable name as C++ identifier. It will be used as entry name and as variable pointer |
modifier | On of these functions: set, tset, add, remove, reset, update |
... | Arguments for the modifier function |
#define ModifyConfigValueExternal | ( | variable, | |
entryName, | |||
modifier, | |||
... | |||
) | ModifyConfigValueGeneric(this, &variable, entryName, modifier, __VA_ARGS__) |
Modifies a runtime configurable value by using a modifier and some arguments.
If the container for the value doesn't yet exist, a warning is displayed. Also, the variable argument will be modified and set to the current value.
variable | Pointer to the variable where the value should be written to |
entryName | Name of the entry in the ini file (e.g. [MySection] myValue) |
modifier | On of these functions: set, tset, add, remove, reset, update |
... | Arguments for the modifier function |
#define ModifyConfigValueGeneric | ( | object, | |
variable, | |||
entryName, | |||
modifier, | |||
... | |||
) |
Modifies a runtime configurable value by using a modifier and some arguments.
If the container for the value doesn't yet exist, a warning is displayed. Also, the variable argument will be modified and set to the current value.
object | Class instance that the config value should belong to (usually just 'this') |
variable | Pointer to the variable where the value should be written to |
entryName | Name of the entry in the ini file (e.g. [MySection] myValue) |
modifier | On of these functions: set, tset, add, remove, reset, update |
... | Arguments for the modifier function |
#define ResetConfigValue | ( | varname | ) | orxonox::resetConfigValueGeneric(this, &varname, #varname) |
Resets a runtime configurable value to its default (simplified macro version of modifyConfigValueGeneric) If the container for the value doesn't yet exist, a warning is displayed.
Also, the varname argument will be modified and set to the default value.
varname | Variable name as C++ identifier. It will be used as entry name and as variable pointer |
#define SetConfigValue | ( | varname, | |
defaultValue | |||
) | orxonox::setConfigValueGeneric(this, &varname, ConfigFileType::Settings, this->getIdentifier()->getName(), #varname, defaultValue) |
Sets a runtime configurable value (simplified macro version of setConfigValueGeneric) If the container for the value doesn't yet exist, a new one is created.
Also, the varname argument will be modified and set to the new value (default or from ini file).
varname | Variable name as C++ identifier. It will be used as entry name and as variable pointer |
defaultValue | Value to be used if it cannot be read from the ini file |
#define SetConfigValueAlias | ( | variable, | |
entryName, | |||
defaultValue | |||
) | orxonox::setConfigValueGeneric(this, &variable, ConfigFileType::Settings, this->getIdentifier()->getName(), entryName, defaultValue) |
Sets a runtime configurable value (simplified macro version of setConfigValueGeneric) If the container for the value doesn't yet exist, a new one is created.
Also, the varname argument will be modified and set to the new value (default or from ini file).
variable | Variable name as C++ identifier. |
entryName | Name of the entry in the ini file (e.g. [MySection] myValue) |
defaultValue | Value to be used if it cannot be read from the ini file |
#define SetConfigValueExternal | ( | variable, | |
sectionName, | |||
entryName, | |||
defaultValue | |||
) | orxonox::setConfigValueGeneric(this, &variable, ConfigFileType::Settings, sectionName, entryName, defaultValue) |
Sets a runtime configurable value (simplified macro version of setConfigValueGeneric) If the container for the value doesn't yet exist, a new one is created.
Also, the varname argument will be modified and set to the new value (default or from ini file).
variable | Variable name as C++ identifier. |
sectionName | Name of the section in the ini file (e.g. [MySection]) |
entryName | Name of the entry in the ini file (e.g. [MySection] myValue) |
defaultValue | Value to be used if it cannot be read from the ini file |