charon-core
0.3.1
|
Implementation of the AbstractParameter interface for one single parameter. More...
#include <charon-core/Parameter.h>
Public Member Functions | |
Parameter (T defaultValue=T()) | |
Create parameter. More... | |
virtual std::string | getDefaultString () |
Get default value. More... | |
virtual std::string | guessType () const |
Try to guess type. More... | |
virtual void | intoStream (std::ostream &os) const |
Inserts the value of the Parameter at the end of a stream. More... | |
virtual void | load (const ParameterFile &pf) |
Load from ParameterFile. More... | |
virtual | operator T () const |
Cast operator to get internal value. | |
virtual const T & | operator() () const |
Call operator. More... | |
virtual T & | operator() () |
Call operator. More... | |
virtual T & | operator= (const T &B) |
Assignment operator for internal value. More... | |
virtual Parameter< T > & | operator= (const Parameter< T > &B) |
Assign new current and default value. More... | |
virtual void | save (ParameterFile &pf) const |
Save to ParameterFile. More... | |
void | setDefault (const T &value) |
Set default value. More... | |
Public Member Functions inherited from AbstractParameter | |
std::string | getName () const |
Get parameter name. | |
ParameteredObject & | getParent () |
get parent object | |
const ParameteredObject & | getParent () const |
get parent object (const version) | |
void | init (ParameteredObject *parent, const std::string &name) |
Initialize new parameter. More... | |
Private Attributes | |
T | _defaultValue |
default value | |
T | _value |
current value | |
Additional Inherited Members | |
Protected Member Functions inherited from AbstractParameter | |
std::string | _followLink (const ParameterFile &pf, const std::string paramName) const |
Follow reference to targeted parameter. More... | |
Protected Attributes inherited from AbstractParameter | |
std::string | _name |
Parameter name. | |
ParameteredObject * | _parent |
Parent ParameteredObject. | |
Definition at line 153 of file Parameter.h.
_defaultValue and _value are set to the given defaultValue.
defaultValue | New default and current value. |
Definition at line 45 of file Parameter.hxx.
|
virtual |
This string representation will be saved in the metadata parameter file.
Implements AbstractParameter.
Definition at line 118 of file Parameter.hxx.
|
virtual |
Implements AbstractParameter.
Definition at line 78 of file Parameter.hxx.
References TypeDetector::type().
|
virtual |
os | Stream ot insert the value in |
Implements AbstractParameter.
Definition at line 125 of file Parameter.hxx.
|
virtual |
This restores the value from the paremeter named "name"."_name" in the given parameter file.
pf | ParameterFile to load from. |
Implements AbstractParameter.
Definition at line 109 of file Parameter.hxx.
References ParameterFile::get(), and ParameterFile::isSet().
|
virtual |
Implements AbstractROData< T >.
Definition at line 83 of file Parameter.hxx.
|
virtual |
Non const version
Implements AbstractData< T >.
Definition at line 88 of file Parameter.hxx.
|
virtual |
This modifies only the current value.
B | Value to assign. |
Implements AbstractData< T >.
Definition at line 55 of file Parameter.hxx.
by copying an existing parameter (which has not to be assigned to some object)
B | Copy source |
Definition at line 66 of file Parameter.hxx.
References Parameter< T >::_defaultValue, and Parameter< T >::_value.
|
virtual |
This stores the value to the paremeter name parent_name._name in the given parameter file. If the parameter has not been changed (i.e. has the same value as its default value), the parameter string will not be written to the parameter file.
pf | ParameterFile to write to. |
Implements AbstractParameter.
Definition at line 93 of file Parameter.hxx.
References ParameterFile::erase(), ParameterFile::get(), ParameterFile::isSet(), and ParameterFile::set().
void Parameter< T >::setDefault | ( | const T & | value | ) |
value | New default value |
Definition at line 61 of file Parameter.hxx.