charon-core  0.3.1
ParameterList< T > Class Template Reference

Implementation of the AbstractParameter interface for a list of parameters. More...

#include <charon-core/Parameter.h>

Inheritance diagram for ParameterList< T >:

Public Member Functions

 ParameterList (std::string defaultValue="")
 Create parameter list. 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 ParameterList at the end of a stream. More...
 
virtual void load (const ParameterFile &pf)
 Load from ParameterFile. More...
 
 operator std::vector< T > () const
 Cast operator to get copy of internal value.
 
std::vector< T > & operator() ()
 Call operator to get a reference to the parameter list content.
 
const std::vector< T > & operator() () const
 Call operator to get a const reference to the parameter list content.
 
virtual std::vector< T > & operator= (const std::vector< T > &B)
 Assign parameter content. More...
 
virtual ParameterList< T > & operator= (const ParameterList< T > &B)
 Assign parameter content. More...
 
virtual const T & operator[] (std::size_t pos) const
 Access to specific member (read-only). More...
 
virtual T & operator[] (std::size_t pos)
 Access to specific member (read-write). More...
 
virtual void save (ParameterFile &pf) const
 Save to ParameterFile. More...
 
void setDefault (const std::string &value)
 Set default value. More...
 
virtual std::size_t size () const
 Access to number of members. More...
 
- Public Member Functions inherited from AbstractParameter
std::string getName () const
 Get parameter name.
 
ParameteredObjectgetParent ()
 get parent object
 
const ParameteredObjectgetParent () const
 get parent object (const version)
 
void init (ParameteredObject *parent, const std::string &name)
 Initialize new parameter. More...
 

Private Attributes

std::string _defaultValue
 Default value, string representation, separated by ";".
 
std::vector< T > _value
 Internal value (list).
 

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.
 

Detailed Description

template<typename T>
class ParameterList< T >

Definition at line 213 of file Parameter.h.

Constructor & Destructor Documentation

template<typename T >
ParameterList< T >::ParameterList ( std::string  defaultValue = "")

Assign parameter name, description and content. Internal value will be set to defaultValue, the given string representation will be split up at ";".

Parameters
defaultValueDefault value.

Definition at line 131 of file Parameter.hxx.

References ParameterFile::getList().

Member Function Documentation

template<typename T >
std::string ParameterList< T >::getDefaultString ( )
virtual

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

Returns
default value string

Implements AbstractParameter.

Definition at line 211 of file Parameter.hxx.

template<typename T >
std::string ParameterList< T >::guessType ( ) const
virtual
Returns
string representation of T

Implements AbstractParameter.

Definition at line 170 of file Parameter.hxx.

References TypeDetector::type().

template<typename T >
void ParameterList< T >::intoStream ( std::ostream &  os) const
virtual
See Also
AbstractParameter::intoStream()
Parameters
osStream ot insert the value in

Implements AbstractParameter.

Definition at line 216 of file Parameter.hxx.

template<typename T >
void ParameterList< T >::load ( const ParameterFile pf)
virtual

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

Parameters
pfParameterFile to load from.

Implements AbstractParameter.

Definition at line 194 of file Parameter.hxx.

References ParameterFile::getList(), ParameterFile::isSet(), and ParameterFile::set().

template<typename T>
std::vector< T > & ParameterList< T >::operator= ( const std::vector< T > &  B)
virtual

Default value remains unchanged.

Parameters
[in]BCopy source.
Returns
updated list content

Definition at line 142 of file Parameter.hxx.

template<typename T>
ParameterList< T > & ParameterList< T >::operator= ( const ParameterList< T > &  B)
virtual

Default value remains unchanged.

Parameters
BCopy source.
Returns
updated list content

Definition at line 148 of file Parameter.hxx.

References ParameterList< T >::_defaultValue, and ParameterList< T >::_value.

template<typename T >
const T & ParameterList< T >::operator[] ( std::size_t  pos) const
virtual
Parameters
posdata position
Returns
data content at given position (read-only, no copy)

Implements AbstractMultiROData< T >.

Definition at line 231 of file Parameter.hxx.

template<typename T >
T & ParameterList< T >::operator[] ( std::size_t  pos)
virtual
Parameters
posdata position
Returns
data content at given position (read-write, no copy)

Implements AbstractMultiData< T >.

Definition at line 236 of file Parameter.hxx.

template<typename T >
void ParameterList< T >::save ( ParameterFile pf) const
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.

Implements AbstractParameter.

Definition at line 175 of file Parameter.hxx.

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

template<typename T >
void ParameterList< T >::setDefault ( const std::string &  value)
Parameters
valueNew default value

Definition at line 206 of file Parameter.hxx.

template<typename T >
std::size_t ParameterList< T >::size ( ) const
virtual

For iterations using operator[]

Returns
number of elements

Implements AbstractMultiROData< T >.

Definition at line 226 of file Parameter.hxx.


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