MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
mlPropertiesMacros.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2010, 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// Defines convenience-macros for backward-compatible access to properties of graph-elements.
14
15#ifndef ML_PROPERTIES_MACROS_H
16#define ML_PROPERTIES_MACROS_H
17
19
20#define STATIC_CASTED_GRAPH_PROPERTY(VisibleType, StoredType, lowerCaseName, upperCaseName) \
21private: \
22 DefaultPropertyAccessor<StoredType> _##lowerCaseName##Accessor; \
23 \
24public: \
25 VisibleType get##upperCaseName() const \
26 { \
27 return static_cast<VisibleType>(_##lowerCaseName##Accessor.get(*this)); \
28 } \
29 void set##upperCaseName(const VisibleType& newValue) \
30 { \
31 _##lowerCaseName##Accessor.set(*this, static_cast<StoredType>(newValue)); \
32 }
33
34#define STATIC_GRAPH_PROPERTY(Type, lowerCaseName, upperCaseName) \
35private: \
36 DefaultPropertyAccessor<Type> _##lowerCaseName##Accessor; \
37 \
38public: \
39 Type get##upperCaseName() const \
40 { \
41 return Type(_##lowerCaseName##Accessor.get(*this)); \
42 } \
43 void set##upperCaseName(const Type& newValue) \
44 { \
45 _##lowerCaseName##Accessor.set(*this, newValue); \
46 }
47
48
49#define READ_OLD_STATIC_PROPERTY(Type, parent, tagName, setFunction) \
50 { \
51 Type tmp; \
52 if (parent->readOptionalChild(tmp, tagName)) \
53 setFunction(tmp); \
54 }
55
56#endif