IGSTK
|
00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkFLTKTextBufferLogOutput.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-02-11 01:41:50 $ 00007 Version: $Revision: 1.9 $ 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 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 00018 #ifndef __igstkFLTKTextBufferLogOutput_h 00019 #define __igstkFLTKTextBufferLogOutput_h 00020 00021 #include <iostream> 00022 #include <string> 00023 00024 #include "itkObject.h" 00025 #include "itkObjectFactory.h" 00026 #include "itkSimpleFastMutexLock.h" 00027 #include "itkLogOutput.h" 00028 00029 #include <FL/Fl_Text_Buffer.H> 00030 00031 #include "igstkMacros.h" 00032 #include "igstkStateMachine.h" 00033 00034 00035 namespace igstk 00036 { 00037 00045 class FLTKTextBufferLogOutput : public ::itk::LogOutput 00046 { 00047 00048 public: 00049 00051 igstkStandardClassTraitsMacro( FLTKTextBufferLogOutput, ::itk::LogOutput ) 00052 00053 00054 igstkLoggerMacro() 00055 00056 00057 public: 00058 00059 typedef Fl_Text_Buffer StreamType; 00060 typedef StreamType* StreamPointerType; 00061 00063 igstkGetMacro(Stream, StreamPointerType); 00064 00066 void SetStream(StreamType &Stream); 00067 00069 virtual void Flush(); 00070 00072 virtual void Write(double timestamp); 00073 00075 virtual void Write(std::string const &content); 00076 00078 virtual void Write(std::string const &content, double timestamp); 00079 00080 protected: 00082 FLTKTextBufferLogOutput(); 00083 00085 virtual ~FLTKTextBufferLogOutput(); 00086 00088 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; 00089 00090 private: 00091 00093 StreamPointerType m_Stream; 00094 00096 itk::SimpleFastMutexLock m_Mutex; 00097 }; 00098 00099 } // end namespace igstk 00100 00101 #endif //__igstk_FLTKTextBufferLogOutput_h_