COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Public Types | Public Member Functions | Public Attributes | List of all members
OptionList Class Reference

#include <OptionList.hpp>

Inherited by SignalOptions.

Public Types

typedef std::map< std::string, boost::shared_ptr< Option > > OptionStorage_t
 type to store the options per name More...
 
typedef OptionStorage_t::iterator iterator
 
typedef OptionStorage_t::const_iterator const_iterator
 

Public Member Functions

template<typename T >
SelectOptionType< T >::type & add (const std::string &name, const T &default_value=T())
 
template<typename OPTION_TYPE >
OPTION_TYPE & add (const boost::shared_ptr< OPTION_TYPE > &option)
 
template<typename TYPE >
void link_to_parameter (const std::string &pname, TYPE *par)
 sets a link to the option More...
 
const Optionoption (const std::string &pname) const
 get a constant option from the list More...
 
Optionoption (const std::string &pname)
 get an option from the list More...
 
const boost::shared_ptr< Option > & option_ptr (const std::string &pname)
 get a constant option from the list More...
 
const Optionoperator[] (const std::string &pname) const
 contant access operator to properties More...
 
Optionoperator[] (const std::string &pname)
 access operator to properties More...
 
void set (const std::string &pname, const boost::any &val)
 
bool set_if_exists (const std::string &pname, const boost::any &val)
 
template<typename TYPE >
const TYPE value (const std::string &opt_name) const
 Get the value of the option with given name. More...
 
bool check (const std::string &opt_name) const
 
void erase (const std::string &name)
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
std::string list_options () const
 list the options as a string More...
 
void set (const std::string &arg)
 Parses the strings to options. More...
 
void set (const std::vector< std::string > &args)
 Configure an option on this class from a list of human readable strings. More...
 

Public Attributes

OptionStorage_t store
 storage of options More...
 

Detailed Description

Class defines a list of options to be used in the ConfigObject class

Author
Tiago Quintino

Definition at line 26 of file OptionList.hpp.

Member Typedef Documentation

typedef OptionStorage_t::const_iterator const_iterator

Definition at line 35 of file OptionList.hpp.

typedef OptionStorage_t::iterator iterator

Definition at line 34 of file OptionList.hpp.

typedef std::map< std::string , boost::shared_ptr<Option> > OptionStorage_t

type to store the options per name

Definition at line 32 of file OptionList.hpp.

Member Function Documentation

SelectOptionType<T>::type& add ( const std::string &  name,
const T &  default_value = T() 
)
inline

Create an option and add it to the list

Parameters
TTemplate parameter specifying the type held by the option.
nameName of the option
default_valueDefault value for the option
Precondition
An option with the same name does not exist
Returns
A reference to the created option

Definition at line 45 of file OptionList.hpp.

OPTION_TYPE& add ( const boost::shared_ptr< OPTION_TYPE > &  option)
inline

adds an externally created option to the list

Precondition
An option with the same name does not exist
Returns
A reference to the added option

Definition at line 60 of file OptionList.hpp.

iterator begin ( )
inline

Definition at line 120 of file OptionList.hpp.

const_iterator begin ( ) const
inline

Definition at line 124 of file OptionList.hpp.

bool check ( const std::string &  opt_name) const
inline

check that a option with the name exists

Parameters
opt_namethe property name

Definition at line 111 of file OptionList.hpp.

iterator end ( )
inline

Definition at line 122 of file OptionList.hpp.

const_iterator end ( ) const
inline

Definition at line 126 of file OptionList.hpp.

void erase ( const std::string &  name)

erases an option from the list

Parameters
namethe option name to erase

Definition at line 78 of file OptionList.cpp.

void link_to_parameter ( const std::string &  pname,
TYPE *  par 
)
inline

sets a link to the option

Definition at line 71 of file OptionList.hpp.

std::string list_options ( ) const

list the options as a string

Definition at line 155 of file OptionList.cpp.

const Option & operator[] ( const std::string &  pname) const

contant access operator to properties

Definition at line 111 of file OptionList.cpp.

Option & operator[] ( const std::string &  pname)

access operator to properties

Definition at line 89 of file OptionList.cpp.

const Option & option ( const std::string &  pname) const

get a constant option from the list

Definition at line 52 of file OptionList.cpp.

Option & option ( const std::string &  pname)

get an option from the list

Definition at line 71 of file OptionList.cpp.

const boost::shared_ptr< Option > & option_ptr ( const std::string &  pname)

get a constant option from the list

Definition at line 32 of file OptionList.cpp.

void set ( const std::string &  pname,
const boost::any &  val 
)

Configure one option, and trigger its actions

Parameters
[in]optnameThe option name
[in]valThe new value assigned to the option

Definition at line 132 of file OptionList.cpp.

void set ( const std::string &  arg)

Parses the strings to options.

If an option already exists in the list, its value is modified with the new one. If it does not exist yet, it is added. Configure an option on this class from a human readable string.

The string provides the configuration in one of the following formats:

  • var_name:type=value
  • var_name:array[type]=val1,val2

Definition at line 228 of file OptionList.cpp.

void set ( const std::vector< std::string > &  args)

Configure an option on this class from a list of human readable strings.

The strings provide the configuration in one of the following formats:

  • var_name:type=value
  • var_name:array[type]=val1,val2

Definition at line 315 of file OptionList.cpp.

bool set_if_exists ( const std::string &  pname,
const boost::any &  val 
)

Configure one option, and trigger its actions

Parameters
[in]optnameThe option name
[in]valThe new value assigned to the option

Definition at line 215 of file OptionList.cpp.

const TYPE value ( const std::string &  opt_name) const
inline

Get the value of the option with given name.

Parameters
[in]opt_nameThe option name
Returns
option value with correct type

Definition at line 104 of file OptionList.hpp.

Member Data Documentation

storage of options

Definition at line 153 of file OptionList.hpp.


The documentation for this class was generated from the following files:
Send comments to:
COOLFluiD Web Admin