A parameter class.
More...
#include <sdf/sdf.hh>
Public Member Functions |
| | Param (const std::string &_key, const std::string &_typeName, const std::string &_default, bool _required, const std::string &_description="") |
| | Constructor.
|
| virtual | ~Param () |
| | Destructor.
|
| Param * | Clone () const |
| | Clone the parameter.
|
| template<typename T > |
| bool | Get (T &_value) |
| | Get the value of the parameter.
|
| std::string | GetAsString () const |
| | Get the value as a string.
|
| template<typename T > |
| bool | GetDefault (T &_value) |
| | Get the default value of the parameter.
|
| std::string | GetDefaultAsString () const |
| | Get the default value as a string.
|
| std::string | GetDescription () const |
| | Get the description of the parameter.
|
| const std::string & | GetKey () const |
| | Get the key value.
|
| bool | GetRequired () const |
| | Return whether the parameter is required.
|
| bool | GetSet () const |
| | Return true if the parameter has been set.
|
| const std::type_info & | GetType () const |
| | Get the type of the value stored.
|
| const std::string & | GetTypeName () const |
| | Get the type name value.
|
| Param & | operator= (const Param &_param) |
| | Equal operator.
|
| void | Reset () |
| | Reset the parameter to the default value.
|
| template<typename T > |
| bool | Set (const T &_value) |
| | Set the parameter's value.
|
| void | SetDescription (const std::string &_desc) |
| | Set the description of the parameter.
|
| bool | SetFromString (const std::string &_value) |
| | Set the parameter value from a string.
|
| template<typename T > |
| void | SetUpdateFunc (T _updateFunc) |
| | Set the update function.
|
| void | Update () |
| | Set the parameter's value using the updateFunc.
|
Protected Attributes |
| ParamVariant | defaultValue |
| | This parameter's default value.
|
| ParamVariant | value |
| | This parameter's value.
|
Friends |
| std::ostream & | operator<< (std::ostream &_out, const Param &_p) |
| | Ostream operator.
|
Detailed Description
Constructor & Destructor Documentation
| sdf::Param::Param |
( |
const std::string & |
_key, |
|
|
const std::string & |
_typeName, |
|
|
const std::string & |
_default, |
|
|
bool |
_required, |
|
|
const std::string & |
_description = "" |
|
) |
| |
Constructor.
- Parameters
-
| [in] | _key | Key for the parameter. |
| [in] | _typeName | String name for the value type (double, int,...). |
| [in] | _default | Default value. |
| [in] | _required | True if the parameter is required to be set. |
| [in] | _description | Description of the parameter. |
| virtual sdf::Param::~Param |
( |
| ) |
|
|
virtual |
Member Function Documentation
| Param* sdf::Param::Clone |
( |
| ) |
const |
Clone the parameter.
- Returns
- A new parameter that is the clone of this.
template<typename T >
| bool sdf::Param::Get |
( |
T & |
_value | ) |
|
|
inline |
Get the value of the parameter.
- Parameters
-
| [out] | _value | The value of the parameter. |
- Returns
- True if parameter was successfully cast to the value type passed in.
References sdferr.
Referenced by sdf::Element::Get().
| std::string sdf::Param::GetAsString |
( |
| ) |
const |
Get the value as a string.
- Returns
- String containing the value of the parameter.
template<typename T >
| bool sdf::Param::GetDefault |
( |
T & |
_value | ) |
|
|
inline |
Get the default value of the parameter.
- Parameters
-
| [out] | _value | The default value of the parameter. |
- Returns
- True if parameter was successfully cast to the value type passed in.
References sdferr.
| std::string sdf::Param::GetDefaultAsString |
( |
| ) |
const |
Get the default value as a string.
- Returns
- String containing the default value of the parameter.
| std::string sdf::Param::GetDescription |
( |
| ) |
const |
Get the description of the parameter.
- Returns
- The description of the parameter.
| const std::string& sdf::Param::GetKey |
( |
| ) |
const |
|
inline |
Get the key value.
- Returns
- The key.
| bool sdf::Param::GetRequired |
( |
| ) |
const |
|
inline |
Return whether the parameter is required.
- Returns
- True if the parameter is required.
| bool sdf::Param::GetSet |
( |
| ) |
const |
|
inline |
Return true if the parameter has been set.
- Returns
- True if the parameter has been set.
| const std::type_info& sdf::Param::GetType |
( |
| ) |
const |
Get the type of the value stored.
- Returns
- The std::type_info.
| const std::string& sdf::Param::GetTypeName |
( |
| ) |
const |
Get the type name value.
- Returns
- The type name.
| Param& sdf::Param::operator= |
( |
const Param & |
_param | ) |
|
|
inline |
Equal operator.
Set's the value and default value from the provided Param.
- Parameters
-
| [in] | _param | The parameter to set values from. |
- Returns
- *This
References defaultValue, and value.
| void sdf::Param::Reset |
( |
| ) |
|
Reset the parameter to the default value.
template<typename T >
| bool sdf::Param::Set |
( |
const T & |
_value | ) |
|
|
inline |
Set the parameter's value.
The passed in value must conform to the boost::lexical_cast spec. This means the value must have an input and output stream operator.
- Parameters
-
| [in] | _value | The value to set the parameter to. |
- Returns
- True if the value was successfully set.
References sdferr.
| void sdf::Param::SetDescription |
( |
const std::string & |
_desc | ) |
|
Set the description of the parameter.
- Parameters
-
| [in] | _desc | New description for the parameter. |
| bool sdf::Param::SetFromString |
( |
const std::string & |
_value | ) |
|
Set the parameter value from a string.
- Parameters
-
| [in] | _value | New value for the parameter in string form. |
template<typename T >
| void sdf::Param::SetUpdateFunc |
( |
T |
_updateFunc | ) |
|
|
inline |
Set the update function.
The updateFunc will be used to set the parameter's value when Param::Update is called.
- Parameters
-
| [in] | _updateFunc | Function pointer to an update function. |
| void sdf::Param::Update |
( |
| ) |
|
Friends And Related Function Documentation
| std::ostream& operator<< |
( |
std::ostream & |
_out, |
|
|
const Param & |
_p |
|
) |
| |
|
friend |
Ostream operator.
Outputs the parameter's value.
- Parameters
-
| [in] | _out | Output stream. |
| [in] | _p | The parameter to output. |
- Returns
- The output stream.
Member Data Documentation
| ParamVariant sdf::Param::defaultValue |
|
protected |
This parameter's default value.
Referenced by operator=().
| ParamVariant sdf::Param::value |
|
protected |
The documentation for this class was generated from the following file: