Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkXMLFilterWatcher.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkXMLFilterWatcher.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-03-03 15:11:53 $
00007   Version:   $Revision: 1.6 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkXMLFilterWatcher_h
00018 #define __itkXMLFilterWatcher_h
00019 
00020 #include "itkSimpleFilterWatcher.h"
00021 
00022 namespace itk
00023 {
00024 
00030 class XMLFilterWatcher: public SimpleFilterWatcher
00031 {
00032 public:
00033   XMLFilterWatcher(ProcessObject* o, const char *comment="")
00034     : SimpleFilterWatcher(o, comment) {};
00035 
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 };
00109 
00110 } // end namespace itk
00111 
00112 #endif
00113 

Generated at Fri Apr 16 20:04:41 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000