MeVisLabToolboxReference
MeVisLab/Standard/Sources/ML/MLObjMgr/ObjMgr/mlObjMgrAttribute_Message.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //-------------------------------------------------------------------------
00005 
00010 //-------------------------------------------------------------------------
00011 
00012 #ifndef __mlObjMgrAttribute_Message_H
00013 #define __mlObjMgrAttribute_Message_H
00014 
00015 #ifndef __MLObjMgrSystem_H
00016 #include "MLObjMgrSystem.h"
00017 #endif
00018 
00019 #ifndef __mlObjMgrDataType_H
00020 #include "mlObjMgrDataType.h"
00021 #endif
00022 
00023 
00024 ML_START_NAMESPACE
00025 
00028    template <typename T>
00029    class omMessageT : public std::basic_string<T>
00030    {
00031       typedef std::basic_string<T> inherited;
00032 
00033       public:
00034 
00036          omMessageT() : inherited() {}
00037 
00039          omMessageT(const omMessageT &msg) : inherited(msg) {}
00040 
00042          explicit omMessageT(const char *str) : inherited(str) {}
00043 
00045          explicit omMessageT(const std::basic_string<T> &str) : inherited(str) {}
00046 
00048          omMessageT &operator=(const omMessageT &msg) {
00049             ((inherited *)this)->assign(msg);
00050 
00051             return *this;
00052          }
00053 
00055          bool operator ==(const omMessageT &) const {
00056             return false;
00057          }
00058          bool operator !=(const omMessageT &) const {
00059             return true;
00060          }
00061       
00063          operator const omMessageT &() const {
00064             return *this;
00065          }
00066 
00068          operator const std::basic_string<T> &() const {
00069             return *this;
00070          }
00071    };
00072 
00074    typedef omMessageT<char> omMessage;
00075 
00078    class MLOBJMGR_EXPORT omData_omMessage : public omDataType
00079    {
00080       ML_CLASS_HEADER(omData_omMessage)
00081 
00082       typedef omDataType inherited;
00083    
00084       protected:
00085 
00086          omMessage _value;
00087 
00088       public:
00089 
00090          omData_omMessage() {}
00091          omData_omMessage(const omData_omMessage &msg) : omDataType(), _value(msg._value) {}
00092          omData_omMessage(const omMessage &value) : omDataType(), _value(value) {}
00093 
00094          inline omData_omMessage &operator =(const omData_omMessage &msg) {
00095             assign(msg._value); return *this;
00096          }
00097          inline omData_omMessage &operator =(const omMessage &value) {
00098             assign(value); return *this;
00099          }
00100          virtual void assign(const omMessage &value) {
00101             _value = value;
00102          }
00103 
00104          operator const omMessage &() const {
00105             return _value;
00106          }
00107 
00108          bool operator ==(const omMessage &value) const {
00109             return _value == value;
00110          }
00111          bool operator !=(const omMessage &value) const {
00112             return _value != value;
00113          }
00114 
00115          virtual std::string getStringValue() const {
00116             return _value;
00117          }
00118          virtual void        setStringValue(const std::string &value) {
00119             assign((omMessage)value);
00120          }
00121    };
00122 
00125    class MLOBJMGR_EXPORT omAttribute_omMessage : public omData_omMessage
00126    {
00127       ML_CLASS_HEADER(omAttribute_omMessage)
00128 
00129       typedef omData_omMessage inherited;
00130    
00131       public:
00132 
00133          omAttribute_omMessage() {}
00134          omAttribute_omMessage(const omAttribute_omMessage &msg) : inherited(msg) {}
00135          omAttribute_omMessage(const omMessage &value) : inherited(value) {}
00136 
00137          virtual ~omAttribute_omMessage() {}
00138 
00139          virtual void assign(const omMessage &value);
00140    };
00141 
00142 ML_END_NAMESPACE
00143 
00144 #endif // __mlObjMgrAttribute_Message_H