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())
Parameter withDefault(T value)
bool isCondition(F< Q > cond) const
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.
friend class CheckedParameter
bool isCondition(F< Q > cond) const
static Parameter create(const std::string &name, const T &value)
Parameter(const ParameterName &pname, const T &value)
bool isInitialized() const
bool isTypeCorrect() const
std::string ParameterName
void invalidate(const std::string &reason)
std::string invalidity_reasons
An exception type that is thrown when some parameter is passed more than once.
ParameterName name() const
stichwort_internal::ValueKeeper keeper
Parameter(const Parameter &p)
bool isInitialized() const
ParametersSet operator,(const Parameter &p)
bool isTypeCorrect() const
An exception type that is thrown in case if wrong parameter value is passed.
CheckedParameter(Parameter &p)
stichwort::ParametersSet ParametersSet
bool operator==(T v) const
Parameter & satisfies(const F< Q > &cond) const
ParameterName parameter_name