ZStreamRPos_Memory Class Reference

A positionable read stream that gets its data from normal memory. More...

#include <ZStream_Memory.h>

Inheritance diagram for ZStreamRPos_Memory:

ZStreamRPos ZStreamU ZStreamR List of all members.

Public Member Functions

 ZStreamRPos_Memory (const void *iAddress, size_t iSize)
virtual size_t Imp_CountReadable ()
 Returns the number of bytes guaranteed to be readable without blocking.
virtual void Imp_CopyToDispatch (const ZStreamW &iStreamW, uint64 iCount, uint64 *oCountRead, uint64 *oCountWritten)
 Invoke iStreamW's Imp_CopyFrom method.
virtual void Imp_CopyTo (const ZStreamW &iStreamW, uint64 iCount, uint64 *oCountRead, uint64 *oCountWritten)
 Actually copy data from this stream to iStreamW.
virtual void Imp_Skip (uint64 iCount, uint64 *oCountSkipped)
 Read and discard iCount bytes.
const void * GetCurrentAddress ()
 Returns the address from which the next read would be satisfied.

Detailed Description

A positionable read stream that gets its data from normal memory.

ZStreamRPos_Memory provides positionable read stream access to normal memory. If you need to pass a ZStreamR to a method, and want that stream to be sourced from normal memory but want to restrict the range of addresses accessed you should use a ZStreamRPos_Memory, even though its positionable API is not directly required.

See also:
ZStreamR_Memory


Constructor & Destructor Documentation

ZStreamRPos_Memory::ZStreamRPos_Memory ( const void *  iAddress,
size_t  iSize 
)

Parameters:
iAddress The base address from which data is to be read.
iSize The size of the block of memory to which access should be restricted.


Member Function Documentation

size_t ZStreamRPos_Memory::Imp_CountReadable (  )  [virtual]

Returns the number of bytes guaranteed to be readable without blocking.

If the stream does not or cannot know this information it should return zero. A zero return thus does not mean no data is available, simply that a subsequent Read or Skip may block indefinitely.

Reimplemented from ZStreamRPos.

void ZStreamRPos_Memory::Imp_CopyToDispatch ( const ZStreamW iStreamW,
uint64  iCount,
uint64 oCountRead,
uint64 oCountWritten 
) [virtual]

Invoke iStreamW's Imp_CopyFrom method.

The first part of the two-stage dispatch initiated by ZStreamR::CopyTo and ZStreamR::CopyAllTo. Override this method if your stream's data is in memory and thus can be written to iStreamW by a single call to its Write method.

Reimplemented from ZStreamR.

void ZStreamRPos_Memory::Imp_CopyTo ( const ZStreamW iStreamW,
uint64  iCount,
uint64 oCountRead,
uint64 oCountWritten 
) [virtual]

Actually copy data from this stream to iStreamW.

The second part of the two-stage dispatch initiated by ZStreamW::CopyFrom and ZStreamW::CopyAllFrom. The default implementation calls sCopyReadToWrite. Override this method if your stream's data is in memory and thus can be written to iStreamW by a single call to its Write method.

See also:
sCopyReadToWrite

Reimplemented from ZStreamR.

void ZStreamRPos_Memory::Imp_Skip ( uint64  iCount,
uint64 oCountSkipped 
) [virtual]

Read and discard iCount bytes.

Override this method if your stream implementation can skip past bytes in the stream without actually reading them.

Parameters:
iCount Count of bytes to be skipped.
oCountSkipped Number of bytes that were actually skipped. If iCount is non zero and oCountSkipped is set to zero then this indicates that the stream has reached its end.

Reimplemented from ZStreamRPos.


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