ifw  0.0.1-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Parameter.hpp
Go to the documentation of this file.
1 
6 #ifndef IFW_CTD_FILE_PARAMETER_HPP_
7 #define IFW_CTD_FILE_PARAMETER_HPP_
8 
9 #include <string>
10 
11 #include "ctd/defines/defines.hpp"
12 #include "ctd/conversion/conversion.hpp"
13 
14 
15 namespace ctd {
16 namespace file {
17 
19 class Parameter {
20 public:
21 
22  static const std::string NO_VALUE;
23 
24  Parameter();
25 
27  Parameter(const std::string name,
28  const std::string value,
29  const std::string comment = "");
30 
32  Parameter(const Parameter& source);
33 
34  ~Parameter();
35 
37  Parameter& Clear();
38 
40  Parameter& SetName(const std::string name);
41 
43  std::string GetName() const;
44 
46  Parameter& SetValue(const std::string value);
47 
49  std::string GetValueAsString() const;
50 
52  bool NoValue() const;
53 
55  template <class TYPE> void GetValue(TYPE& value) const {
56  RAD_LOG_TRACE();
57 
59  }
60 
62  Parameter& SetComment(const std::string& comment);
63 
65  std::string GetComment() const;
66 
68  std::string Print() const;
69 
72 
73 protected:
74  std::string m_name;
75  std::string m_value;
76  std::string m_comment;
77 
78 private:
79  void _Copy(const Parameter& source);
80 };
81 
82 } // namespace Parameter
83 } // namespace ctd
84 
85 #endif // !IFW_CTD_FILE_PARAMETER_HPP_
std::string m_comment
Definition: Parameter.hpp:76
double value
Definition: easylogging++.h:814
void Convert(const std::string &value, ctd::defines::DataType data_type, Value &native_value)
Convert a value represented as a string into its &#39;native type&#39;. Data type given.
Definition: conversion.cpp:52
bool NoValue() const
Return true if no value has been set for the parameter.
Definition: Parameter.cpp:112
~Parameter()
Definition: Parameter.cpp:41
Parameter & SetComment(const std::string &comment)
Set parameter comment.
Definition: Parameter.cpp:146
Parameter()
Definition: Parameter.cpp:16
std::string m_value
Definition: Parameter.hpp:75
Class to handle information for one parameter.
Definition: Parameter.hpp:19
Parameter & SetName(const std::string name)
Set parameter name.
Definition: Parameter.cpp:76
std::string Print() const
Print out parameter.
Definition: Parameter.cpp:126
static const std::string NO_VALUE
Definition: Parameter.hpp:22
std::string GetComment() const
Get parameter comment.
Definition: Parameter.cpp:119
std::string GetName() const
Return parameter name.
Definition: Parameter.cpp:85
Parameter & Clear()
Clear the internal members.
Definition: Parameter.cpp:56
source
Definition: radgen_tool.py:35
std::string GetValueAsString() const
Get parameter value as a string.
Definition: Parameter.cpp:101
Parameter & SetValue(const std::string value)
Set parameter value.
Definition: Parameter.cpp:92
#define RAD_LOG_TRACE()
Definition: Logger.hpp:319
void GetValue(TYPE &value) const
Get parameter value as its native data type.
Definition: Parameter.hpp:55
std::string m_name
Definition: Parameter.hpp:74
Parameter & operator=(const Parameter &source)
Copy operator.
Definition: Parameter.cpp:47
optional string name
Definition: topics.proto:50