Medical Imaging Interaction Toolkit  2018.4.99-eed36131
Medical Imaging Interaction Toolkit
mitkEnumerationSubclassesSerializer.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkEnumerationSubclassesSerializer_h_included
14 #define mitkEnumerationSubclassesSerializer_h_included
15 
17 
18 #include "mitkModalityProperty.h"
27 
28 #define MITK_REGISTER_ENUM_SUB_SERIALIZER(classname) \
29  \
30 namespace mitk \
31  \
32 { \
33  \
34 class classname##Serializer \
35  : public EnumerationPropertySerializer\
36 {public : \
37  \
38  mitkClassMacro(classname##Serializer, EnumerationPropertySerializer) itkFactorylessNewMacro(Self) \
39  itkCloneMacro(Self) \
40  \
41  virtual BaseProperty::Pointer Deserialize(TiXmlElement * element) override{if (!element) return nullptr; \
42  const char *sa(element->Attribute("value")); \
43  \
44  std::string s(sa ? sa : ""); \
45  classname::Pointer property = classname::New(); \
46  property->SetValue(s); \
47  \
48  return property.GetPointer(); \
49  } \
50  \
51 protected: \
52  classname##Serializer() {} \
53  virtual ~classname##Serializer() {} \
54  \
55 } \
56  ; \
57  \
58 } \
59  \
60 MITK_REGISTER_SERIALIZER(classname##Serializer);
61 
62 MITK_REGISTER_ENUM_SUB_SERIALIZER(PlaneOrientationProperty);
63 MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkInterpolationProperty);
64 MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkRepresentationProperty);
65 MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkResliceInterpolationProperty);
66 MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkScalarModeProperty);
67 MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkVolumeRenderingProperty);
68 MITK_REGISTER_ENUM_SUB_SERIALIZER(ModalityProperty);
69 MITK_REGISTER_ENUM_SUB_SERIALIZER(RenderingModeProperty);
70 MITK_REGISTER_ENUM_SUB_SERIALIZER(PointSetShapeProperty);
71 
72 #endif
#define MITK_REGISTER_ENUM_SUB_SERIALIZER(classname)