ompl::base::SpecificParam< T > Class Template Reference

This is a helper class that instantiates parameters with different data types. More...

#include <ompl/base/GenericParam.h>

Inheritance diagram for ompl::base::SpecificParam< T >:

Public Types

using SetterFn = std::function< void(T)>
 The type for the 'setter' function for this parameter. More...
 
using GetterFn = std::function< T()>
 The type for the 'getter' function for this parameter. More...
 

Public Member Functions

 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 function. More...
 
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 parameter. More...
 
std::string getValue () const override
 Retrieve the value of the parameter, as a string. More...
 
std::string getValue () const
 Retrieve the value of the parameter, as a string. More...
 
std::string getValue () const
 Retrieve the value of the parameter, as a string. More...
 
std::string getValue () const
 Retrieve the value of the parameter, as a string. More...
 
std::string getValue () const
 Retrieve the value of the parameter, as a string. More...
 
- Public Member Functions inherited from ompl::base::GenericParam
 GenericParam (std::string name)
 The constructor of a parameter takes the name of the parameter (name) More...
 
const std::string & getName () const
 Get the name of the parameter. More...
 
void setName (const std::string &name)
 Set the name of the parameter. More...
 
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 parameter. More...
 
virtual std::string getValue () const =0
 Retrieve the value of the parameter, as a string. More...
 
template<typename T >
GenericParamoperator= (const T &value)
 Assignment operator by type. This is just for convenience, as it just calls setValue() More...
 
void setRangeSuggestion (const std::string &rangeSuggestion)
 Set a suggested range. More...
 
const std::string & getRangeSuggestion () const
 Get the suggested range of values. More...
 

Protected Member Functions

lexical_cast (const std::string &value) const
 Helper function to convert strings into objects of type T. More...
 
bool lexical_cast (const std::string &value) const
 
int lexical_cast (const std::string &value) const
 
long lexical_cast (const std::string &value) const
 
long long lexical_cast (const std::string &value) const
 
unsigned int lexical_cast (const std::string &value) const
 
unsigned long lexical_cast (const std::string &value) const
 
unsigned long long lexical_cast (const std::string &value) const
 
float lexical_cast (const std::string &value) const
 
double lexical_cast (const std::string &value) const
 
long double lexical_cast (const std::string &value) const
 
char lexical_cast (const std::string &value) const
 
std::string lexical_cast (const std::string &value) const
 

Protected Attributes

SetterFn setter_
 The setter function for this parameter. More...
 
GetterFn getter_
 The getter function for this parameter. More...
 
- Protected Attributes inherited from ompl::base::GenericParam
std::string name_
 The name of the parameter. More...
 
std::string rangeSuggestion_
 Suggested range for the parameter. More...
 

Detailed Description

template<typename T>
class ompl::base::SpecificParam< T >

This is a helper class that instantiates parameters with different data types.

Definition at line 136 of file GenericParam.h.

Member Typedef Documentation

◆ GetterFn

template<typename T >
using ompl::base::SpecificParam< T >::GetterFn = std::function<T()>

The type for the 'getter' function for this parameter.

Definition at line 143 of file GenericParam.h.

◆ SetterFn

template<typename T >
using ompl::base::SpecificParam< T >::SetterFn = std::function<void(T)>

The type for the 'setter' function for this parameter.

Definition at line 140 of file GenericParam.h.

Constructor & Destructor Documentation

◆ SpecificParam()

template<typename T >
ompl::base::SpecificParam< T >::SpecificParam ( const std::string &  name,
SetterFn  setter,
GetterFn  getter = GetterFn() 
)
inline

An explicit instantiation of a parameter name requires the setter function and optionally the getter function.

Definition at line 148 of file GenericParam.h.

Member Function Documentation

◆ getValue() [1/5]

std::string ompl::base::SpecificParam< float >::getValue ( ) const
inlinevirtual

Retrieve the value of the parameter, as a string.

Implements ompl::base::GenericParam.

Definition at line 199 of file GenericParam.h.

◆ getValue() [2/5]

std::string ompl::base::SpecificParam< double >::getValue ( ) const
inlinevirtual

Retrieve the value of the parameter, as a string.

Implements ompl::base::GenericParam.

Definition at line 204 of file GenericParam.h.

◆ getValue() [3/5]

std::string ompl::base::SpecificParam< longdouble >::getValue ( ) const
inlinevirtual

Retrieve the value of the parameter, as a string.

Implements ompl::base::GenericParam.

Definition at line 209 of file GenericParam.h.

◆ getValue() [4/5]

std::string ompl::base::SpecificParam< std::string >::getValue ( ) const
inlinevirtual

Retrieve the value of the parameter, as a string.

Implements ompl::base::GenericParam.

Definition at line 214 of file GenericParam.h.

◆ getValue() [5/5]

template<typename T >
std::string ompl::base::SpecificParam< T >::getValue ( ) const
inlineoverridevirtual

Retrieve the value of the parameter, as a string.

Implements ompl::base::GenericParam.

Definition at line 178 of file GenericParam.h.

◆ lexical_cast() [1/13]

template<typename T >
T ompl::base::SpecificParam< T >::lexical_cast ( const std::string &  value) const
protected

Helper function to convert strings into objects of type T.

Supported types are: bool, int, long, long long, unsigned int, unsigned long, unsigned long long, float, double, long double, char, std::string.

◆ lexical_cast() [2/13]

bool ompl::base::SpecificParam< bool >::lexical_cast ( const std::string &  value) const
protected

Definition at line 46 of file GenericParam.cpp.

◆ lexical_cast() [3/13]

int ompl::base::SpecificParam< int >::lexical_cast ( const std::string &  value) const
protected

Definition at line 52 of file GenericParam.cpp.

◆ lexical_cast() [4/13]

long ompl::base::SpecificParam< long >::lexical_cast ( const std::string &  value) const
protected

Definition at line 57 of file GenericParam.cpp.

◆ lexical_cast() [5/13]

long long ompl::base::SpecificParam< longlong >::lexical_cast ( const std::string &  value) const
protected

Definition at line 62 of file GenericParam.cpp.

◆ lexical_cast() [6/13]

unsigned int ompl::base::SpecificParam< unsignedint >::lexical_cast ( const std::string &  value) const
protected

Definition at line 67 of file GenericParam.cpp.

◆ lexical_cast() [7/13]

unsigned long ompl::base::SpecificParam< unsignedlong >::lexical_cast ( const std::string &  value) const
protected

Definition at line 72 of file GenericParam.cpp.

◆ lexical_cast() [8/13]

unsigned long long ompl::base::SpecificParam< unsignedlonglong >::lexical_cast ( const std::string &  value) const
protected

Definition at line 77 of file GenericParam.cpp.

◆ lexical_cast() [9/13]

float ompl::base::SpecificParam< float >::lexical_cast ( const std::string &  value) const
protected

Definition at line 82 of file GenericParam.cpp.

◆ lexical_cast() [10/13]

double ompl::base::SpecificParam< double >::lexical_cast ( const std::string &  value) const
protected

Definition at line 87 of file GenericParam.cpp.

◆ lexical_cast() [11/13]

long double ompl::base::SpecificParam< longdouble >::lexical_cast ( const std::string &  value) const
protected

Definition at line 92 of file GenericParam.cpp.

◆ lexical_cast() [12/13]

char ompl::base::SpecificParam< char >::lexical_cast ( const std::string &  value) const
protected

Definition at line 97 of file GenericParam.cpp.

◆ lexical_cast() [13/13]

std::string ompl::base::SpecificParam< std::string >::lexical_cast ( const std::string &  value) const
protected

Definition at line 106 of file GenericParam.cpp.

◆ setValue()

template<typename T >
bool ompl::base::SpecificParam< T >::setValue ( const std::string &  value)
inlineoverridevirtual

Set the value of the parameter. The value is taken in as a string, but converted to the type of that parameter.

Implements ompl::base::GenericParam.

Definition at line 157 of file GenericParam.h.

Member Data Documentation

◆ getter_

template<typename T >
GetterFn ompl::base::SpecificParam< T >::getter_
protected

The getter function for this parameter.

Definition at line 195 of file GenericParam.h.

◆ setter_

template<typename T >
SetterFn ompl::base::SpecificParam< T >::setter_
protected

The setter function for this parameter.

Definition at line 192 of file GenericParam.h.


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