35 #include "kernel_manager.h" 36 #include "exceptions.h" 37 #include "dictdatum.h" 52 template <
typename T >
56 virtual void apply( T
const&,
const Name& name )
const = 0;
62 template <
typename T >
67 : min_value_( min_value )
71 void apply( T
const& val,
const Name& name )
const 73 if ( val < min_value_ )
75 std::stringstream strm;
76 strm <<
"Parameter '" << name <<
"' must not be smaller than " << T(min_value_) <<
" but is " << T(val);
77 LOG( nest::M_ERROR,
"CMin::apply()", strm.str() );
78 throw nest::BadProperty(
"Parameter out of range. See LOG file for details.");
89 template <
typename T >
94 : max_value_( max_value )
98 void apply( T
const& val,
const Name& name )
const 100 if ( val > max_value_ )
102 std::stringstream strm;
103 strm <<
"Parameter '" << name <<
"' must not be bigger than " << T(max_value_) <<
" but is " << T(val);
104 LOG( nest::M_ERROR,
"CMax::apply()", strm.str() );
105 throw nest::BadProperty(
"Parameter out of range. See LOG file for details.");
116 template <
typename T >
121 : min_value_( min_value )
125 void apply( T
const& val,
const Name& name )
const 127 if ( val <= min_value_ )
129 std::stringstream strm;
130 strm <<
"Parameter '" << name <<
"' must be strictly bigger than " << T(min_value_) <<
" but is " << T(val);
131 LOG( nest::M_ERROR,
"CBigger::apply()", strm.str() );
132 throw nest::BadProperty(
"Parameter out of range. See LOG file for details.");
143 template <
typename T >
148 : max_value_( min_value )
152 void apply( T
const& val,
const Name& name )
const 154 if ( val >= max_value_ )
156 std::stringstream strm;
157 strm <<
"Parameter '" << name <<
"' must be strictly smaller than " << T(max_value_)
158 <<
" but is " << T(val);
159 LOG( nest::M_ERROR,
"CSmaller::apply()", strm.str() );
160 throw nest::BadProperty(
"Parameter out of range. See LOG file for details.");
204 template <
typename T >
205 void parameter( T& val,
const Name& name, T default_val )
217 template <
typename T >
220 con1.apply(default_val, name);
231 template <
typename T >
235 con1.apply(default_val, name);
236 con2.apply(default_val, name);
247 template <
typename T >
251 con1.apply(default_val, name);
252 con2.apply(default_val, name);
253 con3.apply(default_val, name);
272 template <
typename T >
275 def< T >(d_, name, val);
285 template <
typename T >
288 def< T >(d_, name, val);
298 template <
typename T >
301 def< T >(d_, name, val);
311 template <
typename T >
315 def< T >(d_, name, val);
336 template <
typename T >
348 template <
typename T >
352 if (updateValue< T >(d_, name, val))
354 con1.apply(val, name);
365 template <
typename T >
370 if (updateValue< T >(d_, name, val))
372 con1.apply(val, name);
373 con2.apply(val, name);
384 template <
typename T >
389 if (updateValue< T >(d_, name, val))
391 con1.apply(val, name);
392 con2.apply(val, name);
393 con3.apply(val, name);
398 const DictionaryDatum& d_;
415 template <
typename T >
418 updateValue< T >(d_, name, val);
428 template <
typename T >
431 updateValue< T >(d_, name, val);
441 template <
typename T >
444 updateValue< T >(d_, name, val);
454 template <
typename T >
458 updateValue< T >(d_, name, val);
462 const DictionaryDatum& d_;
void parameter(T &val, const Name &name, T, const pc::Con< T > &, const pc::Con< T > &, const pc::Con< T > &)
Define parameter with 3 constraints.
Definition: param_utils.h:455
void parameter(T &val, const Name &name, T default_val, const pc::Con< T > &con1, const pc::Con< T > &con2)
Define parameter with 2 constraints.
Definition: param_utils.h:232
void parameter(T &val, const Name &name, T)
Define parameter without constraint.
Definition: param_utils.h:416
void parameter(T &val, const Name &name, T, const pc::Con< T > &)
Define parameter with 1 constraint.
Definition: param_utils.h:429
void parameter(const T &val, const Name &name, T, const pc::Con< T > &)
Define parameter with 1 constraint.
Definition: param_utils.h:286
void parameter(const T &val, const Name &name, T, const pc::Con< T > &, const pc::Con< T > &)
Define parameter with 2 constraints.
Definition: param_utils.h:299
void parameter(const T &, const Name &name, T, const pc::Con< T > &con1, const pc::Con< T > &con2, const pc::Con< T > &con3)
Define parameter with 3 constraints.
Definition: param_utils.h:385
void parameter(const T &, const Name &name, T, const pc::Con< T > &con1)
Define parameter with 1 constraint.
Definition: param_utils.h:349
Maximum condition. Parameter must be smaller or equal to given value.
Definition: param_utils.h:90
void parameter(const T &val, const Name &name, T, const pc::Con< T > &, const pc::Con< T > &, const pc::Con< T > &)
Define parameter with 3 constraints.
Definition: param_utils.h:312
Minimum condition. Parameter must be larger or equal to given value.
Definition: param_utils.h:63
void parameter(const T &, const Name &, T)
Define parameter without constraint.
Definition: param_utils.h:337
"Bigger than" condition. Parameter must be larger or equal to given value.
Definition: param_utils.h:117
Generic class to check parameters.
Definition: param_utils.h:325
void parameter(const T &val, const Name &name, T)
Define parameter without constraint.
Definition: param_utils.h:273
void parameter(T &val, const Name &name, T, const pc::Con< T > &, const pc::Con< T > &)
Define parameter with 2 constraints.
Definition: param_utils.h:442
void parameter(T &val, const Name &name, T default_val)
Define parameter without constraint.
Definition: param_utils.h:205
Generic parameter setter class.
Definition: param_utils.h:404
Base class to all conditions that can be imposed onto parameters.
Definition: param_utils.h:53
"Smaller than" condition. Parameter must be larger or equal to given value.
Definition: param_utils.h:144
void parameter(const T &, const Name &name, T, const pc::Con< T > &con1, const pc::Con< T > &con2)
Define parameter with 2 constraints.
Definition: param_utils.h:366
Generic parameter getter class.
Definition: param_utils.h:261
Global namespace holding all classes of the SPORE NEST module.
Definition: circular_buffer.h:31
void parameter(T &val, const Name &name, T default_val, const pc::Con< T > &con1, const pc::Con< T > &con2, const pc::Con< T > &con3)
Define parameter with 3 constraints.
Definition: param_utils.h:248
void parameter(T &val, const Name &name, T default_val, const pc::Con< T > &con1)
Define parameter with 1 constraint.
Definition: param_utils.h:218
Generic class to set up the default parameters.
Definition: param_utils.h:193