| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkMultipleLogOutput.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:42 $ |
| 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_MultipleLogOutput_h_ |
| 19 |
DEF |
#define __itk_MultipleLogOutput_h_ |
| 20 |
|
|
| 21 |
|
#if defined(_MSC_VER) |
| 22 |
LEN,IND |
***//Warning about: identifier was truncated to '255' characters in the debug information (MVC6.0 Debug) |
| 23 |
IND |
***#pragma warning( disable : 4786 ) |
| 24 |
LEN,IND |
**// warning C4503: 'insert' : decorated name length exceeded, name was truncated |
| 25 |
IND |
**#pragma warning ( disable : 4503 ) |
| 26 |
|
#endif |
| 27 |
|
|
| 28 |
|
|
| 29 |
|
#include <fstream> |
| 30 |
|
#include <set> |
| 31 |
|
|
| 32 |
|
#include "itkLogOutput.h" |
| 33 |
|
|
| 34 |
|
namespace itk |
| 35 |
|
{ |
| 36 |
|
|
| 37 |
|
/** \class MultipleLogOutput |
| 38 |
|
* \brief Class MultipleLogOutput allows writing simultaneously to multiple |
| 39 |
|
* streams. Note that the class derives from std::streambuf and contains a |
| 40 |
|
* std::set<> of LogOutput. |
| 41 |
|
* |
| 42 |
|
* \author Hee-Su Kim, Compute Science Dept. Kyungpook National University, |
| 43 |
|
* ISIS Center, Georgetown University. |
| 44 |
|
* |
| 45 |
|
* \ingroup OSSystemObjects LoggingObjects |
| 46 |
|
*/ |
| 47 |
|
|
| 48 |
|
class ITKCommon_EXPORT MultipleLogOutput : public LogOutput |
| 49 |
|
{ |
| 50 |
|
|
| 51 |
|
public: |
| 52 |
|
|
| 53 |
|
typedef MultipleLogOutput Self; |
| 54 |
TDA |
typedef LogOutput Superclass; |
| 55 |
TDA |
typedef SmartPointer<Self> Pointer; |
| 56 |
TDA |
typedef SmartPointer<const Self> ConstPointer; |
| 57 |
|
|
| 58 |
|
typedef LogOutput OutputType; |
| 59 |
|
|
| 60 |
|
itkTypeMacro(MultipleLogOutput, LogOutput); |
| 61 |
|
|
| 62 |
|
itkNewMacro(MultipleLogOutput); |
| 63 |
|
|
| 64 |
|
public: |
| 65 |
|
|
| 66 |
|
/** Register a additional output stream into the list of LogOutputs to write |
| 67 |
|
* to. The messages will be sent to the streams in the same order that the |
| 68 |
|
* streams have been added here. */ |
| 69 |
|
void AddLogOutput( OutputType * output ); |
| 70 |
|
|
| 71 |
|
|
| 72 |
|
/** Broadcast a flush operation to all the output streams */ |
| 73 |
|
virtual void Flush(); |
| 74 |
|
|
| 75 |
|
/** Write to multiple outputs */ |
| 76 |
|
virtual void Write( double timestamp ); |
| 77 |
|
|
| 78 |
|
/** Write to multiple outputs */ |
| 79 |
|
virtual void Write(const std::string & content ); |
| 80 |
|
|
| 81 |
|
/** Write to a buffer */ |
| 82 |
|
virtual void Write(const std::string & content, double timestamp ); |
| 83 |
|
|
| 84 |
|
|
| 85 |
|
protected: |
| 86 |
|
/** Constructor */ |
| 87 |
|
MultipleLogOutput(); |
| 88 |
|
|
| 89 |
|
/** Destructor */ |
| 90 |
|
virtual ~MultipleLogOutput(); |
| 91 |
|
|
| 92 |
|
private: |
| 93 |
|
|
| 94 |
|
typedef std::set< OutputType::Pointer > ContainerType; |
| 95 |
|
|
| 96 |
|
ContainerType m_Output; |
| 97 |
|
|
| 98 |
|
}; |
| 99 |
|
|
| 100 |
|
} |
| 101 |
|
|
| 102 |
|
#endif //__itk_MultipleLogOutput_h_ |
| 103 |
|
|