Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkTemporoSpatialStringPropertySerializer.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 mitkTemporoSpatialStringPropertySerializer_h_included
14 #define mitkTemporoSpatialStringPropertySerializer_h_included
15 
17 
19 
20 namespace mitk
21 {
22  class TemporoSpatialStringPropertySerializer : public BasePropertySerializer
23  {
24  public:
25  mitkClassMacro(TemporoSpatialStringPropertySerializer, BasePropertySerializer);
26  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
27 
28  TiXmlElement *Serialize() override
29  {
30  if (const TemporoSpatialStringProperty *prop =
31  dynamic_cast<const TemporoSpatialStringProperty *>(m_Property.GetPointer()))
32  {
33  auto element = new TiXmlElement("temporo_spatial_string");
35  TiXmlText text(content.c_str());
36  element->InsertEndChild(text);
37  return element;
38  }
39  else
40  return nullptr;
41  }
42 
43  BaseProperty::Pointer Deserialize(TiXmlElement *element) override
44  {
45  if (!element)
46  return nullptr;
47  const char *s(element->GetText());
48  std::string content = s ? s : "";
50  }
51 
52  protected:
53  TemporoSpatialStringPropertySerializer() {}
54  ~TemporoSpatialStringPropertySerializer() override {}
55  };
56 
57 } // namespace
58 
59 // important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
60 MITK_REGISTER_SERIALIZER(TemporoSpatialStringPropertySerializer);
61 
62 #endif
MITKCORE_EXPORT::std::string serializeTemporoSpatialStringPropertyToJSON(const mitk::BaseProperty *prop)
DataCollection - Class to facilitate loading/accessing structured data.
itk::SmartPointer< Self > Pointer
MITK_REGISTER_SERIALIZER(TemporoSpatialStringPropertySerializer)
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
MITKCORE_EXPORT mitk::BaseProperty::Pointer deserializeJSONToTemporoSpatialStringProperty(const std::string &value)