ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkXMLFilterWatcher.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkXMLFilterWatcher_h
00019 #define __itkXMLFilterWatcher_h
00020 
00021 #include "itkSimpleFilterWatcher.h"
00022 
00023 namespace itk
00024 {
00031 class XMLFilterWatcher:public SimpleFilterWatcher
00032 {
00033 public:
00034   XMLFilterWatcher(ProcessObject *o, const char *comment = ""):
00035     SimpleFilterWatcher(o, comment) {}
00036 protected:
00037 
00039   virtual void ShowProgress()
00040   {
00041     if ( this->GetProcess() )
00042       {
00043       int steps = this->GetSteps();
00044       steps++;
00045       this->SetSteps(steps);
00046       if ( !this->GetQuiet() )
00047         {
00048         std::cout << "<filter-progress>"
00049                   << this->GetProcess()->GetProgress()
00050                   << "</filter-progress>"
00051                   << std::endl;
00052         std::cout << std::flush;
00053         }
00054       }
00055   }
00057 
00059   virtual void StartFilter()
00060   {
00061     this->SetSteps(0);
00062     this->SetIterations(0);
00063     this->GetTimeProbe().Start();
00064     if ( !this->GetQuiet() )
00065       {
00066       std::cout << "<filter-start>"
00067                 << std::endl;
00068       std::cout << "<filter-name>"
00069                 << ( this->GetProcess()
00070            ? this->GetProcess()->GetNameOfClass() : "None" )
00071                 << "</filter-name>"
00072                 << std::endl;
00073       std::cout << "<filter-comment>"
00074                 << " \"" << this->GetComment() << "\" "
00075                 << "</filter-comment>"
00076                 << std::endl;
00077       std::cout << "</filter-start>"
00078                 << std::endl;
00079       std::cout << std::flush;
00080       }
00081   }
00083 
00085   virtual void EndFilter()
00086   {
00087 #if 0
00088     this - GetTimeProbe().Stop();
00089     if ( !this->GetQuiet() )
00090       {
00091       std::cout << "<filter-end>"
00092                 << std::endl;
00093       std::cout << "<filter-name>"
00094                 << ( this->GetProcess()
00095            ? this->GetProcess()->GetNameOfClass() : "None" )
00096                 << "</filter-name>"
00097                 << std::endl;
00098       std::cout << "<filter-time>"
00099                 << this->GetTimeProbe().GetMeanTime()
00100                 << "</filter-time>"
00101                 << std::endl;
00102       std::cout << "</filter-end>";
00103       std::cout << std::flush;
00104       }
00105 #endif
00106   }
00107 };
00108 } // end namespace itk
00110 
00111 #endif
00112