A parameter class.
More...
#include <sdf/sdf.hh>
◆ Param()
sdf::v9::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. |
- Exceptions
-
sdf::AssertionInternalError | if an invalid type is given. |
◆ ~Param()
virtual sdf::v9::Param::~Param |
( |
| ) |
|
|
virtual |
◆ Clone()
ParamPtr sdf::v9::Param::Clone |
( |
| ) |
const |
Clone the parameter.
- Returns
- A new parameter that is the clone of this.
◆ Get()
template<typename T >
bool sdf::v9::Param::Get |
( |
T & |
_value | ) |
const |
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.
◆ GetAny()
bool sdf::v9::Param::GetAny |
( |
std::any & |
_anyVal | ) |
const |
Get the value of the parameter as a std::any.
- Parameters
-
[out] | _anyVal | The std::any object to set. |
- Returns
- True if successfully fetched _anyVal, false otherwise.
◆ GetAsString()
std::string sdf::v9::Param::GetAsString |
( |
| ) |
const |
Get the value as a string.
- Returns
- String containing the value of the parameter.
◆ GetDefault()
template<typename T >
bool sdf::v9::Param::GetDefault |
( |
T & |
_value | ) |
const |
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.
◆ GetDefaultAsString()
std::string sdf::v9::Param::GetDefaultAsString |
( |
| ) |
const |
Get the default value as a string.
- Returns
- String containing the default value of the parameter.
◆ GetDescription()
std::string sdf::v9::Param::GetDescription |
( |
| ) |
const |
Get the description of the parameter.
- Returns
- The description of the parameter.
◆ GetKey()
const std::string& sdf::v9::Param::GetKey |
( |
| ) |
const |
Get the key value.
- Returns
- The key.
◆ GetRequired()
bool sdf::v9::Param::GetRequired |
( |
| ) |
const |
Return whether the parameter is required.
- Returns
- True if the parameter is required.
◆ GetSet()
bool sdf::v9::Param::GetSet |
( |
| ) |
const |
Return true if the parameter has been set.
- Returns
- True if the parameter has been set.
◆ GetTypeName()
const std::string& sdf::v9::Param::GetTypeName |
( |
| ) |
const |
Get the type name value.
- Returns
- The type name.
◆ IsType()
template<typename Type >
bool sdf::v9::Param::IsType |
( |
| ) |
const |
Return true if the param is a particular type.
- Returns
- True if the type held by this Param matches the Type template parameter.
◆ operator=()
Param& sdf::v9::Param::operator= |
( |
const Param & |
_param | ) |
|
Equal operator.
Set's the value and default value from the provided Param.
- Parameters
-
[in] | _param | The parameter to set values from. |
- Returns
- *This
◆ Reset()
void sdf::v9::Param::Reset |
( |
| ) |
|
Reset the parameter to the default value.
◆ Set()
template<typename T >
bool sdf::v9::Param::Set |
( |
const T & |
_value | ) |
|
Set the parameter's value.
The passed in value 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.
◆ SetDescription()
void sdf::v9::Param::SetDescription |
( |
const std::string & |
_desc | ) |
|
Set the description of the parameter.
- Parameters
-
[in] | _desc | New description for the parameter. |
◆ SetFromString()
bool sdf::v9::Param::SetFromString |
( |
const std::string & |
_value | ) |
|
Set the parameter value from a string.
- Parameters
-
[in] | _value | New value for the parameter in string form. |
◆ SetUpdateFunc()
template<typename T >
void sdf::v9::Param::SetUpdateFunc |
( |
T |
_updateFunc | ) |
|
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. |
◆ Update()
void sdf::v9::Param::Update |
( |
| ) |
|
◆ operator<<
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.
The documentation for this class was generated from the following file: