MeVisLab Toolbox Reference
mlObjMgrAttribute_Message.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef ML_OBJ_MGR_ATTRIBUTE_MESSAGE_H
14 #define ML_OBJ_MGR_ATTRIBUTE_MESSAGE_H
15 
16 
18 
19 #include "MLObjMgrSystem.h"
20 
21 #include "mlObjMgrDataType.h"
22 
23 
24 ML_START_NAMESPACE
25 
28  template <typename T>
29  class omMessageT : public std::basic_string<T>
30  {
31  typedef std::basic_string<T> inherited;
32 
33  public:
34 
36  omMessageT() : inherited() {}
37 
39  omMessageT(const omMessageT &msg) : inherited(msg) {}
40 
42  explicit omMessageT(const char *str) : inherited(str) {}
43 
45  explicit omMessageT(const std::basic_string<T> &str) : inherited(str) {}
46 
49  ((inherited *)this)->assign(msg);
50 
51  return *this;
52  }
53 
55  bool operator ==(const omMessageT &) const {
56  return false;
57  }
58  bool operator !=(const omMessageT &) const {
59  return true;
60  }
61 
63  //operator const omMessageT &() const {
64  // return *this;
65  //}
66 
68  operator const std::basic_string<T> &() const {
69  return *this;
70  }
71  };
72 
75 
78  class MLOBJMGR_EXPORT omData_omMessage : public omDataType
79  {
81 
82  typedef omDataType inherited;
83 
84  protected:
85 
87 
88  public:
89 
91  omData_omMessage(const omData_omMessage &msg) : omDataType(), _value(msg._value) {}
92  omData_omMessage(const omMessage &value) : omDataType(), _value(value) {}
93 
94  inline omData_omMessage &operator =(const omData_omMessage &msg) {
95  assign(msg._value); return *this;
96  }
97  inline omData_omMessage &operator =(const omMessage &value) {
98  assign(value); return *this;
99  }
100  virtual void assign(const omMessage &value) {
101  _value = value;
102  }
103 
104  operator const omMessage &() const {
105  return _value;
106  }
107 
108  bool operator ==(const omMessage &value) const {
109  return _value == value;
110  }
111  bool operator !=(const omMessage &value) const {
112  return _value != value;
113  }
114 
115  std::string getStringValue() const override {
116  return _value;
117  }
118  void setStringValue(const std::string &value) override {
119  assign((omMessage)value);
120  }
121  };
122 
125  class MLOBJMGR_EXPORT omAttribute_omMessage : public omData_omMessage
126  {
128 
129  typedef omData_omMessage inherited;
130 
131  public:
132 
134  omAttribute_omMessage(const omMessage &value) : inherited(value) {}
135  ~omAttribute_omMessage() override = default;
136 
137  void assign(const omMessage &value) override;
138  };
139 
140 ML_END_NAMESPACE
141 
142 #endif // __mlObjMgrAttribute_Message_H
~omAttribute_omMessage() override=default
omAttribute_omMessage(const omMessage &value)
void assign(const omMessage &value) override
Base class for data.
Data type for messages.
omData_omMessage(const omData_omMessage &msg)
std::string getStringValue() const override
Get value of data type as string.
void setStringValue(const std::string &value) override
Set data type value from string.
virtual void assign(const omMessage &value)
omData_omMessage(const omMessage &value)
omMessageT(const omMessageT &msg)
Copy Constructor.
omMessageT & operator=(const omMessageT &msg)
Assignment operator for omMessage.
omMessageT(const std::basic_string< T > &str)
Constructor from std::basic_string argument.
omMessageT(const char *str)
Constructor from char * argument.
omMessageT()
Standard constructor.
#define ML_CLASS_HEADER(className)
Same like ML_CLASS_HEADER_EXPORTED with a non existing export symbol.
omMessageT< char > omMessage
Define the normally used type from template type with normal string base char type.
bool operator==(const Tmat2< DT > &a, const Tmat2< DT > &b)
a == b ? Return true if yes.
Definition: mlMatrix2.h:425
bool operator!=(const Tmat2< DT > &a, const Tmat2< DT > &b)
a != b ? Return true if yes.
Definition: mlMatrix2.h:433