Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::BasePropertySerializer Class Reference

Base class for objects that serialize and deserialize BaseProperty types to/from XML. More...

#include <mitkBasePropertySerializer.h>

Inheritance diagram for mitk::BasePropertySerializer:
Collaboration diagram for mitk::BasePropertySerializer:

Public Member Functions

 mitkClassMacroItkParent (BasePropertySerializer, itk::Object)
 
virtual void SetProperty (const BaseProperty *_arg)
 Sets the property to be serialized. More...
 
virtual tinyxml2::XMLElement * Serialize (tinyxml2::XMLDocument &doc)
 Serializes the previously set BaseProperty object into an XML element. More...
 
virtual BaseProperty::Pointer Deserialize (const tinyxml2::XMLElement *element)
 Deserializes an XML element back into a BaseProperty object. More...
 

Protected Member Functions

 BasePropertySerializer ()
 
 ~BasePropertySerializer () override
 

Protected Attributes

BaseProperty::ConstPointer m_Property
 

Detailed Description

Base class for objects that serialize and deserialize BaseProperty types to/from XML.

Provides the interface for converting mitk::BaseProperty-derived objects to and from XML elements (using TinyXML2). Sub-classes implement the actual serialization and deserialization logic for specific property types.

The naming convention for sub-classes must follow this pattern:

* If the class derived from BaseProperty is called GreenProperty
* Then the serializer for this class must be called GreenPropertySerializer
* 

Sub-classes are discovered at runtime through the ITK object factory mechanism. Use the MITK_REGISTER_SERIALIZER macro to register a new serializer.

See also
BaseDataSerializer, PropertyListSerializer, MITK_REGISTER_SERIALIZER

Definition at line 48 of file mitkBasePropertySerializer.h.

Constructor & Destructor Documentation

◆ BasePropertySerializer()

mitk::BasePropertySerializer::BasePropertySerializer ( )
protected

◆ ~BasePropertySerializer()

mitk::BasePropertySerializer::~BasePropertySerializer ( )
overrideprotected

Member Function Documentation

◆ Deserialize()

virtual BaseProperty::Pointer mitk::BasePropertySerializer::Deserialize ( const tinyxml2::XMLElement *  element)
virtual

Deserializes an XML element back into a BaseProperty object.

The base implementation logs an error and returns nullptr. Sub-classes must override this method to reconstruct a property from XML.

Parameters
[in]elementThe XML element to deserialize. May be nullptr.
Returns
A smart pointer to the deserialized property, or nullptr if deserialization is not implemented or fails.

Reimplemented in mitk::VectorPropertySerializer< DATATYPE >, mitk::TransferFunctionPropertySerializer, mitk::LookupTablePropertySerializer, and mitk::ScalarListLookupTablePropertySerializer.

◆ mitkClassMacroItkParent()

mitk::BasePropertySerializer::mitkClassMacroItkParent ( BasePropertySerializer  ,
itk::Object   
)

◆ Serialize()

virtual tinyxml2::XMLElement* mitk::BasePropertySerializer::Serialize ( tinyxml2::XMLDocument &  doc)
virtual

Serializes the previously set BaseProperty object into an XML element.

The base implementation logs the request and returns nullptr. Sub-classes must override this method to produce a meaningful XML representation.

Parameters
[in,out]docThe XML document used to create new elements.
Returns
A pointer to the newly created XML element representing the property, or nullptr if serialization is not implemented or fails.
Precondition
The property must be set via SetProperty() before calling this method.

Reimplemented in mitk::VectorPropertySerializer< DATATYPE >, mitk::TransferFunctionPropertySerializer, mitk::LookupTablePropertySerializer, mitk::EnumerationPropertySerializer, and mitk::ScalarListLookupTablePropertySerializer.

◆ SetProperty()

virtual void mitk::BasePropertySerializer::SetProperty ( const BaseProperty *  _arg)
virtual

Sets the property to be serialized.

Parameters
[in]_argPointer to the BaseProperty object.

Member Data Documentation

◆ m_Property

BaseProperty::ConstPointer mitk::BasePropertySerializer::m_Property
protected

Definition at line 89 of file mitkBasePropertySerializer.h.


The documentation for this class was generated from the following file: