Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkEnumerationSubclassesSerializer_h_included
18 #define mitkEnumerationSubclassesSerializer_h_included
19 
21 
22 #include "mitkModalityProperty.h"
26 #include "mitkShaderProperty.h"
32 
33 #define MITK_REGISTER_ENUM_SUB_SERIALIZER(classname) \
34  \
35 namespace mitk \
36  \
37 { \
38  \
39 class classname##Serializer \
40  : public EnumerationPropertySerializer\
41 {public : \
42  \
43  mitkClassMacro(classname##Serializer, EnumerationPropertySerializer) itkFactorylessNewMacro(Self) \
44  itkCloneMacro(Self) \
45  \
46  virtual BaseProperty::Pointer Deserialize(TiXmlElement * element) override{if (!element) return NULL; \
47  const char *sa(element->Attribute("value")); \
48  \
49  std::string s(sa ? sa : ""); \
50  classname::Pointer property = classname::New(); \
51  property->SetValue(s); \
52  \
53  return property.GetPointer(); \
54  } \
55  \
56 protected: \
57  classname##Serializer() {} \
58  virtual ~classname##Serializer() {} \
59  \
60 } \
61  ; \
62  \
63 } \
64  \
65 MITK_REGISTER_SERIALIZER(classname##Serializer);
66 
67 MITK_REGISTER_ENUM_SUB_SERIALIZER(PlaneOrientationProperty);
68 MITK_REGISTER_ENUM_SUB_SERIALIZER(ShaderProperty);
69 MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkInterpolationProperty);
70 MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkRepresentationProperty);
71 MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkResliceInterpolationProperty);
72 MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkScalarModeProperty);
73 MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkVolumeRenderingProperty);
74 MITK_REGISTER_ENUM_SUB_SERIALIZER(ModalityProperty);
75 MITK_REGISTER_ENUM_SUB_SERIALIZER(RenderingModeProperty);
76 MITK_REGISTER_ENUM_SUB_SERIALIZER(PointSetShapeProperty);
77 
78 #endif
#define MITK_REGISTER_ENUM_SUB_SERIALIZER(classname)