IGSTK
igstkVTKLoggerOutput.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkVTKLoggerOutput.h,v $
5  Language: C++
6  Date: $Date: 2008-02-11 01:41:51 $
7  Version: $Revision: 1.11 $
8 
9  Copyright (c) ISC Insight Software Consortium. All rights reserved.
10  See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.
11 
12  Portions of this code are covered under the VTK copyright.
13  See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
14 
15  This software is distributed WITHOUT ANY WARRANTY; without even
16  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
17  PURPOSE. See the above copyright notices for more information.
18 
19 =========================================================================*/
20 
21 #ifndef __igstkVTKLoggerOutput_h
22 #define __igstkVTKLoggerOutput_h
23 
24 #include <vtkOutputWindow.h>
25 #include <vtkSmartPointer.h>
26 #include <igstkLogger.h>
27 #include "igstkMacros.h"
28 
29 
30 namespace igstk
31 {
46 class VTKLoggerOutput : public vtkOutputWindow
47 {
48 public:
51  typedef vtkOutputWindow Superclass;
52  typedef vtkSmartPointer<Self> Pointer;
53  typedef vtkSmartPointer<const Self> ConstPointer;
54 
56  igstkTypeMacro(VTKLoggerOutput, vtkOutputWindow);
57 
59  static VTKLoggerOutput* New();
60 
62  virtual void DisplayText(const char* t);
63 
67  virtual void DisplayErrorText(const char *t);
68 
72  virtual void DisplayWarningText(const char *t);
73 
77  virtual void DisplayGenericWarningText(const char *t);
78 
82  virtual void DisplayDebugText(const char *t);
83 
88  virtual void OverrideVTKWindow();
89 
91  typedef std::ostream StdOStreamType;
92 
94  void Print(StdOStreamType& os);
95 
98 
101  igstkGetMacro( NumberOfErrorMessages, unsigned int );
102 
105  igstkGetMacro( NumberOfWarningMessages, unsigned int );
106 
107 protected:
109  VTKLoggerOutput();
110 
112  virtual ~VTKLoggerOutput();
113 
115  void UnRegister(vtkObjectBase *o);
116 
118  void PrintSelf(StdOStreamType& os, itk::Indent indent) const;
119 
120 private:
121 
123  int m_InUnRegister;
124 
129  unsigned int m_NumberOfErrorMessages;
130 
135  unsigned int m_NumberOfWarningMessages;
136 
137 };
138 
140 std::ostream& operator<<(std::ostream& os, VTKLoggerOutput& o);
141 } // end namespace igstk
142 
143 
144 #endif // __igstkVTKLoggerOutput_h