ITK  6.0.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  * https://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);
69  using Superclass = Object;
72 
74  itkNewMacro(Self);
75 
77  itkOverrideGetNameOfClassMacro(DOMNodeXMLWriter);
78 
79  using InputType = DOMNode;
81 
83  itkSetStringMacro(FileName);
84 
86  itkGetStringMacro(FileName);
87 
89  itkSetConstObjectMacro(Input, InputType);
90  itkGetConstObjectMacro(Input, InputType);
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 
114  ConstInputPointer m_Input{};
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 {
126  auto writer = itk::DOMNodeXMLWriter::New();
127  writer->SetInput(&object);
128  writer->Update(os);
129  return os;
130 }
133 #endif // itkDOMNodeXMLWriter_h
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::VariableLengthVectorExpression::operator<<
std::ostream & operator<<(std::ostream &os, const VariableLengthVectorExpression< TExpr1, TExpr2, TBinaryOp > &v)
Definition: itkVariableLengthVector.h:1359
itkDOMNode.h
itk::SmartPointer< Self >
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
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
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::DOMNodeXMLWriter::New
static Pointer New()
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61