6#ifndef IFW_CORE_UTILS_PARAMETER_HPP_
7#define IFW_CORE_UTILS_PARAMETER_HPP_
11#include <boost/lexical_cast.hpp>
13#include <ifw/fnd/defs/dataType.hpp>
31 const std::string value,
32 const std::string comment =
"");
38 const std::string comment =
"") {
63 bool NameDefined(
const std::string& name,
const bool tolerant =
false)
const;
66 bool MatchName(
const std::string& name_regex)
const;
69 const std::string&
GetName()
const;
82 const ifw::fnd::datatype::DataType data_type =
83 ifw::fnd::datatype::DataType::UNSPECIFIED);
87 const ifw::fnd::datatype::DataType data_type =
88 ifw::fnd::datatype::DataType::UNSPECIFIED);
108 template <
class TYPE>
116 template <
class TYPE>
161 ifw::fnd::datatype::DataType
m_data_type{ifw::fnd::datatype::DataType::UNSPECIFIED};
Class to handle information for one parameter.
Definition parameter.hpp:24
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:124
const std::string & GetLowLevelName() const
Return the low level parameter name.
Definition parameter.cpp:82
bool NoValue() const
Return true if no value has been set for the parameter.
Definition parameter.cpp:149
Parameter()
Definition parameter.cpp:12
Parameter & SetLowLevelName(const std::string name)
Set the low level parameter name.
Definition parameter.cpp:65
const std::string & GetComment() const
Get parameter comment.
Definition parameter.cpp:154
int64_t GetValueAsInt64() const
Return value as 64 bit integer. If string representaion of value is not a 64 bit integer,...
Definition parameter.cpp:188
Parameter(const std::string name, const TYPE &value, const std::string comment="")
Constructor settting internal members.
Definition parameter.hpp:36
Parameter & SetComment(const std::string &comment)
Set parameter comment.
Definition parameter.cpp:177
ifw::fnd::datatype::DataType m_data_type
Definition parameter.hpp:161
std::string ToString() const
Print out parameter.
Definition parameter.cpp:159
void GetValue(TYPE &value) const
Get parameter value as its native data type.
Definition parameter.hpp:109
Parameter & SetValue(TYPE value)
Set parameter value as its native data type.
Definition parameter.hpp:92
bool NameDefined(const std::string &name, const bool tolerant=false) const
Check if a given name is defined in the object.
Definition parameter.cpp:100
bool GetValueAsBool() const
Return value as a boolean. If string representaion of value is not a boolean, the behaviour is undefi...
Definition parameter.cpp:183
const std::string & GetValue() const
Get parameter value as a string.
Definition parameter.cpp:139
std::string m_meta_name
Definition parameter.hpp:156
TYPE GetValue() const
Get parameter value as its native data type.
Definition parameter.hpp:117
double GetValueAsDouble() const
Return value as a double. If string representaion of value is not a double, the behaviour is undefine...
Definition parameter.cpp:198
std::string m_name
Definition parameter.hpp:154
const std::string & GetMetaName() const
Return Meta-data parameter name.
Definition parameter.cpp:87
std::string m_low_level_name
Definition parameter.hpp:155
ifw::fnd::datatype::DataType GetDataType() const
Return the data type for the parameter, if defined.
Definition parameter.cpp:203
std::string m_comment
Definition parameter.hpp:158
Parameter & SetMetaName(const std::string name)
Set Meta-data parameter name.
Definition parameter.cpp:71
Parameter & SetValue(const std::string &value, const ifw::fnd::datatype::DataType data_type=ifw::fnd::datatype::DataType::UNSPECIFIED)
Set parameter value.
Definition parameter.cpp:92
Parameter & SetName(const std::string name)
Set parameter name.
Definition parameter.cpp:59
~Parameter()
Definition parameter.cpp:31
std::string GetNames() const
Generate a string summarising the three possible names (<name 1>/<name 2>/<name 3>).
Definition parameter.cpp:119
Parameter & Clear()
Clear the internal members.
Definition parameter.cpp:41
std::string m_value
Definition parameter.hpp:157
Parameter & operator=(const Parameter &source)
Copy operator.
Definition parameter.cpp:35
std::string m_no_value
Definition parameter.hpp:159
int64_t GetValueAsInt() const
Return value as integer. If string representaion of value is not an integer, the behaviour is undefin...
Definition parameter.cpp:193
const std::string & GetName() const
Return parameter name.
Definition parameter.cpp:77
log4cplus::Logger & Logger()
Definition tools.cpp:19
void Convert(const std::string &str_value, std::string &native_value)
Handle case: Conversion of std::string to std::string.
Definition conversion.cpp:52
std::string NbToStr(const TYPE number, const std::string &format="")
Convert the given value to a string representation.
Definition conversion.hpp:38
Definition parameter.hpp:19
const std::string NO_VALUE
Definition parameter.hpp:21