GenericParam.h
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:191
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:114
void setRangeSuggestion(const std::string &rangeSuggestion)
Set a suggested range.
Definition: GenericParam.h:199
bool hasParam(const std::string &key) const
Check whether this set of parameters includes the parameter named key.
Definition: GenericParam.cpp:186
GenericParam & operator=(const T &value)
Assignment operator by type. This is just for convenience, as it just calls setValue()
Definition: GenericParam.h:192
void getParamValues(std::vector< std::string > &vals) const
List the values of the known parameters, in the same order as getParamNames()
Definition: GenericParam.cpp:157
const std::string & getRangeSuggestion() const
Get the suggested range of values.
Definition: GenericParam.h:205
const std::map< std::string, GenericParamPtr > & getParams() const
Get the map from parameter names to parameter descriptions.
Definition: GenericParam.cpp:166
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:124
std::function< void(T)> SetterFn
The type for the 'setter' function for this parameter.
Definition: GenericParam.h:204
T lexical_cast(const std::string &value) const
Helper function to convert strings into objects of type T.
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....
Definition: GenericParam.h:129
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 print(std::ostream &out) const
Print the parameters to a stream.
Definition: GenericParam.cpp:224
std::string getValue() const override
Retrieve the value of the parameter, as a string.
Definition: GenericParam.h:242
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:212
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:138
void declareParam(const std::string &name, const typename SpecificParam< T >::SetterFn &setter, const typename SpecificParam< T >::GetterFn &getter=[] { return T();})
This function declares a parameter name, and specifies the setter and getter functions.
Definition: GenericParam.h:295
void getParamNames(std::vector< std::string > ¶ms) const
List the names of the known parameters.
Definition: GenericParam.cpp:149
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:221
std::size_t size() const
Get the number of parameters maintained by this instance.
Definition: GenericParam.h:362
GenericParam(std::string name)
The constructor of a parameter takes the name of the parameter (name)
Definition: GenericParam.h:165
std::string toString(float val)
convert float to string using classic "C" locale semantics
Definition: String.cpp:82
std::function< T()> GetterFn
The type for the 'getter' function for this parameter.
Definition: GenericParam.h:207
void remove(const std::string &name)
Remove a parameter from the set.
Definition: GenericParam.cpp:214
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:198