MeVisLab Toolbox Reference
mlObjMgrData.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_DATA_H
14 #define ML_OBJ_MGR_DATA_H
15 
16 
18 
19 #include "MLObjMgrSystem.h"
20 #include "mlObjMgrDataTypes.h"
21 
22 
23 ML_UTILS_START_NAMESPACE
24 
25  // Forward declaration of classes
26  class RuntimeType;
27 
28 ML_UTILS_END_NAMESPACE
29 
30 ML_START_NAMESPACE
31 
34  class MLOBJMGR_EXPORT omData
35  {
36  protected:
37 
39 
40  public:
41 
42  omData();
43  omData(const std::string &typeName, const std::string &value);
44  omData(const omData &data);
45  virtual ~omData();
46 
48  inline bool isValid() const {
49  return _data != nullptr;
50  }
51 
53  void createDataType(const std::string &typeName);
54  void createDataType(const RuntimeType *type);
55 
57  inline const RuntimeType *getDataType() const {
58  return (_data) ? _data->getTypeId() : nullptr;
59  }
60 
61  inline std::string getStringValue() const {
62  return (_data) ? _data->getStringValue() : "";
63  }
64  inline void setStringValue(const std::string &value) {
65  if(_data) _data->setStringValue(value); else *this = value;
66  }
67  inline bool stringValueIsEqual(const std::string &value) const {
68  return (_data && _data->getStringValue() == value);
69  }
70 
72  omData &operator =(const omData &data);
73  virtual void assign(const omData &data);
74 
75  bool operator ==(const omData &data) const;
76 
84  DATA_OP_HEADER(bool , bool , false);
85  DATA_OP_HEADER(double , double , 0.0);
94 
96  omData &operator =(const char *value) {
97  assign(std_string(value)); return *this;
98  }
99  };
100 
101 ML_END_NAMESPACE
102 
103 #endif // __mlObjMgrData_H
RuntimeType contains type and inheritance information of a class and a static dictionary with informa...
Definition: mlRuntimeType.h:53
Base class for data.
virtual std::string getStringValue() const =0
Get value of data type as string.
virtual void setStringValue(const std::string &value)=0
Set data type value from string.
Manages data and takes care of allocation and deallocation.
Definition: mlObjMgrData.h:35
DATA_OP_HEADER(omMessage, omMessage, omMessage())
bool isValid() const
Returns true if attribute is valid.
Definition: mlObjMgrData.h:48
void createDataType(const RuntimeType *type)
DATA_OP_HEADER(std_MLint32Vec, std_MLint32Vec, std_MLint32Vec())
omData(const omData &data)
DATA_OP_HEADER(mat4, Matrix4, Matrix4())
virtual void assign(const omData &data)
void createDataType(const std::string &typeName)
Create datatype.
DATA_OP_HEADER(vec4, Vector4, Vector4())
void setStringValue(const std::string &value)
Definition: mlObjMgrData.h:64
DATA_OP_HEADER(MLint32, MLint32, 0)
These macros declare operators and methods to access the internal attribute data: omAttribute &operat...
DATA_OP_HEADER(std_string, std_string, std_string())
DATA_OP_HEADER(vec3, Vector3, Vector3())
virtual ~omData()
std::string getStringValue() const
Definition: mlObjMgrData.h:61
bool stringValueIsEqual(const std::string &value) const
Definition: mlObjMgrData.h:67
DATA_OP_HEADER(BasePtr, BasePtr, BasePtr())
DATA_OP_HEADER(double, double, 0.0)
DATA_OP_HEADER(bool, bool, false)
omDataType * _data
Definition: mlObjMgrData.h:38
DATA_OP_HEADER(std_vec3Vec, std_vec3Vec, std_vec3Vec())
omData(const std::string &typeName, const std::string &value)
const RuntimeType * getDataType() const
Return runtime type of data container.
Definition: mlObjMgrData.h:57
signed int MLint32
Definition: mlTypeDefs.h:167
std::string std_string
omMessageT< char > omMessage
Define the normally used type from template type with normal string base char type.
Tvec4< MLdouble > Vector4
A vector with 4 components of type double.
Definition: mlVector4.h:162
bool operator==(const Tmat2< DT > &a, const Tmat2< DT > &b)
a == b ? Return true if yes.
Definition: mlMatrix2.h:425
Tmat4< MLdouble > Matrix4
The standard 4x4 matrix of type double.
Definition: mlMatrix4.h:726
Tvec3< MLdouble > Vector3
A vector with 3 components of type double.
Definition: mlVector3.h:300
std::vector< MLint32 > std_MLint32Vec
std::vector< Vector3 > std_vec3Vec
boost::shared_ptr< Base > BasePtr