Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkLoggerManager.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLoggerManager.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006-02-05 20:57:46 $
00007   Version:   $Revision: 1.6 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/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 __itkLoggerManager_h
00019 #define __itkLoggerManager_h
00020 
00021 #include "itkObject.h"
00022 #include "itkObjectFactory.h"
00023 #include "itkLogger.h"
00024 #include "itkThreadLogger.h"
00025 
00026 #include <string>
00027 #include <map>
00028 
00029 namespace itk
00030 {
00044 class ITKCommon_EXPORT LoggerManager : public Object
00045 {
00046 
00047 public:
00048   
00049   typedef LoggerManager  Self;
00050   typedef Object  Superclass;
00051   typedef SmartPointer<Self>  Pointer;
00052   typedef SmartPointer<const Self>  ConstPointer;
00053 
00055   itkTypeMacro( LoggerManager, Object );
00056 
00058   itkNewMacro( Self );
00059 
00060   typedef Logger::PriorityLevelType   PriorityLevelType;
00061 
00062   typedef Logger::OutputType          OutputType;
00063 
00064   typedef Logger::Pointer             LoggerPointer;
00065   typedef ThreadLogger::Pointer       ThreadLoggerPointer;
00066 
00067   typedef std::string   NameType;
00068 
00070   LoggerPointer CreateLogger( 
00071                           const NameType &name, 
00072                           PriorityLevelType level, 
00073                           PriorityLevelType levelForFlushing = LoggerBase::MUSTFLUSH );
00074 
00076   ThreadLoggerPointer CreateThreadLogger( 
00077                           const NameType &name, 
00078                           PriorityLevelType level, 
00079                           PriorityLevelType levelForFlushing = LoggerBase::MUSTFLUSH );
00080 
00082   void AddLogger( const NameType &name, Logger* logger );
00083 
00084   Logger* GetLogger( const NameType &name);
00085 
00086   void SetPriorityLevel( PriorityLevelType level );
00087 
00088   void SetLevelForFlushing( PriorityLevelType level );
00089 
00090   void AddLogOutput( OutputType* output );
00091 
00092   void Write( PriorityLevelType level, std::string const & content);
00093 
00094   void Flush();
00095 
00096 protected:
00097 
00099   LoggerManager() {}
00100 
00102   virtual ~LoggerManager() {}
00103 
00105   void PrintSelf(std::ostream &s, Indent indent) const;
00106 
00107 private:
00108 
00109   typedef std::map< NameType, LoggerPointer >  ContainerType;
00110 
00111   ContainerType   m_LoggerSet;
00112 
00113 };  // class Logger
00114 
00115 
00116 } // namespace itk
00117 
00118 
00119 #endif  // __itkLoggerManager_h
00120 

Generated at Mon Apr 14 13:26:01 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000