Go to the documentation of this file.
37 #include <boost/format.hpp>
38 #include <boost/typeof/typeof.hpp>
71 for (BOOST_AUTO(it,p.begin()); it != p.end(); ++it)
72 o <<
"- " << *it << endl;
115 defaultValue(defaultValue),
125 defaultValue(defaultValue),
172 className(className),
173 parametersDoc(paramsDoc)
178 const string& paramName(it->name);
179 Parameters::const_iterator paramIt(params.find(paramName));
180 if (paramIt != params.end())
182 const string& val(paramIt->second);
183 if (it->comp(val, it->minValue))
184 throw InvalidParameter((boost::format(
"Value %1% of parameter %2% in class %3% is smaller than minimum admissible value %4%") % val % paramName %
className % it->minValue).str());
185 if (it->comp(it->maxValue, val))
186 throw InvalidParameter((boost::format(
"Value %1% of parameter %2% in class %3% is larger than maximum admissible value %4%") % val % paramName %
className % it->maxValue).str());
201 Parameters::const_iterator paramIt(
parameters.find(paramName));
206 return paramIt->second;
friend std::ostream & operator<<(std::ostream &o, const Parametrizable &p)
Dump the documentation of this object to a stream.
Parametrizable()
Construct a documentation of parameters from a description in the source.
const ParametersDoc parametersDoc
documentation of parameters
std::string doc
short documentation
ParametersUsed parametersUsed
parameters whose value has actually been read
bool(* LexicalComparison)(std::string a, std::string b)
A function that returns whether a is smaller than b.
std::vector< ParameterDoc > ParametersDoc
The documentation of all parameters.
std::string defaultValue
default value
Parameters parameters
parameters with their values encoded in string
ParameterDoc(const std::string &name, const std::string &doc, const std::string &defaultValue, const std::string &minValue, const std::string &maxValue, LexicalComparison comp)
Construct a parameter documentation with bounds.
std::string maxValue
if bounds are checked, maxmimu value
An exception thrown when one tries to fetch the value of an unexisting parameter.
std::string getParamValueString(const std::string ¶mName)
Get the value of a parameter, as a string.
virtual ~Parametrizable()
Virtual destructor, do nothing.
InvalidParameter(const std::string &reason)
Construct an invalid-parameter exception.
The superclass of classes that are constructed using generic parameters. This class provides the para...
The documentation of a parameter.
Functions and classes that are not dependant on scalar type are defined in this namespace.
std::string minValue
if bounds are checked, minimum value
const std::string className
name of the class
std::map< std::string, Parameter > Parameters
Parameters stored as a map of string->string.
bool FalseLexicalComparison(std::string, std::string)
Return always false.
mp2p_icp
Author(s):
autogenerated on Fri Dec 20 2024 03:45:59