GenericParam.h
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:134
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:64
std::function< T()> GetterFn
The type for the 'getter' function for this parameter.
Definition: GenericParam.h:161
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
STL namespace.
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
This is a helper class that instantiates parameters with different data types.
Definition: GenericParam.h:154
GenericParam(std::string name)
The constructor of a parameter takes the name of the parameter (name)
Definition: GenericParam.h:68
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:299
std::function< void(T)> SetterFn
The type for the 'setter' function for this parameter.
Definition: GenericParam.h:158
void print(std::ostream &out) const
Print the parameters to a stream.
Definition: GenericParam.cpp:160
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:50
bool setValue(const std::string &value) override
Set the value of the parameter. The value is taken in as a string, but converted to the type of that ...
Definition: GenericParam.h:175
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:127
bool hasParam(const std::string &key) const
Check whether this set of parameters includes the parameter named key.
Definition: GenericParam.cpp:122
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:124
GenericParam & operator=(const T &value)
Assignment operator by type. This is just for convenience, as it just calls setValue() ...
Definition: GenericParam.h:95
const std::string & getRangeSuggestion() const
Get the suggested range of values.
Definition: GenericParam.h:115
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:232
const std::map< std::string, GenericParamPtr > & getParams() const
Get the map from parameter names to parameter descriptions.
Definition: GenericParam.cpp:102
SpecificParam(const std::string &name, SetterFn setter, GetterFn getter=GetterFn())
An explicit instantiation of a parameter name requires the setter function and optionally the getter ...
Definition: GenericParam.h:166
std::string getValue() const override
Retrieve the value of the parameter, as a string.
Definition: GenericParam.h:196
void setRangeSuggestion(const std::string &rangeSuggestion)
Set a suggested range.
Definition: GenericParam.h:109
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 ...
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