ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkDOMNodeXMLReader.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 itkDOMNodeXMLReader_h
20 #define itkDOMNodeXMLReader_h
21 
22 #include "itkDOMNode.h"
23 #include "itkObject.h"
24 #include "ITKIOXMLExport.h"
25 
26 #include <istream>
27 
28 namespace itk
29 {
30 
61 class ITKIOXML_EXPORT DOMNodeXMLReader : public Object
62 {
63 public:
64 
67  typedef Object Superclass;
70 
72  itkNewMacro(Self);
73 
75  itkTypeMacro(DOMNodeXMLReader, Object);
76 
77  typedef DOMNode OutputType;
79 
81  itkSetStringMacro(FileName);
82 
84  itkGetStringMacro(FileName);
85 
90  itkSetObjectMacro( Output, OutputType );
91  itkGetModifiableObjectMacro(Output, OutputType );
93 
98  void Update( std::istream& is );
99 
103  virtual void Update();
104 
108  virtual void StartElement( const char* name, const char** atts );
109 
113  virtual void EndElement( const char* name );
114 
118  virtual void CharacterDataHandler( const char* text, int len );
119 
120 protected:
122 
123 private:
124  DOMNodeXMLReader(const Self &) ITK_DELETE_FUNCTION;
125  void operator=(const Self &) ITK_DELETE_FUNCTION;
126 
128  std::string m_FileName;
129 
131  OutputPointer m_Output;
132 
134  OutputType* m_Context;
135 };
136 
137 } // namespace itk
138 
140 inline std::istream& operator>>( std::istream& is, itk::DOMNode& object )
141 {
143  reader->SetOutput( &object );
144  reader->Update( is );
145  return is;
146 }
148 
149 #endif // itkDOMNodeXMLReader_h
Light weight base class for most itk classes.
Class to represent a node in a Document Object Model (DOM) tree structure.
Definition: itkDOMNode.h:53
SmartPointer< const Self > ConstPointer
static Pointer New()
SmartPointer< Self > Pointer
OutputType::Pointer OutputPointer
Base class for most ITK classes.
Definition: itkObject.h:57
Class to read a DOM object from an XML file or an input stream.