Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::VectorPropertySerializer< DATATYPE > Class Template Reference

Serializes and deserializes VectorProperty instances to/from XML. More...

#include <mitkVectorPropertySerializer.h>

Inheritance diagram for mitk::VectorPropertySerializer< DATATYPE >:
Collaboration diagram for mitk::VectorPropertySerializer< DATATYPE >:

Public Types

typedef VectorProperty< DATATYPE > PropertyType
 
typedef VectorPropertySerializer< DATATYPE > Self
 
typedef BasePropertySerializer SuperClass
 
typedef itk::SmartPointer< Self > Pointer
 
typedef itk::SmartPointer< const Self > ConstPointer
 

Public Member Functions

std::vector< std::string > GetClassHierarchy () const override
 
const char * GetNameOfClass () const override
 
Pointer Clone () const
 
tinyxml2::XMLElement * Serialize (tinyxml2::XMLDocument &doc) override
 Serializes the VectorProperty into an XML "Values" element. More...
 
BaseProperty::Pointer Deserialize (const tinyxml2::XMLElement *listElement) override
 Deserializes an XML "Values" element back into a VectorProperty. More...
 
- Public Member Functions inherited from mitk::BasePropertySerializer
 mitkClassMacroItkParent (BasePropertySerializer, itk::Object)
 
virtual void SetProperty (const BaseProperty *_arg)
 Sets the property to be serialized. More...
 

Static Public Member Functions

static const char * GetStaticNameOfClass ()
 
static Pointer New ()
 

Additional Inherited Members

- Protected Member Functions inherited from mitk::BasePropertySerializer
 BasePropertySerializer ()
 
 ~BasePropertySerializer () override
 
- Protected Attributes inherited from mitk::BasePropertySerializer
BaseProperty::ConstPointer m_Property
 

Detailed Description

template<typename DATATYPE>
class mitk::VectorPropertySerializer< DATATYPE >

Serializes and deserializes VectorProperty instances to/from XML.

Converts a VectorProperty (a vector of values of type DATATYPE) into an XML structure and back. The XML format is:

* <Values>
*   <Value idx="0" value="17.3"/>
*   <Value idx="1" value="7.2"/>
*   <Value idx="2" value="-17.3"/>
* </Values>
* 

This class is implemented as a template and uses boost::lexical_cast for conversions between specific data types and strings.

Template Parameters
DATATYPEThe element type stored in the VectorProperty (e.g., double, int).
Note
The class name returned by GetStaticNameOfClass() is prefixed with a type-dependent string (e.g., "Double" or "Int"), so that the ITK object factory can discover the correct serializer for each VectorProperty specialization.
See also
BasePropertySerializer, VectorProperty, DoubleVectorPropertySerializer, IntVectorPropertySerializer

Definition at line 51 of file mitkVectorPropertySerializer.h.

Member Typedef Documentation

◆ ConstPointer

template<typename DATATYPE >
typedef itk::SmartPointer<const Self> mitk::VectorPropertySerializer< DATATYPE >::ConstPointer

Definition at line 62 of file mitkVectorPropertySerializer.h.

◆ Pointer

template<typename DATATYPE >
typedef itk::SmartPointer<Self> mitk::VectorPropertySerializer< DATATYPE >::Pointer

Definition at line 61 of file mitkVectorPropertySerializer.h.

◆ PropertyType

template<typename DATATYPE >
typedef VectorProperty<DATATYPE> mitk::VectorPropertySerializer< DATATYPE >::PropertyType

Definition at line 58 of file mitkVectorPropertySerializer.h.

◆ Self

template<typename DATATYPE >
typedef VectorPropertySerializer<DATATYPE> mitk::VectorPropertySerializer< DATATYPE >::Self

Definition at line 59 of file mitkVectorPropertySerializer.h.

◆ SuperClass

template<typename DATATYPE >
typedef BasePropertySerializer mitk::VectorPropertySerializer< DATATYPE >::SuperClass

Definition at line 60 of file mitkVectorPropertySerializer.h.

Member Function Documentation

◆ Clone()

template<typename DATATYPE >
Pointer mitk::VectorPropertySerializer< DATATYPE >::Clone ( ) const

◆ Deserialize()

template<typename DATATYPE >
BaseProperty::Pointer mitk::VectorPropertySerializer< DATATYPE >::Deserialize ( const tinyxml2::XMLElement *  listElement)
inlineoverridevirtual

Deserializes an XML "Values" element back into a VectorProperty.

Reads child "Value" elements, parses each "value" attribute using boost::lexical_cast, and constructs a new VectorProperty containing the parsed values.

Parameters
[in]listElementThe XML "Values" element to deserialize. May be nullptr.
Returns
A smart pointer to the deserialized VectorProperty, or nullptr if the element is null, missing, or contains unparsable values.

Reimplemented from mitk::BasePropertySerializer.

Definition at line 128 of file mitkVectorPropertySerializer.h.

References MITK_ERROR.

◆ GetClassHierarchy()

template<typename DATATYPE >
std::vector<std::string> mitk::VectorPropertySerializer< DATATYPE >::GetClassHierarchy ( ) const
inlineoverride

Definition at line 63 of file mitkVectorPropertySerializer.h.

◆ GetNameOfClass()

template<typename DATATYPE >
const char* mitk::VectorPropertySerializer< DATATYPE >::GetNameOfClass ( ) const
inlineoverride

Definition at line 75 of file mitkVectorPropertySerializer.h.

◆ GetStaticNameOfClass()

template<typename DATATYPE >
static const char* mitk::VectorPropertySerializer< DATATYPE >::GetStaticNameOfClass ( )
inlinestatic

Definition at line 67 of file mitkVectorPropertySerializer.h.

◆ New()

template<typename DATATYPE >
static Pointer mitk::VectorPropertySerializer< DATATYPE >::New ( )
static

◆ Serialize()

template<typename DATATYPE >
tinyxml2::XMLElement* mitk::VectorPropertySerializer< DATATYPE >::Serialize ( tinyxml2::XMLDocument &  doc)
inlineoverridevirtual

Serializes the VectorProperty into an XML "Values" element.

Each element of the vector is stored as a child element with an "idx" attribute (zero-based index) and a "value" attribute (string representation of the numeric value).

Parameters
[in,out]docThe XML document used to create elements.
Returns
Pointer to the "Values" XML element, or nullptr if the property is not a VectorProperty of the expected type.

Reimplemented from mitk::BasePropertySerializer.

Definition at line 90 of file mitkVectorPropertySerializer.h.


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