ITK  5.4.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
itk::DOMNodeXMLWriter Class Reference

#include <itkDOMNodeXMLWriter.h>

Detailed Description

Class to write a DOM object to an XML file or an output stream.

This class takes a user DOM object and write it to a destination such as file, string, console, etc. Before using this class, the DOM object should have been generated from a user object.

We do not recommend to directly use this class for user object writing, because the user has to handle both DOM object generation from the user object and XML output from the intermediate DOM object. Users should derive from the DOMWriter, because it performs the latter step automatically and lets the users concentrate on the former step, thus implementation of such a writer is simplified.

Note: Though this class behaves similar to ProcessObject, it is not derived from ProcessObject. This is because the input of this class, i.e. a DOMNode object, is not a DataObject, thus this class cannot be connected to an ITK process pipeline.

The following code snippet demonstrates how to write a DOM object to an XML file:

itk::DOMNode::Pointer input_dom_object = ...
const char* output_xml_file_name = ...
itk::DOMNodeXMLWriter::Pointer writer = itk::DOMNodeXMLWriter::New();
writer->SetInput( input_dom_object );
writer->SetFileName( output_xml_file_name );
writer->Update();
See also
DOMWriter
DOMNode

Definition at line 61 of file itkDOMNodeXMLWriter.h.

+ Inheritance diagram for itk::DOMNodeXMLWriter:
+ Collaboration diagram for itk::DOMNodeXMLWriter:

Public Types

using ConstInputPointer = InputType::ConstPointer
 
using ConstPointer = SmartPointer< const Self >
 
using InputType = DOMNode
 
using Pointer = SmartPointer< Self >
 
using Self = DOMNodeXMLWriter
 
using Superclass = Object
 
- Public Types inherited from itk::Object
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = Object
 
using Superclass = LightObject
 
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = LightObject
 

Public Member Functions

virtual const char * GetFileName () const
 
const char * GetNameOfClass () const override
 
virtual void SetFileName (const char *_arg)
 
virtual void Update ()
 
void Update (std::ostream &os, std::string indent="")
 
virtual void SetInput (const InputType *_arg)
 
virtual const InputTypeGetInput () const
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) const
 
unsigned long AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const
 
LightObject::Pointer CreateAnother () const override
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
MetaDataDictionaryGetMetaDataDictionary ()
 
const MetaDataDictionaryGetMetaDataDictionary () const
 
virtual ModifiedTimeType GetMTime () const
 
virtual const TimeStampGetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
void Register () const override
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetReferenceCount (int) override
 
void UnRegister () const noexcept override
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
void SetMetaDataDictionary (MetaDataDictionary &&rrhs)
 
virtual void SetObjectName (std::string _arg)
 
virtual const std::string & GetObjectName () const
 
- Public Member Functions inherited from itk::LightObject
Pointer Clone () const
 
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
void Print (std::ostream &os, Indent indent=0) const
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool val)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 

Protected Member Functions

 DOMNodeXMLWriter ()
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
virtual void SetTimeStamp (const TimeStamp &timeStamp)
 
 ~Object () override
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 

Private Attributes

std::string m_FileName {}
 
std::string m_IndentStep {}
 
ConstInputPointer m_Input {}
 

Additional Inherited Members

- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount {}
 

Member Typedef Documentation

◆ ConstInputPointer

Definition at line 80 of file itkDOMNodeXMLWriter.h.

◆ ConstPointer

Definition at line 71 of file itkDOMNodeXMLWriter.h.

◆ InputType

Definition at line 79 of file itkDOMNodeXMLWriter.h.

◆ Pointer

Definition at line 70 of file itkDOMNodeXMLWriter.h.

◆ Self

Standard class type aliases.

Definition at line 68 of file itkDOMNodeXMLWriter.h.

◆ Superclass

Definition at line 69 of file itkDOMNodeXMLWriter.h.

Constructor & Destructor Documentation

◆ DOMNodeXMLWriter()

itk::DOMNodeXMLWriter::DOMNodeXMLWriter ( )
protected

Member Function Documentation

◆ GetFileName()

virtual const char* itk::DOMNodeXMLWriter::GetFileName ( ) const
virtual

Get the output XML filename.

◆ GetInput()

virtual const InputType* itk::DOMNodeXMLWriter::GetInput ( ) const
virtual

Get/Set the input DOM object to be written.

◆ GetNameOfClass()

const char* itk::DOMNodeXMLWriter::GetNameOfClass ( ) const
overridevirtual
See also
LightObject::GetNameOfClass()

Reimplemented from itk::Object.

◆ New()

static Pointer itk::DOMNodeXMLWriter::New ( )
static

Method for creation through the object factory.

Examples
Examples/IO/XML/DOMFindDemo.cxx.

Referenced by operator<<().

◆ SetFileName()

virtual void itk::DOMNodeXMLWriter::SetFileName ( const char *  _arg)
virtual

Set the output XML filename.

◆ SetInput()

virtual void itk::DOMNodeXMLWriter::SetInput ( const InputType _arg)
virtual

Get/Set the input DOM object to be written.

◆ Update() [1/2]

virtual void itk::DOMNodeXMLWriter::Update ( )
virtual

Function called by end-users to write the input DOM object to the output XML file.

◆ Update() [2/2]

void itk::DOMNodeXMLWriter::Update ( std::ostream &  os,
std::string  indent = "" 
)

Function called by Update() or end-users to write the input DOM object to an output stream such as file, string, console, etc.

Member Data Documentation

◆ m_FileName

std::string itk::DOMNodeXMLWriter::m_FileName {}
private

Variable to hold the output XML file name.

Definition at line 111 of file itkDOMNodeXMLWriter.h.

◆ m_IndentStep

std::string itk::DOMNodeXMLWriter::m_IndentStep {}
private

Variable to hold the indentation (i.e. number of white spaces) for a child node w.r.t. its parent.

Definition at line 117 of file itkDOMNodeXMLWriter.h.

◆ m_Input

ConstInputPointer itk::DOMNodeXMLWriter::m_Input {}
private

Variable to hold the input DOM object.

Definition at line 114 of file itkDOMNodeXMLWriter.h.


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