29 #ifndef STICHWORT_PARAMETER_H_ 30 #define STICHWORT_PARAMETER_H_ 44 class CheckedParameter;
55 Parameter(
const ParameterName& pname,
const T& value) :
104 return getValue<T>();
114 template <
typename T>
117 if (!isTypeCorrect<T>())
125 template <
typename T>
138 template <
template<
class>
class F,
class Q>
158 template <
typename T>
164 template <
typename T>
201 template <
typename T>
204 return parameter.is<T>(v);
207 template <
template<
class>
class F,
class Q>
210 if (!parameter.isCondition(cond))
211 parameter.
invalidate(cond.failureMessage(parameter));
216 template <
typename T>
248 this->pmap = other.
pmap;
249 this->dups = other.
dups;
256 std::stringstream ss;
257 ss <<
"The following parameters are set more than once: ";
258 for (DuplicatesList::const_iterator iter=dups.begin(); iter!=dups.end(); ++iter)
266 if (pmap.count(p.
name()))
267 dups.push_back(p.
name());
273 return pmap.count(name) > 0;
277 typedef ParametersMap::const_iterator MapIter;
278 for (MapIter iter = pg.
pmap.begin(); iter!=pg.
pmap.end(); ++iter)
280 if (!pmap.count(iter->first))
282 pmap[iter->first] = iter->second;
288 ParametersMap::const_iterator it = pmap.find(name);
289 if (it != pmap.end())
bool isInitialized() const
Parameter withDefault(T value)
An exception type that is thrown in case of missed parameter, i.e. when some required parameter is no...
CheckedParameter checked()
The namespace that contains implementations for the keywords.
Parameter & satisfies(const F< Q > &cond) const
friend class CheckedParameter
static Parameter create(const std::string &name, const T &value)
bool operator==(T v) const
Parameter(const ParameterName &pname, const T &value)
ParameterName name() const
std::string ParameterName
bool isTypeCorrect() const
void invalidate(const std::string &reason)
std::string invalidity_reasons
An exception type that is thrown when some parameter is passed more than once.
stichwort_internal::ValueKeeper keeper
bool isInitialized() const
Parameter(const Parameter &p)
bool isCondition(F< Q > cond) const
ParametersSet operator,(const Parameter &p)
An exception type that is thrown in case if wrong parameter value is passed.
CheckedParameter(Parameter &p)
bool isTypeCorrect() const
bool isCondition(F< Q > cond) const
stichwort::ParametersSet ParametersSet
ParameterName parameter_name