ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkXMLFilterWatcher.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 #ifndef __itkXMLFilterWatcher_h
19 #define __itkXMLFilterWatcher_h
20 
21 #include "itkSimpleFilterWatcher.h"
22 
23 namespace itk
24 {
32 {
33 public:
34  XMLFilterWatcher(ProcessObject *o, const char *comment = ""):
35  SimpleFilterWatcher(o, comment) {}
36 protected:
37 
39  virtual void ShowProgress()
40  {
41  if ( this->GetProcess() )
42  {
43  int steps = this->GetSteps();
44  steps++;
45  this->SetSteps(steps);
46  if ( !this->GetQuiet() )
47  {
48  std::cout << "<filter-progress>"
49  << this->GetProcess()->GetProgress()
50  << "</filter-progress>"
51  << std::endl;
52  std::cout << std::flush;
53  }
54  }
55  }
57 
59  virtual void StartFilter()
60  {
61  this->SetSteps(0);
62  this->SetIterations(0);
63  this->GetTimeProbe().Start();
64  if ( !this->GetQuiet() )
65  {
66  std::cout << "<filter-start>"
67  << std::endl;
68  std::cout << "<filter-name>"
69  << ( this->GetProcess()
70  ? this->GetProcess()->GetNameOfClass() : "None" )
71  << "</filter-name>"
72  << std::endl;
73  std::cout << "<filter-comment>"
74  << " \"" << this->GetComment() << "\" "
75  << "</filter-comment>"
76  << std::endl;
77  std::cout << "</filter-start>"
78  << std::endl;
79  std::cout << std::flush;
80  }
81  }
83 
85  virtual void EndFilter()
86  {
87  }
88 };
89 } // end namespace itk
90 
91 #endif
92