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