Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

WvCircularBufStore Class Reference

#include <wvbufstore.h>

Inherits WvBufStore.

Collaboration diagram for WvCircularBufStore:

[legend]
List of all members.

Detailed Description

The WvCircularBuf storage class.

Definition at line 318 of file wvbufstore.h.

Public Member Functions

 WvCircularBufStore (int _granularity, void *_data, size_t _avail, size_t _size, bool _autofree)
 WvCircularBufStore (int _granularity, size_t _size)
virtual ~WvCircularBufStore ()
void * ptr () const
size_t size () const
bool autofree () const
void setautofree (bool _autofree)
void reset (void *_data, size_t _avail, size_t _size, bool _autofree)
void setavail (size_t _avail)
void normalize ()
virtual size_t used () const
virtual size_t optgettable () const
virtual const void * get (size_t count)
virtual void unget (size_t count)
virtual size_t ungettable () const
virtual void zap ()
virtual size_t free () const
virtual size_t optallocable () const
virtual void * alloc (size_t count)
virtual void unalloc (size_t count)
virtual size_t unallocable () const
virtual void * mutablepeek (int offset, size_t count)
virtual bool isreadable () const
virtual void skip (size_t count)
virtual size_t peekable (int offset) const
virtual size_t optpeekable (int offset) const
virtual const void * peek (int offset, size_t count)
void move (void *buf, size_t count)
void copy (void *buf, int offset, size_t count)
virtual bool iswritable () const
void put (const void *data, size_t count)
void fastput (const void *data, size_t count)
void poke (const void *data, int offset, size_t count)
virtual void merge (WvBufStore &instore, size_t count)
void basicmerge (WvBufStore &instore, size_t count)

Protected Member Functions

size_t ensurecontiguous (int offset, size_t count, bool keephistory)
 Ensures that count new bytes can be read from or written to the buffer beginning at the specified offset as one large contiguous block.

virtual bool usessubbuffers () const
 Returns true if the buffer uses subbuffers for storage.

virtual size_t numsubbuffers () const
 Returns the number of subbuffers in the buffer.

virtual WvBufStorefirstsubbuffer () const
 Returns the first subbuffer.

virtual void appendsubbuffer (WvBufStore *buffer, bool autofree)
 Appends a subbuffer to the buffer.

virtual void prependsubbuffer (WvBufStore *buffer, bool autofree)
 Prepends a subbuffer to the buffer.

virtual bool unlinksubbuffer (WvBufStore *buffer, bool allowautofree)
 Unlinks the specified subbuffer.


Static Protected Member Functions

void compact (void *data, size_t size, size_t head, size_t count)
 Compacts an array arranged as a circular buffer such that the specified region is moved to the beginning of the array.


Protected Attributes

void * data
size_t xsize
size_t head
size_t totalused
size_t totalinit
bool xautofree
int granularity


Constructor & Destructor Documentation

WvCircularBufStore::WvCircularBufStore int  _granularity,
void *  _data,
size_t  _avail,
size_t  _size,
bool  _autofree
 

Definition at line 485 of file wvbufferstore.cc.

References reset(), and WvCircularBufStore().

Referenced by WvCircularBufStore().

WvCircularBufStore::WvCircularBufStore int  _granularity,
size_t  _size
 

Definition at line 493 of file wvbufferstore.cc.

References memops, reset(), and WvCircularBufStore().

WvCircularBufStore::~WvCircularBufStore  )  [virtual]
 

Definition at line 500 of file wvbufferstore.cc.

References data, memops, and xautofree.


Member Function Documentation

void * WvCircularBufStore::alloc size_t  count  )  [virtual]
 

Implements WvBufStore.

Definition at line 592 of file wvbufferstore.cc.

References alloc(), data, ensurecontiguous(), totalinit, totalused, and xsize.

Referenced by alloc().

virtual void WvBufStore::appendsubbuffer WvBufStore buffer,
bool  autofree
[inline, protected, virtual, inherited]
 

Appends a subbuffer to the buffer.

Reimplemented in WvLinkedBufferStore.

Definition at line 109 of file wvbufstore.h.

References WvBufStore::appendsubbuffer().

Referenced by WvBufStore::appendsubbuffer(), and WvBufStore::merge().

bool WvCircularBufStore::autofree  )  const [inline]
 

Definition at line 337 of file wvbufstore.h.

Referenced by WvCircularBufBase< unsigned char >::autofree().

void WvBufStore::basicmerge WvBufStore instore,
size_t  count
[inherited]
 

Definition at line 229 of file wvbufferstore.cc.

References WvBufStore::alloc(), WvBufStore::basicmerge(), WvBufStore::get(), memops, WvBufStore::optallocable(), WvBufStore::optgettable(), and WvBufStore::unalloc().

Referenced by WvBufStore::basicmerge(), and WvBufStore::merge().

void WvCircularBufStore::compact void *  data,
size_t  size,
size_t  head,
size_t  count
[static, protected]
 

Compacts an array arranged as a circular buffer such that the specified region is moved to the beginning of the array.

"data" is the array base "size" is the size of the array "head" is the beginning of the region to keep "count" is the number of bytes in the region to keep

Definition at line 684 of file wvbufferstore.cc.

References compact(), and memops.

Referenced by compact(), ensurecontiguous(), and normalize().

void WvBufStore::copy void *  buf,
int  offset,
size_t  count
[inherited]
 

Definition at line 128 of file wvbufferstore.cc.

References WvBufStore::copy(), memops, WvBufStore::optpeekable(), and WvBufStore::peek().

Referenced by WvBufStore::copy(), and WvBufBaseCommonImpl< unsigned >::copy().

size_t WvCircularBufStore::ensurecontiguous int  offset,
size_t  count,
bool  keephistory
[protected]
 

Ensures that count new bytes can be read from or written to the buffer beginning at the specified offset as one large contiguous block.

"offset" is the offset "count" is the number of bytes "keephistory" is if true, does not purge unget history Returns: the offset of the first available byte

Definition at line 647 of file wvbufferstore.cc.

References compact(), data, ensurecontiguous(), head, totalinit, totalused, and xsize.

Referenced by alloc(), ensurecontiguous(), get(), and mutablepeek().

void WvBufStore::fastput const void *  data,
size_t  count
[inherited]
 

Definition at line 163 of file wvbufferstore.cc.

References WvBufStore::alloc(), WvBufStore::fastput(), and memops.

Referenced by WvBufStore::fastput(), and WvBufBaseCommonImpl< unsigned >::put().

virtual WvBufStore* WvBufStore::firstsubbuffer  )  const [inline, protected, virtual, inherited]
 

Returns the first subbuffer.

Returns: the buffer or NULL if none or not supported

Reimplemented in WvLinkedBufferStore.

Definition at line 105 of file wvbufstore.h.

Referenced by WvBufStore::merge().

size_t WvCircularBufStore::free  )  const [virtual]
 

Implements WvBufStore.

Definition at line 577 of file wvbufferstore.cc.

References totalused, and xsize.

const void * WvCircularBufStore::get size_t  count  )  [virtual]
 

Implements WvBufStore.

Definition at line 543 of file wvbufferstore.cc.

References data, ensurecontiguous(), get(), head, totalused, and xsize.

Referenced by get().

virtual bool WvBufStore::isreadable  )  const [inline, virtual, inherited]
 

Reimplemented in WvBufCursorStore, and WvWriteOnlyBufferStoreMixin< WvReadOnlyBufferStoreMixin< WvBufStore > >.

Definition at line 45 of file wvbufstore.h.

Referenced by WvBufCursorStore::isreadable(), and WvBufBaseCommonImpl< unsigned >::isreadable().

virtual bool WvBufStore::iswritable  )  const [inline, virtual, inherited]
 

Reimplemented in WvBufCursorStore, and WvReadOnlyBufferStoreMixin< WvBufStore >.

Definition at line 68 of file wvbufstore.h.

Referenced by WvBufCursorStore::iswritable().

void WvBufStore::merge WvBufStore instore,
size_t  count
[virtual, inherited]
 

Reimplemented in WvReadOnlyBufferStoreMixin< WvBufStore >.

Definition at line 198 of file wvbufferstore.cc.

References WvBufStore::appendsubbuffer(), WvBufStore::basicmerge(), WvBufStore::firstsubbuffer(), WvBufStore::merge(), WvBufStore::unlinksubbuffer(), WvBufStore::used(), and WvBufStore::usessubbuffers().

Referenced by WvLinkedBufferStore::coalesce(), WvBufStore::merge(), and WvBufBaseCommonImpl< unsigned >::merge().

void WvBufStore::move void *  buf,
size_t  count
[inherited]
 

Definition at line 111 of file wvbufferstore.cc.

References WvBufStore::get(), memops, WvBufStore::move(), and WvBufStore::optgettable().

Referenced by WvBufStore::move(), and WvBufBaseCommonImpl< unsigned >::move().

void * WvCircularBufStore::mutablepeek int  offset,
size_t  count
[virtual]
 

Implements WvBufStore.

Definition at line 621 of file wvbufferstore.cc.

References data, ensurecontiguous(), mutablepeek(), totalinit, and totalused.

Referenced by mutablepeek().

void WvCircularBufStore::normalize  ) 
 

Definition at line 636 of file wvbufferstore.cc.

References compact(), data, head, totalinit, totalused, and xsize.

Referenced by WvCircularBufBase< unsigned char >::normalize().

virtual size_t WvBufStore::numsubbuffers  )  const [inline, protected, virtual, inherited]
 

Returns the number of subbuffers in the buffer.

Reimplemented in WvLinkedBufferStore.

Definition at line 98 of file wvbufstore.h.

size_t WvCircularBufStore::optallocable  )  const [virtual]
 

Reimplemented from WvBufStore.

Definition at line 583 of file wvbufferstore.cc.

References head, totalused, and xsize.

size_t WvCircularBufStore::optgettable  )  const [virtual]
 

Reimplemented from WvBufStore.

Definition at line 534 of file wvbufferstore.cc.

References head, totalused, and xsize.

virtual size_t WvBufStore::optpeekable int  offset  )  const [inline, virtual, inherited]
 

Reimplemented in WvLinkedBufferStore, WvBufCursorStore, and WvWriteOnlyBufferStoreMixin< WvReadOnlyBufferStoreMixin< WvBufStore > >.

Definition at line 56 of file wvbufstore.h.

References WvBufStore::peekable().

Referenced by WvBufStore::copy(), WvBufCursorStore::optgettable(), WvBufCursorStore::optpeekable(), WvLinkedBufferStore::optpeekable(), WvBufBaseCommonImpl< unsigned >::optpeekable(), and WvBufStore::poke().

virtual const void* WvBufStore::peek int  offset,
size_t  count
[inline, virtual, inherited]
 

Reimplemented in WvConstInPlaceBufStore, WvBufCursorStore, and WvWriteOnlyBufferStoreMixin< WvReadOnlyBufferStoreMixin< WvBufStore > >.

Definition at line 58 of file wvbufstore.h.

References WvBufStore::mutablepeek(), and WvBufStore::peek().

Referenced by WvBufStore::copy(), WvBufCursorStore::get(), WvBufStore::peek(), WvBufCursorStore::peek(), and WvBufBaseCommonImpl< unsigned >::peek().

size_t WvBufStore::peekable int  offset  )  const [virtual, inherited]
 

Reimplemented in WvBufCursorStore, and WvWriteOnlyBufferStoreMixin< WvReadOnlyBufferStoreMixin< WvBufStore > >.

Definition at line 90 of file wvbufferstore.cc.

References WvBufStore::peekable(), WvBufStore::ungettable(), and WvBufStore::used().

Referenced by WvLinkedBufferStore::mutablepeek(), WvBufStore::optpeekable(), WvBufBaseCommonImpl< unsigned >::optpeekable(), WvBufStore::peekable(), and WvBufBaseCommonImpl< unsigned >::peekable().

void WvBufStore::poke const void *  data,
int  offset,
size_t  count
[inherited]
 

Definition at line 170 of file wvbufferstore.cc.

References memops, WvBufStore::mutablepeek(), WvBufStore::optpeekable(), WvBufStore::poke(), WvBufStore::put(), and WvBufStore::used().

Referenced by WvBufStore::poke(), and WvBufBaseCommonImpl< unsigned >::poke().

virtual void WvBufStore::prependsubbuffer WvBufStore buffer,
bool  autofree
[inline, protected, virtual, inherited]
 

Prepends a subbuffer to the buffer.

Reimplemented in WvLinkedBufferStore.

Definition at line 113 of file wvbufstore.h.

References WvBufStore::prependsubbuffer().

Referenced by WvBufStore::prependsubbuffer().

void* WvCircularBufStore::ptr  )  const [inline]
 

Definition at line 333 of file wvbufstore.h.

Referenced by WvCircularBufBase< unsigned char >::ptr().

void WvBufStore::put const void *  data,
size_t  count
[inherited]
 

Definition at line 146 of file wvbufferstore.cc.

References WvBufStore::alloc(), memops, WvBufStore::optallocable(), and WvBufStore::put().

Referenced by WvBufStore::poke(), WvBufStore::put(), and WvBufBaseCommonImpl< unsigned >::put().

void WvCircularBufStore::reset void *  _data,
size_t  _avail,
size_t  _size,
bool  _autofree
 

Definition at line 507 of file wvbufferstore.cc.

References data, memops, reset(), setavail(), xautofree, and xsize.

Referenced by reset(), WvCircularBufBase< unsigned char >::reset(), and WvCircularBufStore().

void WvCircularBufStore::setautofree bool  _autofree  )  [inline]
 

Definition at line 339 of file wvbufstore.h.

Referenced by WvCircularBufBase< unsigned char >::setautofree().

void WvCircularBufStore::setavail size_t  _avail  ) 
 

Definition at line 520 of file wvbufferstore.cc.

References head, setavail(), totalinit, totalused, and xsize.

Referenced by reset(), setavail(), and WvCircularBufBase< unsigned char >::setavail().

size_t WvCircularBufStore::size  )  const [inline]
 

Definition at line 335 of file wvbufstore.h.

Referenced by WvCircularBufBase< unsigned char >::size().

virtual void WvBufStore::skip size_t  count  )  [inline, virtual, inherited]
 

Reimplemented in WvBufCursorStore, and WvWriteOnlyBufferStoreMixin< WvReadOnlyBufferStoreMixin< WvBufStore > >.

Definition at line 51 of file wvbufstore.h.

References WvBufStore::skip().

Referenced by WvLinkedBufferStore::coalesce(), WvBufStore::skip(), and WvBufBaseCommonImpl< unsigned >::skip().

void WvCircularBufStore::unalloc size_t  count  )  [virtual]
 

Implements WvBufStore.

Definition at line 606 of file wvbufferstore.cc.

References totalinit, totalused, and unalloc().

Referenced by unalloc().

size_t WvCircularBufStore::unallocable  )  const [virtual]
 

Implements WvBufStore.

Definition at line 615 of file wvbufferstore.cc.

References totalused.

void WvCircularBufStore::unget size_t  count  )  [virtual]
 

Implements WvBufStore.

Definition at line 555 of file wvbufferstore.cc.

References head, totalinit, totalused, unget(), and xsize.

Referenced by unget().

size_t WvCircularBufStore::ungettable  )  const [virtual]
 

Implements WvBufStore.

Definition at line 564 of file wvbufferstore.cc.

References totalinit, and totalused.

virtual bool WvBufStore::unlinksubbuffer WvBufStore buffer,
bool  allowautofree
[inline, protected, virtual, inherited]
 

Unlinks the specified subbuffer.

Only autofrees the buffer if allowautofree == true. Returns: the autofree flag for the buffer

Reimplemented in WvLinkedBufferStore.

Definition at line 121 of file wvbufstore.h.

References WvBufStore::unlinksubbuffer().

Referenced by WvBufStore::merge(), and WvBufStore::unlinksubbuffer().

size_t WvCircularBufStore::used  )  const [virtual]
 

Implements WvBufStore.

Definition at line 528 of file wvbufferstore.cc.

References totalused.

virtual bool WvBufStore::usessubbuffers  )  const [inline, protected, virtual, inherited]
 

Returns true if the buffer uses subbuffers for storage.

Reimplemented in WvLinkedBufferStore.

Definition at line 94 of file wvbufstore.h.

Referenced by WvBufStore::merge().

void WvCircularBufStore::zap  )  [virtual]
 

Implements WvBufStore.

Definition at line 570 of file wvbufferstore.cc.

References head, totalinit, and totalused.


Member Data Documentation

void* WvCircularBufStore::data [protected]
 

Definition at line 321 of file wvbufstore.h.

Referenced by alloc(), ensurecontiguous(), get(), mutablepeek(), normalize(), reset(), and ~WvCircularBufStore().

int WvBufStore::granularity [protected, inherited]
 

Definition at line 31 of file wvbufstore.h.

size_t WvCircularBufStore::head [protected]
 

Definition at line 323 of file wvbufstore.h.

Referenced by ensurecontiguous(), get(), normalize(), optallocable(), optgettable(), setavail(), unget(), and zap().

size_t WvCircularBufStore::totalinit [protected]
 

Definition at line 325 of file wvbufstore.h.

Referenced by alloc(), ensurecontiguous(), mutablepeek(), normalize(), setavail(), unalloc(), unget(), ungettable(), and zap().

size_t WvCircularBufStore::totalused [protected]
 

Definition at line 324 of file wvbufstore.h.

Referenced by alloc(), ensurecontiguous(), free(), get(), mutablepeek(), normalize(), optallocable(), optgettable(), setavail(), unalloc(), unallocable(), unget(), ungettable(), used(), and zap().

bool WvCircularBufStore::xautofree [protected]
 

Definition at line 326 of file wvbufstore.h.

Referenced by reset(), and ~WvCircularBufStore().

size_t WvCircularBufStore::xsize [protected]
 

Definition at line 322 of file wvbufstore.h.

Referenced by alloc(), ensurecontiguous(), free(), get(), normalize(), optallocable(), optgettable(), reset(), setavail(), and unget().


The documentation for this class was generated from the following files:
Generated on Tue Oct 5 01:09:24 2004 for WvStreams by doxygen 1.3.7