HyperspaceExplorer 0.7.1
|
A class to store and manage FunctionParameter s. More...
#include <ParameterMap.h>
Classes | |
class | NonexistentParameterAccessed |
Exception that is thrown when a key is accessed that is not present in a ParameterMap. More... | |
Public Member Functions | |
template<typename T > | |
ParameterMap (const std::string &name, const T &value) | |
Create a ParameterMap containing one parameter. | |
template<typename T > | |
void | insertByValue (const std::string name, const T &value) |
Insert a parameter with a name and an actual value. | |
template<typename T > | |
void | insertByDefault (const std::string name, const T &defaultValue) |
Insert a parameter with a name and a default value. | |
FunctionParameter::parameter_ptr_type | getParameter (const std::string &name) |
FunctionParameter::value_ptr_type | getValue (const std::string &name) |
template<typename T > | |
void | set (const std::string &name, const T &value) |
Sets the value of the parameter stored under the key name to value . | |
std::string | toString () const |
template<> | |
void | set (const std::string &name, const double &value) |
Specialization for type double , which has no toString() method. | |
template<> | |
void | set (const std::string &name, const unsigned &value) |
Specialization for type unsigned , which has no toString() method. | |
template<> | |
void | set (const std::string &name, const int &value) |
Specialization for type int , which has no toString() method. | |
template<> | |
void | set (const std::string &name, const std::string &value) |
Specialization for type std::string , which has no toString() method. | |
Private Types | |
typedef std::map< std::string, FunctionParameter::parameter_ptr_type > | map_type |
Type of the container used to actually store the FunctionParameter s. | |
Private Member Functions | |
ParameterMap::iterator | findOrThrow (const std::string &name) |
A class to store and manage FunctionParameter s.
ParameterMap::ParameterMap | ( | const std::string & | name, |
const T & | value | ||
) | [inline] |
Create a ParameterMap containing one parameter.
T | The type of the parameter that is in the map. |
References insertByValue().
ParameterMap::iterator ParameterMap::findOrThrow | ( | const std::string & | name | ) | [private] |
name
.NonexistentParameterAccessed | if name is not a key. |
References std::map< std::string, FunctionParameter::parameter_ptr_type >::end(), and std::map< std::string, FunctionParameter::parameter_ptr_type >::find().
Referenced by getParameter().
FunctionParameter::parameter_ptr_type ParameterMap::getParameter | ( | const std::string & | name | ) |
name
.NonexistentParameterAccessed | if name is not a key. |
References findOrThrow().
Referenced by UI::Dialogs::ValuesDialogImpl::accept(), ParametricFunction< 4, 2 >::getParameter(), Displayable::getParameter(), getValue(), and set().
FunctionParameter::value_ptr_type ParameterMap::getValue | ( | const std::string & | name | ) |
name
.NonexistentParameterAccessed | if name is not a key. |
References getParameter().
Referenced by ParametricFunction< 4, 2 >::getParameterValue(), and Displayable::getParameterValue().
void ParameterMap::insertByDefault | ( | const std::string | name, |
const T & | defaultValue | ||
) | [inline] |
Insert a parameter with a name and a default value.
T | The type of the parameter that is inserted. |
References std::map< std::string, FunctionParameter::parameter_ptr_type >::insert(), Loki::SingletonHolder< T, CreationPolicy >::Instance(), and std::make_pair().
void ParameterMap::insertByValue | ( | const std::string | name, |
const T & | value | ||
) | [inline] |
Insert a parameter with a name and an actual value.
T | The type of the parameter that is inserted. |
References std::map< std::string, FunctionParameter::parameter_ptr_type >::insert(), Loki::SingletonHolder< T, CreationPolicy >::Instance(), and std::make_pair().
Referenced by ParameterMap().
void ParameterMap::set | ( | const std::string & | name, |
const T & | value | ||
) | [inline] |
Sets the value of the parameter stored under the key name
to value
.
T | The type of parameter that is to be changed. T must be either of a class that has the toString() method, or one of the primitive types for which explicit specializations are listed below. |
name | Key of the parameter that is to be set. |
value | The new value for parameter name . |
NonexistentParameterAccessed | if name is not a key. |
References getParameter(), and value().
std::string ParameterMap::toString | ( | ) | const |
References std::map< std::string, FunctionParameter::parameter_ptr_type >::begin(), std::map< std::string, FunctionParameter::parameter_ptr_type >::end(), and std::endl().
Referenced by C4DView::ApplyChanges(), AltSponge::SetParameters(), and Sponge::SetParameters().