7#ifndef IFW_CORE_UTILS_PARAMETER_HPP_
8#define IFW_CORE_UTILS_PARAMETER_HPP_
12#include <boost/lexical_cast.hpp>
14#include <ifw/fnd/defs/dataType.hpp>
32 const std::string value,
33 const std::string comment =
"");
39 const std::string comment =
"") {
64 bool NameDefined(
const std::string& name,
const bool tolerant =
false)
const;
67 bool MatchName(
const std::string& name_regex)
const;
70 const std::string&
GetName()
const;
83 const ifw::fnd::datatype::DataType data_type =
84 ifw::fnd::datatype::DataType::UNSPECIFIED);
88 const ifw::fnd::datatype::DataType data_type =
89 ifw::fnd::datatype::DataType::UNSPECIFIED);
100 const std::string&
GetValue()
const;
109 template <
class TYPE>
117 template <
class TYPE>
162 ifw::fnd::datatype::DataType
m_data_type{ifw::fnd::datatype::DataType::UNSPECIFIED};
Class to handle information for one parameter.
Definition parameter.hpp:25
bool MatchName(const std::string &name_regex) const
Check if a given name is defined in the object; name specified as a regex.
Definition parameter.cpp:125
const std::string & GetLowLevelName() const
Return the low level parameter name.
Definition parameter.cpp:83
bool NoValue() const
Return true if no value has been set for the parameter.
Definition parameter.cpp:150
Parameter()
Definition parameter.cpp:13
Parameter & SetLowLevelName(const std::string name)
Set the low level parameter name.
Definition parameter.cpp:66
const std::string & GetComment() const
Get parameter comment.
Definition parameter.cpp:155
int64_t GetValueAsInt64() const
Return value as 64 bit integer. If string representaion of value is not a 64 bit integer,...
Definition parameter.cpp:189
Parameter(const std::string name, const TYPE &value, const std::string comment="")
Constructor settting internal members.
Definition parameter.hpp:37
Parameter & SetComment(const std::string &comment)
Set parameter comment.
Definition parameter.cpp:178
ifw::fnd::datatype::DataType m_data_type
Definition parameter.hpp:162
std::string ToString() const
Print out parameter.
Definition parameter.cpp:160
void GetValue(TYPE &value) const
Get parameter value as its native data type.
Definition parameter.hpp:110
Parameter & SetValue(TYPE value)
Set parameter value as its native data type.
Definition parameter.hpp:93
bool NameDefined(const std::string &name, const bool tolerant=false) const
Check if a given name is defined in the object.
Definition parameter.cpp:101
bool GetValueAsBool() const
Return value as a boolean. If string representaion of value is not a boolean, the behaviour is undefi...
Definition parameter.cpp:184
const std::string & GetValue() const
Get parameter value as a string.
Definition parameter.cpp:140
std::string m_meta_name
Definition parameter.hpp:157
TYPE GetValue() const
Get parameter value as its native data type.
Definition parameter.hpp:118
double GetValueAsDouble() const
Return value as a double. If string representaion of value is not a double, the behaviour is undefine...
Definition parameter.cpp:199
std::string m_name
Definition parameter.hpp:155
const std::string & GetMetaName() const
Return Meta-data parameter name.
Definition parameter.cpp:88
std::string m_low_level_name
Definition parameter.hpp:156
ifw::fnd::datatype::DataType GetDataType() const
Return the data type for the parameter, if defined.
Definition parameter.cpp:204
std::string m_comment
Definition parameter.hpp:159
Parameter & SetMetaName(const std::string name)
Set Meta-data parameter name.
Definition parameter.cpp:72
Parameter & SetValue(const std::string &value, const ifw::fnd::datatype::DataType data_type=ifw::fnd::datatype::DataType::UNSPECIFIED)
Set parameter value.
Definition parameter.cpp:93
Parameter & SetName(const std::string name)
Set parameter name.
Definition parameter.cpp:60
~Parameter()
Definition parameter.cpp:32
std::string GetNames() const
Generate a string summarising the three possible names (<name 1>/<name 2>/<name 3>).
Definition parameter.cpp:120
Parameter & Clear()
Clear the internal members.
Definition parameter.cpp:42
std::string m_value
Definition parameter.hpp:158
Parameter & operator=(const Parameter &source)
Copy operator.
Definition parameter.cpp:36
std::string m_no_value
Definition parameter.hpp:160
int64_t GetValueAsInt() const
Return value as integer. If string representaion of value is not an integer, the behaviour is undefin...
Definition parameter.cpp:194
const std::string & GetName() const
Return parameter name.
Definition parameter.cpp:78
log4cplus::Logger & Logger()
Definition tools.cpp:20
void Convert(const std::string &str_value, std::string &native_value)
Handle case: Conversion of std::string to std::string.
Definition conversion.cpp:53
std::string NbToStr(const TYPE number, const std::string &format="")
Convert the given value to a string representation.
Definition conversion.hpp:39
Definition parameter.hpp:20
const std::string NO_VALUE
Definition parameter.hpp:22