KWStyle - itkStdStreamLogOutput.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkStdStreamLogOutput.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:48 $
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      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17
18 DEF #ifndef __itk_StdStreamLogOutput_h_
19 DEF #define __itk_StdStreamLogOutput_h_
20
21 #include <iostream>
22 #include <string>
23
24 #include "itkMacro.h"
25 #include "itkObject.h"
26 #include "itkObjectFactory.h"
27 #include "itkSimpleFastMutexLock.h"
28 #include "itkLogOutput.h"
29
30
31 namespace itk
32 {
33
34 /** \class StdStreamLogOutput
35  *  \brief Class StdStreamLogOutput represents a standard stream output stream.
36  *  This class provides thread safety for the standard stream output stream.
37  *
38  * \author Hee-Su Kim, Compute Science Dept. Kyungpook National University,
39  *                     ISIS Center, Georgetown University.
40  *
41  *
42  *  \ingroup OSSystemObjects LoggingObjects                    
43  */
44
45 class ITKCommon_EXPORT StdStreamLogOutput : public LogOutput
46 {
47
48 public:
49
50   typedef StdStreamLogOutput Self;
51 TDA   typedef LogOutput  Superclass;
52 TDA   typedef SmartPointer<Self>  Pointer;
53 TDA   typedef SmartPointer<const Self>  ConstPointer;
54
55   typedef std::ostream  StreamType;
56   typedef std::ostream* StreamPointerType;
57
58   itkTypeMacro(StdStreamLogOutput, LogOutput);
59   
60   itkNewMacro(StdStreamLogOutput);
61
62   itkGetMacro(Stream, StreamPointerType);
63
64   /** Set a standard stream pointer */
65   void SetStream(StreamType &Stream);
66   
67   /** flush a buffer */
68   virtual void Flush();
69
70   /** Write to multiple outputs */
71   virtual void Write(double timestamp);
72
73   /** Write to a buffer */
74   virtual void Write(std::string const &content);
75
76   /** Write to a buffer */
77   virtual void Write(std::string const &content, double timestamp);
78
79 protected:
80   /** Constructor */
81   StdStreamLogOutput();
82
83   /** Destructor */
84   virtual ~StdStreamLogOutput();
85
86   void PrintSelf(std::ostream &os, Indent indent) const;
87
88 private:
89
90   StreamPointerType m_Stream;
91
92   SimpleFastMutexLock m_Mutex;
93 };
94
95 }
96
97 #endif //__itk_StdStreamLogOutput_h_
98

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:48PM
© Kitware Inc.