IGSTK
|
00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkFLTKTextLogOutput.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-02-11 01:41:50 $ 00007 Version: $Revision: 1.8 $ 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 __igstkFLTKTextLogOutput_h 00019 #define __igstkFLTKTextLogOutput_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 #include <FL/Fl_Text_Display.H> 00031 00032 #include "igstkMacros.h" 00033 #include "igstkStateMachine.h" 00034 00035 00036 namespace igstk 00037 { 00038 00047 class FLTKTextLogOutput : public ::itk::LogOutput 00048 { 00049 00050 public: 00051 00053 igstkStandardClassTraitsMacro( FLTKTextLogOutput, ::itk::LogOutput ) 00054 00055 public: 00056 00057 typedef Fl_Text_Display StreamType; 00058 typedef StreamType* StreamPointerType; 00059 00061 igstkGetMacro(Stream, StreamPointerType); 00062 00064 void SetStream(StreamType &Stream); 00065 00067 virtual void Flush(); 00068 00070 virtual void Write(double timestamp); 00071 00073 virtual void Write(std::string const &content); 00074 00076 virtual void Write(std::string const &content, double timestamp); 00077 00078 protected: 00080 FLTKTextLogOutput(); 00081 00083 virtual ~FLTKTextLogOutput(); 00084 00086 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; 00087 00088 private: 00089 00091 StreamPointerType m_Stream; 00092 00094 itk::SimpleFastMutexLock m_Mutex; 00095 }; 00096 00097 } // end namespace igstk 00098 00099 #endif //__igstk_FLTKTextLogOutput_h_