GenericParam.h
171 SpecificParam(const std::string &name, const SetterFn &setter, const GetterFn &getter = GetterFn()) :
void print(std::ostream &out) const
Print the parameters to a stream.
Definition: GenericParam.cpp:161
bool hasParam(const std::string &key) const
Check whether this set of parameters includes the parameter named key.
Definition: GenericParam.cpp:123
const std::map< std::string, GenericParamPtr > & getParams() const
Get the map from parameter names to parameter descriptions.
Definition: GenericParam.cpp:102
boost::function< void(T)> SetterFn
The type for the 'setter' function for this parameter.
Definition: GenericParam.h:164
void include(const ParamSet &other, const std::string &prefix="")
Include the params of a different ParamSet into this one. Optionally include a prefix for each of the...
Definition: GenericParam.cpp:135
GenericParam(const std::string &name)
The constructor of a parameter takes the name of the parameter (name)
Definition: GenericParam.h:70
virtual std::string getValue() const =0
Retrieve the value of the parameter, as a string.
Motion planning algorithms often employ parameters to guide their exploration process. (e.g., goal biasing). Motion planners (and some of their components) use this class to declare what the parameters are, in a generic way, so that they can be set externally.
Definition: GenericParam.h:65
virtual bool setValue(const std::string &value)
Set the value of the parameter. The value is taken in as a string, but converted to the type of that ...
Definition: GenericParam.h:182
void getParamNames(std::vector< std::string > ¶ms) const
List the names of the known parameters.
Definition: GenericParam.cpp:85
std::size_t size() const
Get the number of parameters maintained by this instance.
Definition: GenericParam.h:302
bool setParams(const std::map< std::string, std::string > &kv, bool ignoreUnknown=false)
Set the values for a set of parameters. The parameter names are the keys in the map kv...
Definition: GenericParam.cpp:60
bool getParam(const std::string &key, std::string &value) const
Get the value of the parameter named key. Store the value as string in value and return true if the p...
Definition: GenericParam.cpp:74
virtual std::string getValue() const
Retrieve the value of the parameter, as a string.
Definition: GenericParam.h:203
This is a helper class that instantiates parameters with different data types.
Definition: GenericParam.h:159
const std::string & maybeWrapBool(const std::string &value) const
Bool values such as "false" cannot be converted to bool using lexical_cast. We need to map those to "...
Definition: GenericParam.h:128
const std::string & getRangeSuggestion() const
Get the suggested range of values.
Definition: GenericParam.h:118
bool setParam(const std::string &key, const std::string &value)
Algorithms in OMPL often have parameters that can be set externally. While each algorithm will have t...
Definition: GenericParam.cpp:48
void getParamValues(std::vector< std::string > &vals) const
List the values of the known parameters, in the same order as getParamNames()
Definition: GenericParam.cpp:93
GenericParam & operator[](const std::string &key)
Access operator for parameters, by name. If the parameter is not defined, an exception is thrown...
Definition: GenericParam.cpp:128
GenericParam & operator=(const T &value)
Assignment operator by type. This is just for convenience, as it just calls setValue() ...
Definition: GenericParam.h:98
void declareParam(const std::string &name, const typename SpecificParam< T >::SetterFn &setter, const typename SpecificParam< T >::GetterFn &getter=typename SpecificParam< T >::GetterFn())
This function declares a parameter name, and specifies the setter and getter functions.
Definition: GenericParam.h:240
boost::function< T()> GetterFn
The type for the 'getter' function for this parameter.
Definition: GenericParam.h:167
void setRangeSuggestion(const std::string &rangeSuggestion)
Set a suggested range.
Definition: GenericParam.h:112
SpecificParam(const std::string &name, const SetterFn &setter, const GetterFn &getter=GetterFn())
An explicit instantiation of a parameter name requires the setter function and optionally the getter ...
Definition: GenericParam.h:171
virtual bool setValue(const std::string &value)=0
Set the value of the parameter. The value is taken in as a string, but converted to the type of that ...