| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkLoggerOutput.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:41 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 8 |
|
|
| 9 |
|
Copyright (c) Insight Software Consortium. All rights reserved. |
| 10 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/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 |
IND |
*****PURPOSE. See the above copyright notices for more information. |
| 18 |
|
|
| 19 |
|
=========================================================================*/ |
| 20 |
|
|
| 21 |
|
#ifndef __itkLoggerOutput_h |
| 22 |
|
#define __itkLoggerOutput_h |
| 23 |
|
|
| 24 |
|
#include "itkOutputWindow.h" |
| 25 |
|
#include "itkLogger.h" |
| 26 |
|
|
| 27 |
|
|
| 28 |
|
namespace itk |
| 29 |
|
{ |
| 30 |
|
/** \class LoggerOutput |
| 31 |
|
* \brief This class is meant for overriding itk::OutputWindow to redirect |
| 32 |
|
* messages to itk::Logger. |
| 33 |
|
* |
| 34 |
|
* Text messages that the system should display to the user are sent to |
| 35 |
|
* this object (or subclasses of this object). |
| 36 |
|
* |
| 37 |
|
* |
| 38 |
|
* \author Hee-Su Kim, Compute Science Dept. Kyungpook National University, |
| 39 |
|
* ISIS Center, Georgetown University. |
| 40 |
|
* |
| 41 |
|
* \ingroup OSSystemObjects |
| 42 |
|
*/ |
| 43 |
|
class ITKCommon_EXPORT LoggerOutput : public OutputWindow |
| 44 |
|
{ |
| 45 |
|
public: |
| 46 |
|
/** Standard class typedefs. */ |
| 47 |
|
typedef LoggerOutput Self; |
| 48 |
TDA |
typedef OutputWindow Superclass; |
| 49 |
|
typedef SmartPointer<Self> Pointer; |
| 50 |
TDA |
typedef SmartPointer<const Self> ConstPointer; |
| 51 |
|
|
| 52 |
|
/** Run-time type information (and related methods). */ |
| 53 |
|
itkTypeMacro(LoggerOutput, OutputWindow); |
| 54 |
|
|
| 55 |
|
itkNewMacro(LoggerOutput); |
| 56 |
|
|
| 57 |
|
typedef Logger* LoggerType; |
| 58 |
|
|
| 59 |
|
/** Send a string to display. */ |
| 60 |
|
virtual void DisplayText(const char* t); |
| 61 |
|
|
| 62 |
|
/** Send a string as an error message to display. |
| 63 |
|
* The default implementation calls DisplayText() but subclasses |
| 64 |
|
* could present this message differently. */ |
| 65 |
|
virtual void DisplayErrorText(const char *t); |
| 66 |
|
|
| 67 |
|
/** Send a string as a warningmessage to display. |
| 68 |
|
* The default implementation calls DisplayText() but subclasses |
| 69 |
|
* could present this message differently. */ |
| 70 |
|
virtual void DisplayWarningText(const char *t); |
| 71 |
|
|
| 72 |
|
/** Send a string as a message to display. |
| 73 |
|
* The default implementation calls DisplayText() but subclasses |
| 74 |
|
* could present this message differently. */ |
| 75 |
|
virtual void DisplayGenericOutputText(const char *t); |
| 76 |
|
|
| 77 |
|
/** Send a string as a debug message to display. |
| 78 |
|
* The default implementation calls DisplayText() but subclasses |
| 79 |
|
* could present this message differently. */ |
| 80 |
|
virtual void DisplayDebugText(const char *t); |
| 81 |
|
|
| 82 |
|
itkSetMacro(Logger, LoggerType); |
| 83 |
|
|
| 84 |
|
itkGetMacro(Logger, LoggerType); |
| 85 |
|
|
| 86 |
|
virtual void OverrideITKWindow() |
| 87 |
IND |
**{ |
| 88 |
|
itk::OutputWindow::SetInstance(this); |
| 89 |
IND |
**} |
| 90 |
|
|
| 91 |
|
protected: |
| 92 |
|
LoggerOutput():m_Logger(0) {} |
| 93 |
|
virtual ~LoggerOutput() {} |
| 94 |
|
virtual void PrintSelf(std::ostream& os, Indent indent) const; |
| 95 |
|
|
| 96 |
|
private: |
| 97 |
|
Logger* m_Logger; |
| 98 |
|
}; |
| 99 |
|
|
| 100 |
|
} // end namespace itk |
| 101 |
|
|
| 102 |
|
|
| 103 |
|
#endif // __itkLoggerOutput_h |
| 104 |
|
|