#include <parammap.h>
Inheritance diagram for ParamMap:
If error reporting is desired, the message() routine can be overridden by a derived class.
Definition at line 18 of file parammap.h.
Public Types | |
typedef ParamMap | self |
Public Methods | |
template<class T> const T * | get (const char *name, T *&x, const bool warn=true, const bool warn_unknown=true) const |
Looks up the given parameter, setting the given location to its value if the types match. | |
template<class T> T | get_with_default (const char *name, const T &default_val, const bool warn=true, const bool warn_unknown=false) const |
Wrapper for get() which substitutes the given default value if a value cannot be obtained from the map. | |
virtual ParamMap * | new_child (const string name_="", const bool owned=false)=0 |
Returns a new child map (presumably linked to this map) of the same specific type as self; should be implemented by all derived classes. | |
virtual const ParamMap & | get_child (const string &name_="") const=0 |
Searches self and children for the specified child map, returning it if found or self otherwise. | |
virtual ParamMap & | get_child (const string &name_="")=0 |
|
Looks up the given parameter, setting the given location to its value if the types match. If warn_unknown is true, an error is generated if the named parameter is not found. If warn is true, other types of problems (e.g. type mismatch) generate errors. Definition at line 29 of file parammap.h. References PointerLookup< Typeless >::getptr(), and PolymorphBase< T >::valueptr(). Referenced by get_with_default(). |
|
Searches self and children for the specified child map, returning it if found or self otherwise. The specification format is not determined, and the self may be returned in all cases if no list of children is kept. Implemented in ParameterMap< ParamT >, and ParameterMap< ParamType >. Referenced by Plot::PlotSpecification< Matrix, String, ScaleType, MatrixTableType, ParameterMapType >::bitmap_histogram(), Plot::PlotSpecification< Matrix, String, ScaleType, MatrixTableType, ParameterMapType >::bitmap_image(), Plot::PlotSpecification< Matrix, String, ScaleType, MatrixTableType, ParameterMapType >::gnuplot_image(), and Plot::PlotSpecification< Matrix, String, ScaleType, MatrixTableType, ParameterMapType >::save_matrix(). |
|
Returns a new child map (presumably linked to this map) of the same specific type as self; should be implemented by all derived classes. The return type should always be ParamMap* to avoid problems with older compilers, e.g. Cray C++. The child is allocated using new, and should be deleted when no longer needed. If owned is true, this object is responsible for the destruction of the child object when this child is destroyed. (Usually a ParamMap will be associated with another object, to be destroyed when that object is destroyed, but passing true here can be useful for sub-maps owned by a single object. Implemented in ParameterMap< ParamT >, and ParameterMap< ParamType >. |