ITK  5.2.0
Insight Toolkit
itkDOMNodeXMLWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef itkDOMNodeXMLWriter_h
20 #define itkDOMNodeXMLWriter_h
21 
22 #include "itkDOMNode.h"
23 #include "itkObject.h"
24 #include "ITKIOXMLExport.h"
25 
26 #include <ostream>
27 
28 namespace itk
29 {
30 
61 class ITKIOXML_EXPORT DOMNodeXMLWriter : public Object
62 {
63 public:
64  ITK_DISALLOW_COPY_AND_MOVE(DOMNodeXMLWriter);
66 
69  using Superclass = Object;
72 
74  itkNewMacro(Self);
75 
77  itkTypeMacro(DOMNodeXMLWriter, Object);
78 
79  using InputType = DOMNode;
81 
83  itkSetStringMacro(FileName);
84 
86  itkGetStringMacro(FileName);
87 
89  itkSetConstObjectMacro(Input, InputType);
90  itkGetConstObjectMacro(Input, InputType);
92 
97  void
98  Update(std::ostream & os, std::string indent = "");
99 
103  virtual void
104  Update();
105 
106 protected:
108 
109 private:
111  std::string m_FileName;
112 
115 
117  std::string m_IndentStep;
118 };
119 
120 } // namespace itk
121 
123 inline std::ostream &
124 operator<<(std::ostream & os, const itk::DOMNode & object)
125 {
127  writer->SetInput(&object);
128  writer->Update(os);
129  return os;
130 }
132 
133 #endif // itkDOMNodeXMLWriter_h
itk::VariableLengthVectorExpression::operator<<
std::ostream & operator<<(std::ostream &os, VariableLengthVectorExpression< TExpr1, TExpr2, TBinaryOp > const &v)
Definition: itkVariableLengthVector.h:1358
itkDOMNode.h
itk::DOMNodeXMLWriter::m_Input
ConstInputPointer m_Input
Definition: itkDOMNodeXMLWriter.h:114
itk::DOMNodeXMLWriter::m_IndentStep
std::string m_IndentStep
Definition: itkDOMNodeXMLWriter.h:117
itk::SmartPointer< Self >
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::DOMNode
Class to represent a node in a Document Object Model (DOM) tree structure.
Definition: itkDOMNode.h:53
itk::DOMNodeXMLWriter
Class to write a DOM object to an XML file or an output stream.
Definition: itkDOMNodeXMLWriter.h:61
itkObject.h
itk::DOMNodeXMLWriter::m_FileName
std::string m_FileName
Definition: itkDOMNodeXMLWriter.h:111
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::DOMNodeXMLWriter::New
static Pointer New()
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62