Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

DatagramOutputFile Class Reference

This class can be used to write a binary file that consists of an arbitrary header followed by a number of datagrams. More...

#include <datagramOutputFile.h>

Inheritance diagram for DatagramOutputFile:

DatagramSink List of all members.

Public Member Functions

 DatagramOutputFile ()
bool open (Filename filename)
 Opens the indicated filename for reading.

bool write_header (const string &header)
 Writes a sequence of bytes to the beginning of the datagram file.

virtual bool put_datagram (const Datagram &data)
 Writes the given datagram to the file.

virtual bool is_error ()
 Returns true if the file has reached an error condition.

void close ()
 Closes the file.


Private Attributes

bool _wrote_first_datagram
bool _error
ofstream _out

Detailed Description

This class can be used to write a binary file that consists of an arbitrary header followed by a number of datagrams.

Definition at line 41 of file datagramOutputFile.h.


Constructor & Destructor Documentation

DatagramOutputFile::DatagramOutputFile  )  [inline]
 

Definition at line 31 of file datagramOutputFile.I.

References _error, _out, _wrote_first_datagram, INLINE, Filename::open_write(), and Filename::set_binary().


Member Function Documentation

void DatagramOutputFile::close  )  [inline]
 

Closes the file.

This is also implicitly done when the DatagramOutputFile destructs.

Definition at line 66 of file datagramOutputFile.I.

bool DatagramOutputFile::is_error  )  [virtual]
 

Returns true if the file has reached an error condition.

Implements DatagramSink.

Definition at line 85 of file datagramOutputFile.cxx.

bool DatagramOutputFile::open Filename  filename  )  [inline]
 

Opens the indicated filename for reading.

Returns true if successful, false on failure.

Definition at line 47 of file datagramOutputFile.I.

References _out, and INLINE.

Referenced by BamFile::is_eof().

bool DatagramOutputFile::put_datagram const Datagram data  )  [virtual]
 

Writes the given datagram to the file.

Returns true on success, false if there is an error.

Implements DatagramSink.

Definition at line 59 of file datagramOutputFile.cxx.

References _error, and _out.

bool DatagramOutputFile::write_header const string &  header  ) 
 

Writes a sequence of bytes to the beginning of the datagram file.

This may be called any number of times after the file has been opened and before the first datagram is written. It may not be called once the first datagram is written.

Definition at line 41 of file datagramOutputFile.cxx.

References _out, _wrote_first_datagram, Datagram::add_uint32(), Datagram::get_data(), and Datagram::get_length().

Referenced by BamFile::is_eof().


Member Data Documentation

bool DatagramOutputFile::_error [private]
 

Definition at line 55 of file datagramOutputFile.h.

Referenced by DatagramOutputFile(), and put_datagram().

ofstream DatagramOutputFile::_out [private]
 

Definition at line 56 of file datagramOutputFile.h.

Referenced by DatagramOutputFile(), open(), put_datagram(), and write_header().

bool DatagramOutputFile::_wrote_first_datagram [private]
 

Definition at line 54 of file datagramOutputFile.h.

Referenced by DatagramOutputFile(), and write_header().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:49:10 2003 for Panda by doxygen1.3