Concrete implementation of VParameterNode, contains map of sub-paramsClasses which would like to have sections managed by config files should inherit from ParameterList, then use the RegisterParameter function to assign string names to the variables which can be config'd. More...
#include <ParameterList.hh>
Public Member Functions | |
ParameterList (const std::string &key="", const std::string &helptext="") | |
Default Constructor. | |
virtual | ~ParameterList () |
Desctructor. | |
virtual ParameterList * | Clone (const void *from, void *to) const |
Clone to new ParameterList. | |
virtual void | InitializeParameterList () |
Initialize the parameter list, needed to preserve copy functionality. | |
virtual std::istream & | ReadFrom (std::istream &in, bool single=false) |
Read the whole list from an istream. | |
virtual std::ostream & | WriteTo (std::ostream &out, bool showhelp=false, int indent=0) const |
Write the whole list to an ostream. | |
virtual int | PrintHelp (const std::string &myname="") const |
Print description, travel through sub-tree. | |
template<class T > | |
int | RegisterParameter (const std::string &key, T &par, const std::string &helptext="") |
Register a new subparameter. | |
template<class R , class W > | |
int | RegisterFunction (const std::string &key, const R &read, const W &write, const std::string &helptext="") |
Register a new function with read and write operators. | |
template<class R > | |
int | RegisterReadFunction (const std::string &key, const R &read, const std::string &helptext="") |
Register a new function that only works when reading. | |
template<class W > | |
int | RegisterWriteFunction (const std::string &key, const W &write, const std::string &helptext="") |
Register a new function that only works when writing. | |
VParameterNode *const | GetParameter (const std::string &key) |
Get a subparameter by name. | |
Protected Types | |
typedef std::map< std::string, VParameterNode * > | ParMap |
map of subparameters and their names | |
Protected Member Functions | |
ParameterList (const ParameterList &right) | |
Copy constructor can only be used by derived classes. | |
ParameterList & | operator= (const ParameterList &right) |
Operator= can only be used by derived classes. | |
void | CopyPlistRelative (const ParameterList &right) |
Util to copy the guts of a parameter list by relative reference. | |
template<class T > | |
int | RegisterParameterImp (const std::string &key, T &par, const std::string &helptext, const boost::false_type &) |
Actual implementation to register a variable as a sub parameter. | |
template<class T > | |
int | RegisterParameterImp (const std::string &key, T &par, const std::string &helptext, const boost::true_type &) |
Register a whole ParameterList as a sub parameter. | |
Protected Attributes | |
ParMap | _parameters |
all registered subparameters | |
std::vector< boost::shared_ptr < VParameterNode > > | _deleter |
Safely deletes subparams. |
Concrete implementation of VParameterNode, contains map of sub-params
Classes which would like to have sections managed by config files should inherit from ParameterList, then use the RegisterParameter function to assign string names to the variables which can be config'd.
Note that when ParameterList is copied, all of the registered names are lost. To handle this, derived classes should override the InitializeParameterList virtual method, and place their registration calls there. This function is called before both read and write operations if the list of subnodes is empty.
Definition at line 41 of file ParameterList.hh.