
#include <Component/ModelParam.H>
Inheritance diagram for NModelParam< T >:


NModelParam delegates its implementation to ModelParamAuxImpl. NModelParam<T> offers getVal() and setVal() for direct access to the T value.
Note that the implementation is entirely inline so that we don't have to explicitly instantiate NModelParam<T> anywhere; plus these functions are small so any compile time hit from having the functions inline is small.
Note that we have two similar template types: NModelParam and OModelParam. The 'O' is for "command-line Option", and the 'N' is for "Not a command-line option". NModelParam only implements ModelParamBase and is constructed with a string for its parameter name. On the other hand, OModelParam implements OptionedModelParam, which means that it offers getOptionDef(), and it takes a ModelOptionDef* in its constructor instead of a string (the parameter name is taken from the ModelOptionDef).
Definition at line 234 of file ModelParam.H.
Constructors and Destructors | |
| NModelParam (const std::string &nam, ParamClient *client, const T &initval, const ParamFlag flags=0) | |
| Construct with a string name only. | |
| static rutz::shared_ptr< NModelParam< T > > | make (const std::string &nam, ParamClient *client, const T &initval, const ParamFlag flags=0) |
| A "pseudo-constructor" that makes a rutz::shared_ptr<NModelParam>. | |
Public Member Functions | |
Access functions | |
| virtual std::string | getName () const |
| get the ModelParamAuxImpl's name | |
| T | getVal () const |
| Get the value. | |
| bool | setVal (const T &v) |
| Set the value. | |
| virtual std::string | getValString () const |
| Get the value as a string. | |
| virtual bool | setValString (const std::string &textval) |
| Set the parameter value from a textual representation, notify clients of the change. | |
| virtual void | getValGeneric (RefHolder &ref) const |
| Get the current value through a dynamically-typed RefHolder. | |
| virtual bool | setValGeneric (const RefHolder &ref) |
| Set the current value through a dynamically-typed RefHolder. | |
Input/Output functions | |
| virtual void | printout (std::ostream &s, const std::string &prefix="") const |
| Print out our name and contents, mostly for debugging. | |
| virtual void | writeTo (ParamMap &pmap) const |
| Write parameter value to ParamMap. | |
| virtual void | readFrom (const ParamMap &pmap, const bool noerr=true) |
| Get parameter value from ParamMap. | |
|
||||||||||||||||||||||||
|
Construct with a string name only. Same as ModelParamAuxImpl plus an initial parameter value
Definition at line 577 of file ModelParam.H. |
|
||||||||||
|
get the ModelParamAuxImpl's name
Implements ModelParamBase. Definition at line 284 of file ModelParam.H. |
|
|||||||||
|
||||||||||
|
Get the current value through a dynamically-typed RefHolder.
Implements ModelParamBase. Definition at line 588 of file ModelParam.H. References NModelParam< T >::getVal(), SRC_POS, rutz::throw_bad_cast(), and RefHolder::type(). |
|
|||||||||
|
Get the value as a string.
Implements ModelParamBase. Definition at line 333 of file ModelParam.H. Referenced by modelparam_xx_getset_xx_1(), and modelparam_xx_getset_xx_2(). |
|
||||||||||||||||||||||||
|
A "pseudo-constructor" that makes a rutz::shared_ptr<NModelParam>. This can be used in places that need arrays of NModelParam objects. Since NModelParam doesn't have a default constructor, we can't make an array of NModelParam objects. But we can make an array of rutz::shared_ptr<NModelParam> objects. Then we can initialize each in a loop by doing arr[i] = NModelParam<T>::make(...). Note that an alternative to C-style arrays (where the type must have a default constructor) is to use std::vector. Then we can do vec.push_back(NModelParam<T>(...)) and build the vector incrementally, again without needed a default constructor. Historical note: this substitutes for the previous strategy of giving NModelParam a default constructor plus an init() method that would be called in the array-initialization loop like arr[i].init(...), plus an initialized() methed. The current approach avoids the need for either init() or initialized(), instead we can let rutz::shared_ptr worry about whether the object is initialized -- we can test rutz::shared_ptr<NModelParam<T>>get() != 0 to see if the param is initialized. Definition at line 273 of file ModelParam.H. Referenced by BeoChip::BeoChip(), Pololu::Pololu(), SC8000::SC8000(), SSC::SSC(), and RadioDecoder::start1(). |
|
||||||||||||||||
|
Print out our name and contents, mostly for debugging.
Implements ModelParamBase. Definition at line 366 of file ModelParam.H. |
|
||||||||||||||||
|
Get parameter value from ParamMap.
Implements ModelParamBase. Definition at line 377 of file ModelParam.H. Referenced by modelparam_xx_readfrom_xx_1(). |
|
||||||||||
|
||||||||||
|
Set the current value through a dynamically-typed RefHolder.
Implements ModelParamBase. Definition at line 599 of file ModelParam.H. References NModelParam< T >::setVal(), SRC_POS, rutz::throw_bad_cast(), and RefHolder::type(). |
|
||||||||||
|
Set the parameter value from a textual representation, notify clients of the change.
Implements ModelParamBase. Definition at line 340 of file ModelParam.H. Referenced by modelparam_xx_getset_xx_1(), and modelparam_xx_getset_xx_2(). |
|
||||||||||
|
Write parameter value to ParamMap.
Implements ModelParamBase. Definition at line 371 of file ModelParam.H. Referenced by modelparam_xx_writeto_xx_1(). |
1.4.4