Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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,
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 mitkTemporoSpatialStringPropertySerializer_h_included
18 #define mitkTemporoSpatialStringPropertySerializer_h_included
19 
21 
23 
24 namespace mitk
25 {
26  class TemporoSpatialStringPropertySerializer : public BasePropertySerializer
27  {
28  public:
29  mitkClassMacro(TemporoSpatialStringPropertySerializer, BasePropertySerializer);
30  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
31 
32  virtual TiXmlElement *Serialize() override
33  {
34  if (const TemporoSpatialStringProperty *prop =
35  dynamic_cast<const TemporoSpatialStringProperty *>(m_Property.GetPointer()))
36  {
37  auto element = new TiXmlElement("temporo_spatial_string");
39  TiXmlText text(content.c_str());
40  element->InsertEndChild(text);
41  return element;
42  }
43  else
44  return nullptr;
45  }
46 
47  virtual BaseProperty::Pointer Deserialize(TiXmlElement *element) override
48  {
49  if (!element)
50  return nullptr;
51  const char *s(element->GetText());
52  std::string content = s ? s : "";
54  }
55 
56  protected:
57  TemporoSpatialStringPropertySerializer() {}
58  virtual ~TemporoSpatialStringPropertySerializer() {}
59  };
60 
61 } // namespace
62 
63 // important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
64 MITK_REGISTER_SERIALIZER(TemporoSpatialStringPropertySerializer);
65 
66 #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:44
MITKCORE_EXPORT mitk::BaseProperty::Pointer deserializeJSONToTemporoSpatialStringProperty(const std::string &value)