ITK  4.4.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 
25 #include <istream>
26 
27 namespace itk
28 {
29 
60 class DOMNodeXMLReader : public Object
61 {
62 public:
63 
66  typedef Object Superclass;
69 
71  itkNewMacro(Self);
72 
74  itkTypeMacro(DOMNodeXMLReader, Object);
75 
76  typedef DOMNode OutputType;
78 
80  itkSetStringMacro(FileName);
81 
83  itkGetStringMacro(FileName);
84 
89  itkSetObjectMacro( Output, OutputType );
90  itkGetModifiableObjectMacro(Output, OutputType );
92 
97  void Update( std::istream& is );
98 
102  virtual void Update();
103 
107  virtual void StartElement( const char* name, const char** atts );
108 
112  virtual void EndElement( const char* name );
113 
117  virtual void CharacterDataHandler( const char* text, int len );
118 
119 protected:
121 
122 private:
123  DOMNodeXMLReader(const Self &); //purposely not implemented
124  void operator=(const Self &); //purposely not implemented
125 
127  std::string m_FileName;
128 
131 
134 };
135 
136 } // namespace itk
137 
139 inline std::istream& operator>>( std::istream& is, itk::DOMNode& object )
140 {
142  reader->SetOutput( &object );
143  reader->Update( is );
144  return is;
145 }
147 
148 #endif // __itkDOMNodeXMLReader_h
149