ITK  4.2.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 
92  itkGetObjectMacro( Output, OutputType );
93 
95  itkGetConstObjectMacro( Output, OutputType );
96 
101  void Update( std::istream& is );
102 
106  virtual void Update();
107 
111  virtual void StartElement( const char* name, const char** atts );
112 
116  virtual void EndElement( const char* name );
117 
121  virtual void CharacterDataHandler( const char* text, int len );
122 
123 protected:
125 
126 private:
127  DOMNodeXMLReader(const Self &); //purposely not implemented
128  void operator=(const Self &); //purposely not implemented
129 
131  std::string m_FileName;
132 
135 
138 };
139 
140 } // namespace itk
141 
143 inline std::istream& operator>>( std::istream& is, itk::DOMNode& object )
144 {
146  reader->SetOutput( &object );
147  reader->Update( is );
148  return is;
149 }
151 
152 #endif // __itkDOMNodeXMLReader_h
153