charon-core  0.3.1
AbstractParameter Class Referenceabstract

Parameter object handling. More...

#include <charon-core/Parameter.h>

Inheritance diagram for AbstractParameter:

Public Member Functions

virtual std::string getDefaultString ()=0
 Get default value. More...
 
std::string getName () const
 Get parameter name.
 
ParameteredObjectgetParent ()
 get parent object
 
const ParameteredObjectgetParent () const
 get parent object (const version)
 
virtual std::string guessType () const =0
 Try to guess type. More...
 
void init (ParameteredObject *parent, const std::string &name)
 Initialize new parameter. More...
 
virtual void intoStream (std::ostream &os) const =0
 Inserts the value of the Parameter at the end of a stream. More...
 
virtual void load (const ParameterFile &pf)=0
 Load from ParameterFile. More...
 
virtual void save (ParameterFile &pf) const =0
 Save to ParameterFile. More...
 

Protected Member Functions

std::string _followLink (const ParameterFile &pf, const std::string paramName) const
 Follow reference to targeted parameter. More...
 

Protected Attributes

std::string _name
 Parameter name.
 
ParameteredObject_parent
 Parent ParameteredObject.
 

Private Member Functions

charon_core_LOCAL AbstractParameter (const AbstractParameter &)
 Forbid copying.
 

Detailed Description

Provides assignment and setters/getters. Load and save routines are purely virtual.

Definition at line 57 of file Parameter.h.

Member Function Documentation

std::string AbstractParameter::_followLink ( const ParameterFile pf,
const std::string  paramName 
) const
protected

Tries to get the name of the targeted parameter if a reference is present. Returns input if no reference exists.

Parameters
pfParameterFile to be used
paramNameName of the parameter that could contain a reference and should therefore be resolved
Returns
Name of the targeted parameter if there is a reference otherwise paramName unchanged

Definition at line 66 of file Parameter.cpp.

References ParameterFile::get(), and ParameterFile::isSet().

virtual std::string AbstractParameter::getDefaultString ( )
pure virtual

This string representation will be saved in the metadata parameter file.

Returns
default value string

Implemented in ParameterList< T >, ParameterList< std::string >, Parameter< T >, Parameter< std::string >, Parameter< int >, and Parameter< bool >.

virtual std::string AbstractParameter::guessType ( ) const
pure virtual
void AbstractParameter::init ( ParameteredObject parent,
const std::string &  name 
)

Assign name, parent etc. Set these variables to their final values, they can not be changed later because this would mess up the parameter store

Parameters
parentparent object
nameparameter name

Definition at line 32 of file Parameter.cpp.

References _name, and _parent.

virtual void AbstractParameter::intoStream ( std::ostream &  os) const
pure virtual

Overloaded in class Parametery<T>.

See Also
Parameter::intoStream()
Parameters
osStream ot insert the value in

Implemented in ParameterList< T >, ParameterList< std::string >, Parameter< T >, Parameter< std::string >, Parameter< int >, and Parameter< bool >.

virtual void AbstractParameter::load ( const ParameterFile pf)
pure virtual

This restores the value from the paremeter named "name"."_name" in the given parameter file.

Parameters
pfParameterFile to load from.

Implemented in ParameterList< T >, ParameterList< std::string >, Parameter< T >, Parameter< std::string >, Parameter< int >, and Parameter< bool >.

virtual void AbstractParameter::save ( ParameterFile pf) const
pure 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.

Parameters
pfParameterFile to write to.

Implemented in ParameterList< T >, ParameterList< std::string >, Parameter< T >, Parameter< std::string >, Parameter< int >, and Parameter< bool >.


The documentation for this class was generated from the following files: