Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//--------------------------------------------------------------------------
// File and Version Information:
// $Id: ErrStreamWrapper.cc,v 1.1.1.1 2005/03/29 17:04:19 steinke Exp $
//
// Description:
// ErrStreamWrapper implementation
//
// Environment:
// Software developed for the BaBar Detector at the SLAC B-Factory.
//
// Author List:
// Gregory Dubois-Felsmann (originator)
//
// Copyright Information:
// Copyright (C) 2004 California Institute of Technology
//
//------------------------------------------------------------------------
//-----------------------
// This Class's Header --
//-----------------------
#include "ErrLogger/ErrStreamWrapper.hh"
//-----------------
// C/C++ Headers --
//-----------------
//-------------------------------
// Collaborating Class Headers --
//-------------------------------
#include "ErrLogger/ErrLog.hh"
using std::endl;
using std::ostream;
//-----------------------------------------------------------------------
// Local Macros, Typedefs, Structures, Unions and Forward Declarations --
//-----------------------------------------------------------------------
// ----------------------------------------
// -- Public Function Member Definitions --
// ----------------------------------------
//----------------
// Constructors --
//----------------
ErrStreamWrapper::ErrStreamWrapper( ostream& os, ErrLog* logger )
: ErrStream( &os, logger )
{
}
//--------------
// Destructor --
//--------------
ErrStreamWrapper::~ErrStreamWrapper()
{ }
//-------------
// Methods --
//-------------
void
ErrStreamWrapper::doEndmsg()
{
if ( logger() != 0 ) {
// We are tied back to a real ErrLog implementation.
// Because this is a wrapper for a real-output stream, there is no
// additional text to output: hence the null pointer passed through.
// The ErrLog is responsible for adding a newline at the end of the
// message, and so can choose between endl and '\n'.
loggerEndmsg( 0 );
}
else {
// No ErrLog is available to do the wrap-up.
// Write a newline, using endl to be conservative about buffering.
static_cast<ostream&>(*this) << endl;
// Handle the termination. This has to be done here, again because there
// is no stateful ErrLog instance to go back to for the termination
// decision for the current message.
defaultTermination();
}
}