MeVisLab Toolbox Reference
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; \
23public: \
24 VisibleType get##upperCaseName() const { return static_cast<VisibleType>(_##lowerCaseName##Accessor.get(*this)); } \
25 void set##upperCaseName(const VisibleType& newValue) { _##lowerCaseName##Accessor.set(*this, static_cast<StoredType>(newValue)); }
26
27#define STATIC_GRAPH_PROPERTY(Type, lowerCaseName, upperCaseName) \
28private: \
29 DefaultPropertyAccessor<Type> _##lowerCaseName##Accessor; \
30public: \
31 Type get##upperCaseName() const { return Type(_##lowerCaseName##Accessor.get(*this)); } \
32 void set##upperCaseName(const Type& newValue) { _##lowerCaseName##Accessor.set(*this, newValue); }
33
34
35#define READ_OLD_STATIC_PROPERTY(Type, parent, tagName, setFunction) \
36 { \
37 Type tmp; \
38 parent->readChild(tmp, tagName); \
39 setFunction(tmp); \
40 }
41
42#endif