Medical Imaging Interaction Toolkit  2018.4.99-f51274ea
Medical Imaging Interaction Toolkit
mitk::XMLSerializable Class Referenceabstract

interface for all classes able to write themselves to XML files More...

#include <mitkXMLSerializable.h>

Inheritance diagram for mitk::XMLSerializable:
Collaboration diagram for mitk::XMLSerializable:

Public Member Functions

virtual const char * GetNameOfClass () const =0
 
virtual void ToXML (TiXmlElement *elem) const =0
 
virtual void FromXML (TiXmlElement *elem)=0
 
virtual void ToXMLFile (const std::string &file, const std::string &elemName="")
 
virtual void FromXMLFile (const std::string &file, const std::string &elemName="")
 
std::string GetXMLFileName () const
 

Static Public Attributes

static const std::string FILE_REFERENCE_ATTRIBUTE_NAME
 
static const std::string ROOT_NAME
 

Detailed Description

interface for all classes able to write themselves to XML files

Definition at line 26 of file mitkXMLSerializable.h.

Member Function Documentation

◆ FromXML()

virtual void mitk::XMLSerializable::FromXML ( TiXmlElement *  elem)
pure virtual

read your values here from elem

Implemented in mitk::Transform, and mitk::CameraIntrinsics.

◆ FromXMLFile()

void mitk::XMLSerializable::FromXMLFile ( const std::string &  file,
const std::string &  elemName = "" 
)
virtual

loads the XML file and calls FromXML() takes the first child of the document if this root node value is not equal to GetNameOfClass() the method will try to find the first children of the root node with the value of GetNameOfClass() if elemName is not empty then this value will be used instead of GetNameOfClass() if this node is found it will check if an attribute named FILE_REFERENCE_ATTRIBUTE_NAME is found: in this case the method calls itself with this attributes value as parameter

Definition at line 93 of file mitkXMLSerializable.cpp.

References endoAssertMsg, and endodebug.

Referenced by mitk::CameraIntrinsics::FromXML().

◆ GetNameOfClass()

virtual const char* mitk::XMLSerializable::GetNameOfClass ( ) const
pure virtual

the tag value will be equals to the class name (function implemented by the itkTypeMacro)

Referenced by mitk::CameraIntrinsics::FromXML(), mitk::CameraIntrinsics::ToString(), and mitk::CameraIntrinsics::ToXML().

◆ GetXMLFileName()

std::string mitk::XMLSerializable::GetXMLFileName ( ) const
See also
m_XMLFileName

Definition at line 88 of file mitkXMLSerializable.cpp.

◆ ToXML()

virtual void mitk::XMLSerializable::ToXML ( TiXmlElement *  elem) const
pure virtual

write your values here to elem

Implemented in mitk::Transform, and mitk::CameraIntrinsics.

◆ ToXMLFile()

void mitk::XMLSerializable::ToXMLFile ( const std::string &  file,
const std::string &  elemName = "" 
)
virtual

tries to write the xml data obtained in ToXML() to file

Definition at line 22 of file mitkXMLSerializable.cpp.

References endoAssertMsg.

Member Data Documentation

◆ FILE_REFERENCE_ATTRIBUTE_NAME

const std::string mitk::XMLSerializable::FILE_REFERENCE_ATTRIBUTE_NAME
static

value of the special tag for file references if this is attribute is found the class will be loaded from the file in the attributes value

Definition at line 34 of file mitkXMLSerializable.h.

◆ ROOT_NAME

const std::string mitk::XMLSerializable::ROOT_NAME
static

the name of the root node that is created when the element is saved

Definition at line 38 of file mitkXMLSerializable.h.


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