ifw-core 7.0.0
 
Loading...
Searching...
No Matches
ifw::core::utils::param::Parameter Class Reference

Class to handle information for one parameter. More...

#include <parameter.hpp>

Public Member Functions

 Parameter ()
 
 Parameter (const std::string name, const std::string value, const std::string comment="")
 Constructor settting internal members.
 
template<class TYPE>
 Parameter (const std::string name, const TYPE &value, const std::string comment="")
 Constructor settting internal members.
 
 Parameter (const Parameter &source)
 Copy constructor.
 
 ~Parameter ()
 
ParameterClear ()
 Clear the internal members.
 
ParameterSetName (const std::string name)
 Set parameter name.
 
ParameterSetLowLevelName (const std::string name)
 Set the low level parameter name.
 
ParameterSetMetaName (const std::string name)
 Set Meta-data parameter name.
 
bool NameDefined (const std::string &name, const bool tolerant=false) const
 Check if a given name is defined in the object.
 
bool MatchName (const std::string &name_regex) const
 Check if a given name is defined in the object; name specified as a regex.
 
const std::string & GetName () const
 Return parameter name.
 
const std::string & GetLowLevelName () const
 Return the low level parameter name.
 
const std::string & GetMetaName () const
 Return Meta-data parameter name.
 
std::string GetNames () const
 Generate a string summarising the three possible names (<name 1>/<name 2>/<name 3>).
 
ParameterSetValue (const std::string &value, const ifw::fnd::datatype::DataType data_type=ifw::fnd::datatype::DataType::UNSPECIFIED)
 Set parameter value.
 
ParameterSetValue (const char *value, const ifw::fnd::datatype::DataType data_type=ifw::fnd::datatype::DataType::UNSPECIFIED)
 Set parameter value.
 
template<class TYPE>
ParameterSetValue (TYPE value)
 Set parameter value as its native data type.
 
const std::string & GetValue () const
 Get parameter value as a string.
 
ifw::fnd::datatype::DataType GetDataType () const
 Return the data type for the parameter, if defined.
 
bool NoValue () const
 Return true if no value has been set for the parameter.
 
template<class TYPE>
void GetValue (TYPE &value) const
 Get parameter value as its native data type.
 
template<class TYPE>
TYPE GetValue () const
 Get parameter value as its native data type.
 
bool GetValueAsBool () const
 Return value as a boolean. If string representaion of value is not a boolean, the behaviour is undefined.
 
int64_t GetValueAsInt () const
 Return value as integer. If string representaion of value is not an integer, the behaviour is undefined.
 
int64_t GetValueAsInt64 () const
 Return value as 64 bit integer. If string representaion of value is not a 64 bit integer, the behaviour is undefined.
 
double GetValueAsDouble () const
 Return value as a double. If string representaion of value is not a double, the behaviour is undefined.
 
ParameterSetComment (const std::string &comment)
 Set parameter comment.
 
const std::string & GetComment () const
 Get parameter comment.
 
std::string ToString () const
 Print out parameter.
 
Parameteroperator= (const Parameter &source)
 Copy operator.
 

Protected Attributes

std::string m_name
 
std::string m_low_level_name
 
std::string m_meta_name
 
std::string m_value
 
std::string m_comment
 
std::string m_no_value
 
ifw::fnd::datatype::DataType m_data_type {ifw::fnd::datatype::DataType::UNSPECIFIED}
 

Detailed Description

Class to handle information for one parameter.

Constructor & Destructor Documentation

◆ Parameter() [1/4]

ifw::core::utils::param::Parameter::Parameter ( )

◆ Parameter() [2/4]

ifw::core::utils::param::Parameter::Parameter ( const std::string name,
const std::string value,
const std::string comment = "" )

Constructor settting internal members.

◆ Parameter() [3/4]

template<class TYPE>
ifw::core::utils::param::Parameter::Parameter ( const std::string name,
const TYPE & value,
const std::string comment = "" )
inline

Constructor settting internal members.

◆ Parameter() [4/4]

ifw::core::utils::param::Parameter::Parameter ( const Parameter & source)

Copy constructor.

◆ ~Parameter()

ifw::core::utils::param::Parameter::~Parameter ( )

Member Function Documentation

◆ Clear()

Parameter & ifw::core::utils::param::Parameter::Clear ( )

Clear the internal members.

◆ GetComment()

const std::string & ifw::core::utils::param::Parameter::GetComment ( ) const

Get parameter comment.

◆ GetDataType()

ifw::fnd::datatype::DataType ifw::core::utils::param::Parameter::GetDataType ( ) const

Return the data type for the parameter, if defined.

◆ GetLowLevelName()

const std::string & ifw::core::utils::param::Parameter::GetLowLevelName ( ) const

Return the low level parameter name.

◆ GetMetaName()

const std::string & ifw::core::utils::param::Parameter::GetMetaName ( ) const

Return Meta-data parameter name.

◆ GetName()

const std::string & ifw::core::utils::param::Parameter::GetName ( ) const

Return parameter name.

◆ GetNames()

std::string ifw::core::utils::param::Parameter::GetNames ( ) const

Generate a string summarising the three possible names (<name 1>/<name 2>/<name 3>).

◆ GetValue() [1/3]

const std::string & ifw::core::utils::param::Parameter::GetValue ( ) const

Get parameter value as a string.

◆ GetValue() [2/3]

template<class TYPE>
TYPE ifw::core::utils::param::Parameter::GetValue ( ) const
inline

Get parameter value as its native data type.

◆ GetValue() [3/3]

template<class TYPE>
void ifw::core::utils::param::Parameter::GetValue ( TYPE & value) const
inline

Get parameter value as its native data type.

◆ GetValueAsBool()

bool ifw::core::utils::param::Parameter::GetValueAsBool ( ) const

Return value as a boolean. If string representaion of value is not a boolean, the behaviour is undefined.

◆ GetValueAsDouble()

double ifw::core::utils::param::Parameter::GetValueAsDouble ( ) const

Return value as a double. If string representaion of value is not a double, the behaviour is undefined.

◆ GetValueAsInt()

int64_t ifw::core::utils::param::Parameter::GetValueAsInt ( ) const

Return value as integer. If string representaion of value is not an integer, the behaviour is undefined.

◆ GetValueAsInt64()

int64_t ifw::core::utils::param::Parameter::GetValueAsInt64 ( ) const

Return value as 64 bit integer. If string representaion of value is not a 64 bit integer, the behaviour is undefined.

◆ MatchName()

bool ifw::core::utils::param::Parameter::MatchName ( const std::string & name_regex) const

Check if a given name is defined in the object; name specified as a regex.

◆ NameDefined()

bool ifw::core::utils::param::Parameter::NameDefined ( const std::string & name,
const bool tolerant = false ) const

Check if a given name is defined in the object.

◆ NoValue()

bool ifw::core::utils::param::Parameter::NoValue ( ) const

Return true if no value has been set for the parameter.

◆ operator=()

Parameter & ifw::core::utils::param::Parameter::operator= ( const Parameter & source)

Copy operator.

◆ SetComment()

Parameter & ifw::core::utils::param::Parameter::SetComment ( const std::string & comment)

Set parameter comment.

◆ SetLowLevelName()

Parameter & ifw::core::utils::param::Parameter::SetLowLevelName ( const std::string name)

Set the low level parameter name.

◆ SetMetaName()

Parameter & ifw::core::utils::param::Parameter::SetMetaName ( const std::string name)

Set Meta-data parameter name.

◆ SetName()

Parameter & ifw::core::utils::param::Parameter::SetName ( const std::string name)

Set parameter name.

◆ SetValue() [1/3]

Parameter & ifw::core::utils::param::Parameter::SetValue ( const char * value,
const ifw::fnd::datatype::DataType data_type = ifw::fnd::datatype::DataType::UNSPECIFIED )

Set parameter value.

◆ SetValue() [2/3]

Parameter & ifw::core::utils::param::Parameter::SetValue ( const std::string & value,
const ifw::fnd::datatype::DataType data_type = ifw::fnd::datatype::DataType::UNSPECIFIED )

Set parameter value.

◆ SetValue() [3/3]

template<class TYPE>
Parameter & ifw::core::utils::param::Parameter::SetValue ( TYPE value)
inline

Set parameter value as its native data type.

◆ ToString()

std::string ifw::core::utils::param::Parameter::ToString ( ) const

Print out parameter.

Member Data Documentation

◆ m_comment

std::string ifw::core::utils::param::Parameter::m_comment
protected

◆ m_data_type

ifw::fnd::datatype::DataType ifw::core::utils::param::Parameter::m_data_type {ifw::fnd::datatype::DataType::UNSPECIFIED}
protected

◆ m_low_level_name

std::string ifw::core::utils::param::Parameter::m_low_level_name
protected

◆ m_meta_name

std::string ifw::core::utils::param::Parameter::m_meta_name
protected

◆ m_name

std::string ifw::core::utils::param::Parameter::m_name
protected

◆ m_no_value

std::string ifw::core::utils::param::Parameter::m_no_value
protected

◆ m_value

std::string ifw::core::utils::param::Parameter::m_value
protected

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