Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkGroupTagPropertySerializer.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 mitkGroupTagPropertySerializer_h_included
18 #define mitkGroupTagPropertySerializer_h_included
19 
21 
22 #include "mitkGroupTagProperty.h"
23 
24 namespace mitk
25 {
26  class GroupTagPropertySerializer : public BasePropertySerializer
27  {
28  public:
29  mitkClassMacro(GroupTagPropertySerializer, BasePropertySerializer);
30  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
31 
32  virtual TiXmlElement *Serialize() override
33  {
34  if (dynamic_cast<const GroupTagProperty *>(m_Property.GetPointer()) != nullptr)
35  {
36  auto element = new TiXmlElement("GroupTag");
37  return element;
38  }
39  else
40  return nullptr;
41  }
42 
43  virtual BaseProperty::Pointer Deserialize(TiXmlElement *) override
44  {
45  // if (!element)
46  // return NULL;
47  return GroupTagProperty::New().GetPointer();
48  }
49 
50  protected:
51  GroupTagPropertySerializer() {}
52  virtual ~GroupTagPropertySerializer() {}
53  };
54 
55 } // namespace
56 
57 // important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
58 MITK_REGISTER_SERIALIZER(GroupTagPropertySerializer);
59 
60 #endif
DataCollection - Class to facilitate loading/accessing structured data.
itk::SmartPointer< Self > Pointer
static Pointer New()
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
MITK_REGISTER_SERIALIZER(GroupTagPropertySerializer)