IGSTK
|
00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkVTKLoggerOutput.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-02-11 01:41:51 $ 00007 Version: $Revision: 1.11 $ 00008 00009 Copyright (c) ISC Insight Software Consortium. All rights reserved. 00010 See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details. 00011 00012 Portions of this code are covered under the VTK copyright. 00013 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details. 00014 00015 This software is distributed WITHOUT ANY WARRANTY; without even 00016 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00017 PURPOSE. See the above copyright notices for more information. 00018 00019 =========================================================================*/ 00020 00021 #ifndef __igstkVTKLoggerOutput_h 00022 #define __igstkVTKLoggerOutput_h 00023 00024 #include <vtkOutputWindow.h> 00025 #include <vtkSmartPointer.h> 00026 #include <igstkLogger.h> 00027 #include "igstkMacros.h" 00028 00029 00030 namespace igstk 00031 { 00046 class VTKLoggerOutput : public vtkOutputWindow 00047 { 00048 public: 00050 typedef VTKLoggerOutput Self; 00051 typedef vtkOutputWindow Superclass; 00052 typedef vtkSmartPointer<Self> Pointer; 00053 typedef vtkSmartPointer<const Self> ConstPointer; 00054 00056 igstkTypeMacro(VTKLoggerOutput, vtkOutputWindow); 00057 00059 static VTKLoggerOutput* New(); 00060 00062 virtual void DisplayText(const char* t); 00063 00067 virtual void DisplayErrorText(const char *t); 00068 00072 virtual void DisplayWarningText(const char *t); 00073 00077 virtual void DisplayGenericWarningText(const char *t); 00078 00082 virtual void DisplayDebugText(const char *t); 00083 00088 virtual void OverrideVTKWindow(); 00089 00091 typedef std::ostream StdOStreamType; 00092 00094 void Print(StdOStreamType& os); 00095 00097 igstkLoggerMacro(); 00098 00101 igstkGetMacro( NumberOfErrorMessages, unsigned int ); 00102 00105 igstkGetMacro( NumberOfWarningMessages, unsigned int ); 00106 00107 protected: 00109 VTKLoggerOutput(); 00110 00112 virtual ~VTKLoggerOutput(); 00113 00115 void UnRegister(vtkObjectBase *o); 00116 00118 void PrintSelf(StdOStreamType& os, itk::Indent indent) const; 00119 00120 private: 00121 00123 int m_InUnRegister; 00124 00129 unsigned int m_NumberOfErrorMessages; 00130 00135 unsigned int m_NumberOfWarningMessages; 00136 00137 }; 00138 00140 std::ostream& operator<<(std::ostream& os, VTKLoggerOutput& o); 00141 } // end namespace igstk 00142 00143 00144 #endif // __igstkVTKLoggerOutput_h