MeVisLab Toolbox Reference
mlObjMgrSubAttribute.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_SUB_ATTRIBUTE_H
14
#define ML_OBJ_MGR_SUB_ATTRIBUTE_H
15
16
18
19
#include "MLObjMgrSystem.h"
20
21
#include "
mlObjMgrSubDataType.h
"
22
23
25
// Macros
26
27
#define ATTRIBUTE_TYPE_HEADER(dataTypeName, dataType) \
28
class MLOBJMGR_EXPORT omAttribute_##dataTypeName : public omData_##dataTypeName \
29
{ \
30
ML_CLASS_HEADER(omAttribute_##dataTypeName) \
31
\
32
public: \
33
\
34
omAttribute_##dataTypeName() {} \
35
omAttribute_##dataTypeName(const dataType &value) : omData_##dataTypeName(value) {} \
36
void assign(const dataType &value) override; \
37
};
38
39
#define ATTRIBUTE_TYPE_SOURCE(dataTypeName, dataType) \
40
ML_CLASS_SOURCE(omAttribute_##dataTypeName, omData_##dataTypeName); \
41
void omAttribute_##dataTypeName::assign(const dataType &value) { \
42
if(_value != value) { \
43
ObjMgr *om; \
44
if(_container && ((omAttribute *)_container)->parent() && ((omAttribute *)_container)->parent()->parent() && (om = ((omObject *)((omAttribute *)_container)->parent()->parent())->objMgr()) != NULL) { \
45
om->addEvent(ObjMgrEvent(ObjMgrEvent::ATTRIBUTE_MODIFIED, *(omAttribute *)_container, omData(value), omData(_value), false)); \
46
} \
47
\
48
_value = value; \
49
} \
50
}
51
52
53
#define ATTRIBUTE_OP_HEADER(dataTypeName, dataType) \
54
void assign(const dataType &value) override; \
55
omAttribute &operator =(const dataType &value) { \
56
assign(value); return *this; \
57
}
58
59
#define ATTRIBUTE_OP_SOURCE(dataTypeName, dataType) \
60
void omAttribute::assign(const dataType &value) { \
61
if(_data == NULL) { \
62
createDataType(QUOTE(omAttribute_##dataTypeName)); \
63
\
64
if(_data == NULL) \
65
return; \
66
\
67
ObjMgr *om = _parent->parent()->objMgr(); \
68
if(om) { \
69
om->addEvent(ObjMgrEvent(ObjMgrEvent::ATTRIBUTE_CREATED, *this, omData(value))); \
70
om->disableEventRecording(); \
71
} \
72
\
73
*(omAttribute_##dataTypeName *)_data = value; \
74
\
75
if(om) { \
76
om->enableEventRecording(); \
77
} \
78
} \
79
else { \
80
*(omAttribute_##dataTypeName *)_data = value; \
81
} \
82
}
83
84
85
#endif
// __mlObjMgrSubAttribute_H
mlObjMgrSubDataType.h
MeVisLab
Standard
Sources
ML
MLObjMgr
ObjMgr
mlObjMgrSubAttribute.h
Generated by
1.9.1