| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkMultipleLogOutput.cxx.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 |
DEF |
=========================================================================*/ |
| 17 |
|
|
| 18 |
|
#if defined(_MSC_VER) |
| 19 |
LEN,IND |
***//Warning about: identifier was truncated to '255' characters in the debug information (MVC6.0 Debug) |
| 20 |
|
#pragma warning( disable : 4786 ) |
| 21 |
|
#endif |
| 22 |
|
|
| 23 |
|
#include "itkMultipleLogOutput.h" |
| 24 |
|
|
| 25 |
|
namespace itk |
| 26 |
|
{ |
| 27 |
|
|
| 28 |
|
|
| 29 |
|
MultipleLogOutput::MultipleLogOutput() |
| 30 |
|
{ |
| 31 |
|
this->m_Output.clear(); |
| 32 |
|
} |
| 33 |
|
|
| 34 |
|
|
| 35 |
EML |
|
| 36 |
|
MultipleLogOutput::~MultipleLogOutput() |
| 37 |
|
{ |
| 38 |
IND |
// this->Flush(); |
| 39 |
|
} |
| 40 |
|
|
| 41 |
|
|
| 42 |
EML |
|
| 43 |
|
/** Adds an output stream to the MultipleLogOutput for writing. */ |
| 44 |
|
void |
| 45 |
|
MultipleLogOutput::AddLogOutput( OutputType * output ) |
| 46 |
|
{ |
| 47 |
|
this->m_Output.insert( output ); // insert the address |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
|
| 51 |
EML |
|
| 52 |
|
/** The Flush method flushes all the streams. */ |
| 53 |
|
void |
| 54 |
|
MultipleLogOutput::Flush( void ) |
| 55 |
|
{ |
| 56 |
|
ContainerType::iterator itr = m_Output.begin(); |
| 57 |
|
ContainerType::iterator end = m_Output.end(); |
| 58 |
|
|
| 59 |
|
while( itr != end ) |
| 60 |
|
{ |
| 61 |
|
(*itr)->Flush(); |
| 62 |
|
++itr; |
| 63 |
|
} |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
|
| 67 |
EML |
|
| 68 |
|
/** Write to multiple outputs */ |
| 69 |
|
void MultipleLogOutput::Write( double timestamp ) |
| 70 |
|
{ |
| 71 |
|
ContainerType::iterator itr = m_Output.begin(); |
| 72 |
|
ContainerType::iterator end = m_Output.end(); |
| 73 |
|
|
| 74 |
|
while( itr != end ) |
| 75 |
|
{ |
| 76 |
|
(*itr)->Write( timestamp ); |
| 77 |
|
++itr; |
| 78 |
|
} |
| 79 |
|
} |
| 80 |
|
|
| 81 |
|
|
| 82 |
EML |
|
| 83 |
|
/** Write to multiple outputs */ |
| 84 |
|
void MultipleLogOutput::Write( const std::string & content ) |
| 85 |
|
{ |
| 86 |
|
ContainerType::iterator itr = m_Output.begin(); |
| 87 |
|
ContainerType::iterator end = m_Output.end(); |
| 88 |
|
|
| 89 |
|
while( itr != end ) |
| 90 |
|
{ |
| 91 |
|
(*itr)->Write( content ); |
| 92 |
|
++itr; |
| 93 |
|
} |
| 94 |
|
} |
| 95 |
|
|
| 96 |
|
|
| 97 |
EML |
|
| 98 |
|
/** Write to a buffer */ |
| 99 |
|
void MultipleLogOutput::Write( const std::string & content, double timestamp ) |
| 100 |
|
{ |
| 101 |
|
ContainerType::iterator itr = m_Output.begin(); |
| 102 |
|
ContainerType::iterator end = m_Output.end(); |
| 103 |
|
|
| 104 |
|
while( itr != end ) |
| 105 |
|
{ |
| 106 |
|
(*itr)->Write( content, timestamp ); |
| 107 |
|
++itr; |
| 108 |
|
} |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
|
| 112 |
|
} |
| 113 |
|
|
| 114 |
EOF |
|