ZStreamW_Count Class Reference

A write filter stream that counts the number of bytes written to it. More...

#include <ZStream_Count.h>

Inheritance diagram for ZStreamW_Count:

ZStreamW List of all members.

Public Member Functions

 ZStreamW_Count (const ZStreamW &iStreamSink)
 ZStreamW_Count ()
virtual void Imp_CopyFromDispatch (const ZStreamR &iStreamR, uint64 iCount, uint64 *oCountRead, uint64 *oCountWritten)
 Invoke iStreamR's Imp_CopyTo method.
virtual void Imp_CopyFrom (const ZStreamR &iStreamR, uint64 iCount, uint64 *oCountRead, uint64 *oCountWritten)
 Actually copy data to this stream from iStreamR.
uint64 GetCount ()
 Returns the number of bytes written since construction or the last call to ZeroCount.
void ZeroCount ()
 Resets our counter back to zero.

Detailed Description

A write filter stream that counts the number of bytes written to it.

Writes are satisfied by calling through to the real stream and the number of bytes succesfully written is accumulated. Call GetCount to find how many bytes have been written. Call ZeroCount to reset that count.

Note:
GetCount returns the number of bytes that have been written by calling Write/SkipWrite/CopyFrom against the ZStreamW_Count itself. It obviously has no way of knowing how many bytes have been written to the referenced real stream.


Constructor & Destructor Documentation

ZStreamW_Count::ZStreamW_Count ( const ZStreamW iStreamSink  ) 

Parameters:
iStreamSink The stream to which data is to be written.

ZStreamW_Count::ZStreamW_Count (  ) 

The stream will count data written to it, but as it has no write stream the data will just be discarded.


Member Function Documentation

void ZStreamW_Count::Imp_CopyFromDispatch ( const ZStreamR iStreamR,
uint64  iCount,
uint64 oCountRead,
uint64 oCountWritten 
) [virtual]

Invoke iStreamR's Imp_CopyTo method.

The first part of the two-stage dispatch initiated by ZStreamW::CopyFrom and ZStreamW::CopyAllFrom. Override if your stream's data is in memory and thus iStreamR can have its Read method called with your stream's data as its destination.

Reimplemented from ZStreamW.

void ZStreamW_Count::Imp_CopyFrom ( const ZStreamR iStreamR,
uint64  iCount,
uint64 oCountRead,
uint64 oCountWritten 
) [virtual]

Actually copy data to this stream from iStreamR.

The second part of the two-stage dispatch initiated by ZStreamR::CopyTo and ZStreamR::CopyAllTo. The default implementation calls sCopyReadToWrite. Override this method if your stream's data is in memory and thus can be modified by calling iStreamR's Read method.

See also:
sCopyReadToWrite

Reimplemented from ZStreamW.


The documentation for this class was generated from the following files:
Generated on Thu Jul 26 11:22:05 2007 for ZooLib by  doxygen 1.4.7