MsgFileOStream Class Reference

#include <MsgFileOStream.h>

Inheritance diagram for MsgFileOStream:

MsgOStream List of all members.

Public Types

typedef int openmode

Public Member Functions

 MsgFileOStream ()
 MsgFileOStream (const char *name, openmode mode)
 ~MsgFileOStream ()
const char * GetName () const
ostream & Os () const
void Close ()

Private Attributes

string fFileName
ofstream * fOfstream

Detailed Description

Definition at line 32 of file MsgFileOStream.h.


Member Typedef Documentation

typedef int MsgFileOStream::openmode

Definition at line 44 of file MsgFileOStream.h.


Constructor & Destructor Documentation

MsgFileOStream::MsgFileOStream (  )  [inline]

Definition at line 48 of file MsgFileOStream.h.

00048 { }

MsgFileOStream::MsgFileOStream ( const char *  name,
openmode  mode 
)

Definition at line 25 of file MsgFileOStream.cxx.

References fFileName, and fOfstream.

00025                                                               :
00026   fFileName(name)
00027 {
00028 //======================================================================
00029 // Purpose: Create an output file stream with a given name and open
00030 //          the file using a specified mode
00031 //
00032 // Inputs: name - The name of the file to attach to this stream
00033 //         mode - The mode to open the file with
00034 //======================================================================
00035   // Open a file using this name
00036 
00037   fOfstream = new ofstream(fFileName.c_str(), mode);
00038 }

MsgFileOStream::~MsgFileOStream (  ) 

Definition at line 42 of file MsgFileOStream.cxx.

References fOfstream.

00043 {
00044 //======================================================================
00045 // Purpose: Destroy a file output stream
00046 //======================================================================
00047   // Flush and close the file
00048   fOfstream->flush();
00049   fOfstream->close();
00050   delete fOfstream;
00051 }


Member Function Documentation

void MsgFileOStream::Close (  )  [virtual]

Reimplemented from MsgOStream.

Definition at line 12 of file MsgFileOStream.cxx.

References fOfstream, and MsgOStream::SubtractReference().

Referenced by MsgOStreamServiceValidate::TestMsgFileOStream().

00013 {
00014 //======================================================================
00015 // Purpose: Register a close request for this file. Don't actually close
00016 //          the file until all clients have registered requests
00017 //======================================================================
00018   if (SubtractReference()==0) { 
00019     fOfstream->close();
00020   }
00021 }

const char * MsgFileOStream::GetName (  )  const [virtual]

Implements MsgOStream.

Definition at line 55 of file MsgFileOStream.cxx.

References fFileName.

Referenced by MsgOStreamServiceValidate::TestMsgFileOStream().

00056 {
00057 //======================================================================
00058 // Purpose: Return the name of this stream
00059 //======================================================================
00060   return fFileName.c_str();
00061 }

ostream & MsgFileOStream::Os (  )  const [virtual]

Implements MsgOStream.

Definition at line 65 of file MsgFileOStream.cxx.

References fOfstream.

Referenced by MsgOStreamServiceValidate::TestMsgFileOStream().

00066 {
00067 //======================================================================
00068 // Purpose: Return the output stream connected to this stream
00069 //======================================================================
00070   return *fOfstream;
00071 }


Member Data Documentation

string MsgFileOStream::fFileName [private]

Definition at line 56 of file MsgFileOStream.h.

Referenced by GetName(), and MsgFileOStream().

ofstream* MsgFileOStream::fOfstream [private]

Definition at line 57 of file MsgFileOStream.h.

Referenced by Close(), MsgFileOStream(), Os(), and ~MsgFileOStream().


The documentation for this class was generated from the following files:
Generated on Fri Oct 10 22:45:55 2014 for loon by  doxygen 1.4.7