ompl::base::ParamSet Class Reference

Maintain a set of parameters. More...

#include <ompl/base/GenericParam.h>

## Public Member Functions

template<typename T >
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.

Add a parameter to the set.

void remove (const std::string &name)
Remove a parameter from the set.

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 parameters.

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 their own getter and setter functions specifically for those parameters, this function allows setting parameters generically, for any algorithm that declares parameters, by specifying the parameter name key and its value value (both as string, but value is cast to the type desired by the corresponding setter). Under the hood, this calls SpecificParam::setValue(). This ability makes it easy to automatically configure using external sources (e.g., a configuration file). The function returns true if the parameter was parsed and set successfully and false otherwise.

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 parameter was found. Return false otherwise.

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. The corresponding key values in kv are set as the parameter values. Return true if all parameters were set successfully. This function simply calls setParam() multiple times. If ignoreUnknown is true, then no attempt is made to set unknown parameters (and thus no errors are reported)

void getParams (std::map< std::string, std::string > &params) const
Get the known parameter as a map from names to their values cast as string.

void getParamNames (std::vector< std::string > &params) const
List the names of the known parameters.

void getParamValues (std::vector< std::string > &vals) const
List the values of the known parameters, in the same order as getParamNames()

const std::map< std::string, GenericParamPtr > & getParams () const
Get the map from parameter names to parameter descriptions.

const GenericParamPtr & getParam (const std::string &key) const
Get the parameter that corresponds to a specified name. An empty shared ptr is returned if the parameter does not exist.

bool hasParam (const std::string &key) const
Check whether this set of parameters includes the parameter named key.

GenericParamoperator[] (const std::string &key)
Access operator for parameters, by name. If the parameter is not defined, an exception is thrown.

std::size_t size () const
Get the number of parameters maintained by this instance.

void clear ()
Clear all the set parameters.

void print (std::ostream &out) const
Print the parameters to a stream.

## Detailed Description

Maintain a set of parameters.

Definition at line 225 of file GenericParam.h.

The documentation for this class was generated from the following files: