WvStreams
WvCircularBufStore Class Reference

The WvCircularBuf storage class. More...

#include <wvbufstore.h>

Inheritance diagram for WvCircularBufStore:

Public Member Functions

 WvCircularBufStore (int _granularity, void *_data, size_t _avail, size_t _size, bool _autofree)
 WvCircularBufStore (int _granularity, size_t _size)
void * ptr () const
size_t size () const
bool get_autofree () const
void set_autofree (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)
 WvCircularBufStore (int _granularity, void *_data, size_t _avail, size_t _size, bool _autofree)
 WvCircularBufStore (int _granularity, size_t _size)
void * ptr () const
size_t size () const
bool get_autofree () const
void set_autofree (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 bool isreadable () const
virtual void skip (size_t count)
virtual void skip (size_t count)
virtual size_t peekable (int offset) const
virtual size_t peekable (int offset) const
virtual size_t optpeekable (int offset) const
virtual size_t optpeekable (int offset) const
virtual const void * peek (int offset, size_t count)
virtual const void * peek (int offset, size_t count)
void move (void *buf, size_t count)
void move (void *buf, size_t count)
void copy (void *buf, int offset, size_t count)
void copy (void *buf, int offset, size_t count)
virtual bool iswritable () const
virtual bool iswritable () const
void put (const void *data, size_t count)
void put (const void *data, size_t count)
void fastput (const void *data, size_t count)
void fastput (const void *data, size_t count)
void poke (const void *data, int offset, size_t count)
void poke (const void *data, int offset, size_t count)
virtual void merge (WvBufStore &instore, size_t count)
virtual void merge (WvBufStore &instore, size_t count)
void basicmerge (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.
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 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 size_t numsubbuffers () const
 Returns the number of subbuffers in the buffer.
virtual WvBufStorefirstsubbuffer () const
 Returns the first subbuffer.
virtual WvBufStorefirstsubbuffer () const
 Returns the first subbuffer.
virtual void appendsubbuffer (WvBufStore *buffer, bool autofree)
 Appends a subbuffer to the buffer.
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 void prependsubbuffer (WvBufStore *buffer, bool autofree)
 Prepends a subbuffer to the buffer.
virtual bool unlinksubbuffer (WvBufStore *buffer, bool allowautofree)
 Unlinks the specified subbuffer.
virtual bool unlinksubbuffer (WvBufStore *buffer, bool allowautofree)
 Unlinks the specified subbuffer.

Static Protected Member Functions

static 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.
static 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

Detailed Description

The WvCircularBuf storage class.

Definition at line 320 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufstore.h.

Constructor & Destructor Documentation

◆ WvCircularBufStore() [1/2]

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

Definition at line 485 of file wvbufferstore.cc.

◆ WvCircularBufStore() [2/2]

WvCircularBufStore::WvCircularBufStore ( int _granularity,
size_t _size )

Definition at line 493 of file wvbufferstore.cc.

◆ ~WvCircularBufStore()

WvCircularBufStore::~WvCircularBufStore ( )
virtual

Definition at line 500 of file wvbufferstore.cc.

Member Function Documentation

◆ ptr() [1/2]

void * WvCircularBufStore::ptr ( ) const
inline

◆ size() [1/2]

size_t WvCircularBufStore::size ( ) const
inline

◆ get_autofree() [1/2]

bool WvCircularBufStore::get_autofree ( ) const
inline

◆ set_autofree() [1/2]

void WvCircularBufStore::set_autofree ( bool _autofree)
inline

◆ reset()

void WvCircularBufStore::reset ( void * _data,
size_t _avail,
size_t _size,
bool _autofree = false )

Definition at line 507 of file wvbufferstore.cc.

◆ setavail()

void WvCircularBufStore::setavail ( size_t _avail)

Definition at line 520 of file wvbufferstore.cc.

◆ normalize()

void WvCircularBufStore::normalize ( )

Definition at line 636 of file wvbufferstore.cc.

◆ used() [1/2]

size_t WvCircularBufStore::used ( ) const
virtual

Implements WvBufStore.

Definition at line 528 of file wvbufferstore.cc.

◆ optgettable() [1/2]

size_t WvCircularBufStore::optgettable ( ) const
virtual

Reimplemented from WvBufStore.

Definition at line 534 of file wvbufferstore.cc.

◆ get() [1/2]

const void * WvCircularBufStore::get ( size_t count)
virtual

Implements WvBufStore.

Definition at line 543 of file wvbufferstore.cc.

◆ unget() [1/2]

void WvCircularBufStore::unget ( size_t count)
virtual

Implements WvBufStore.

Definition at line 555 of file wvbufferstore.cc.

◆ ungettable() [1/2]

size_t WvCircularBufStore::ungettable ( ) const
virtual

Implements WvBufStore.

Definition at line 564 of file wvbufferstore.cc.

◆ zap() [1/2]

void WvCircularBufStore::zap ( )
virtual

Implements WvBufStore.

Definition at line 570 of file wvbufferstore.cc.

◆ free() [1/2]

size_t WvCircularBufStore::free ( ) const
virtual

Implements WvBufStore.

Definition at line 577 of file wvbufferstore.cc.

◆ optallocable() [1/2]

size_t WvCircularBufStore::optallocable ( ) const
virtual

Reimplemented from WvBufStore.

Definition at line 583 of file wvbufferstore.cc.

◆ alloc() [1/2]

void * WvCircularBufStore::alloc ( size_t count)
virtual

Implements WvBufStore.

Definition at line 592 of file wvbufferstore.cc.

◆ unalloc() [1/2]

void WvCircularBufStore::unalloc ( size_t count)
virtual

Implements WvBufStore.

Definition at line 606 of file wvbufferstore.cc.

◆ unallocable() [1/2]

size_t WvCircularBufStore::unallocable ( ) const
virtual

Implements WvBufStore.

Definition at line 615 of file wvbufferstore.cc.

◆ mutablepeek() [1/2]

void * WvCircularBufStore::mutablepeek ( int offset,
size_t count )
virtual

Implements WvBufStore.

Definition at line 621 of file wvbufferstore.cc.

◆ ensurecontiguous() [1/2]

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().

◆ compact() [1/2]

void WvCircularBufStore::compact ( void * data,
size_t size,
size_t head,
size_t count )
staticprotected

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.

Referenced by ensurecontiguous().

◆ ptr() [2/2]

void * WvCircularBufStore::ptr ( ) const
inline

Definition at line 335 of file include/wvbufstore.h.

◆ size() [2/2]

size_t WvCircularBufStore::size ( ) const
inline

Definition at line 337 of file include/wvbufstore.h.

◆ get_autofree() [2/2]

bool WvCircularBufStore::get_autofree ( ) const
inline

Definition at line 339 of file include/wvbufstore.h.

◆ set_autofree() [2/2]

void WvCircularBufStore::set_autofree ( bool _autofree)
inline

Definition at line 341 of file include/wvbufstore.h.

◆ used() [2/2]

virtual size_t WvCircularBufStore::used ( ) const
virtual

Implements WvBufStore.

◆ optgettable() [2/2]

virtual size_t WvCircularBufStore::optgettable ( ) const
virtual

Reimplemented from WvBufStore.

◆ get() [2/2]

virtual const void * WvCircularBufStore::get ( size_t count)
virtual

Implements WvBufStore.

◆ unget() [2/2]

virtual void WvCircularBufStore::unget ( size_t count)
virtual

Implements WvBufStore.

◆ ungettable() [2/2]

virtual size_t WvCircularBufStore::ungettable ( ) const
virtual

Implements WvBufStore.

◆ zap() [2/2]

virtual void WvCircularBufStore::zap ( )
virtual

Implements WvBufStore.

◆ free() [2/2]

virtual size_t WvCircularBufStore::free ( ) const
virtual

Implements WvBufStore.

◆ optallocable() [2/2]

virtual size_t WvCircularBufStore::optallocable ( ) const
virtual

Reimplemented from WvBufStore.

◆ alloc() [2/2]

virtual void * WvCircularBufStore::alloc ( size_t count)
virtual

Implements WvBufStore.

◆ unalloc() [2/2]

virtual void WvCircularBufStore::unalloc ( size_t count)
virtual

Implements WvBufStore.

◆ unallocable() [2/2]

virtual size_t WvCircularBufStore::unallocable ( ) const
virtual

Implements WvBufStore.

◆ mutablepeek() [2/2]

virtual void * WvCircularBufStore::mutablepeek ( int offset,
size_t count )
virtual

Implements WvBufStore.

◆ ensurecontiguous() [2/2]

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

◆ compact() [2/2]

void WvCircularBufStore::compact ( void * data,
size_t size,
size_t head,
size_t count )
staticprotected

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

◆ isreadable() [1/2]

virtual bool WvBufStore::isreadable ( ) const
inlinevirtualinherited

◆ isreadable() [2/2]

virtual bool WvBufStore::isreadable ( ) const
inlinevirtualinherited

Definition at line 47 of file include/wvbufstore.h.

◆ skip() [1/2]

virtual void WvBufStore::skip ( size_t count)
inlinevirtualinherited

◆ skip() [2/2]

virtual void WvBufStore::skip ( size_t count)
inlinevirtualinherited

Definition at line 53 of file include/wvbufstore.h.

◆ peekable()

size_t WvBufStore::peekable ( int offset) const
virtualinherited

Definition at line 90 of file wvbufferstore.cc.

◆ optpeekable() [1/2]

virtual size_t WvBufStore::optpeekable ( int offset) const
inlinevirtualinherited

◆ optpeekable() [2/2]

virtual size_t WvBufStore::optpeekable ( int offset) const
inlinevirtualinherited

Definition at line 58 of file include/wvbufstore.h.

◆ peek() [1/2]

virtual const void * WvBufStore::peek ( int offset,
size_t count )
inlinevirtualinherited

◆ peek() [2/2]

virtual const void * WvBufStore::peek ( int offset,
size_t count )
inlinevirtualinherited

Definition at line 60 of file include/wvbufstore.h.

◆ move()

void WvBufStore::move ( void * buf,
size_t count )
inherited

Definition at line 111 of file wvbufferstore.cc.

◆ copy()

void WvBufStore::copy ( void * buf,
int offset,
size_t count )
inherited

Definition at line 128 of file wvbufferstore.cc.

◆ iswritable() [1/2]

virtual bool WvBufStore::iswritable ( ) const
inlinevirtualinherited

◆ iswritable() [2/2]

virtual bool WvBufStore::iswritable ( ) const
inlinevirtualinherited

Definition at line 70 of file include/wvbufstore.h.

◆ put()

void WvBufStore::put ( const void * data,
size_t count )
inherited

Definition at line 146 of file wvbufferstore.cc.

◆ fastput()

void WvBufStore::fastput ( const void * data,
size_t count )
inherited

Definition at line 163 of file wvbufferstore.cc.

◆ poke()

void WvBufStore::poke ( const void * data,
int offset,
size_t count )
inherited

Definition at line 170 of file wvbufferstore.cc.

◆ merge()

void WvBufStore::merge ( WvBufStore & instore,
size_t count )
virtualinherited

Definition at line 198 of file wvbufferstore.cc.

◆ basicmerge()

void WvBufStore::basicmerge ( WvBufStore & instore,
size_t count )
inherited

Definition at line 229 of file wvbufferstore.cc.

◆ usessubbuffers() [1/2]

virtual bool WvBufStore::usessubbuffers ( ) const
inlineprotectedvirtualinherited

Returns true if the buffer uses subbuffers for storage.

Reimplemented in WvLinkedBufferStore, and WvLinkedBufferStore.

Definition at line 96 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufstore.h.

◆ usessubbuffers() [2/2]

virtual bool WvBufStore::usessubbuffers ( ) const
inlineprotectedvirtualinherited

Returns true if the buffer uses subbuffers for storage.

Reimplemented in WvLinkedBufferStore, and WvLinkedBufferStore.

Definition at line 96 of file include/wvbufstore.h.

◆ numsubbuffers() [1/2]

virtual size_t WvBufStore::numsubbuffers ( ) const
inlineprotectedvirtualinherited

Returns the number of subbuffers in the buffer.

Reimplemented in WvLinkedBufferStore, and WvLinkedBufferStore.

Definition at line 100 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufstore.h.

◆ numsubbuffers() [2/2]

virtual size_t WvBufStore::numsubbuffers ( ) const
inlineprotectedvirtualinherited

Returns the number of subbuffers in the buffer.

Reimplemented in WvLinkedBufferStore, and WvLinkedBufferStore.

Definition at line 100 of file include/wvbufstore.h.

◆ firstsubbuffer() [1/2]

virtual WvBufStore * WvBufStore::firstsubbuffer ( ) const
inlineprotectedvirtualinherited

Returns the first subbuffer.

Returns: the buffer or NULL if none or not supported

Reimplemented in WvLinkedBufferStore, and WvLinkedBufferStore.

Definition at line 107 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufstore.h.

◆ firstsubbuffer() [2/2]

virtual WvBufStore * WvBufStore::firstsubbuffer ( ) const
inlineprotectedvirtualinherited

Returns the first subbuffer.

Returns: the buffer or NULL if none or not supported

Reimplemented in WvLinkedBufferStore, and WvLinkedBufferStore.

Definition at line 107 of file include/wvbufstore.h.

◆ appendsubbuffer() [1/2]

virtual void WvBufStore::appendsubbuffer ( WvBufStore * buffer,
bool autofree )
inlineprotectedvirtualinherited

Appends a subbuffer to the buffer.

Reimplemented in WvLinkedBufferStore, and WvLinkedBufferStore.

Definition at line 111 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufstore.h.

◆ appendsubbuffer() [2/2]

virtual void WvBufStore::appendsubbuffer ( WvBufStore * buffer,
bool autofree )
inlineprotectedvirtualinherited

Appends a subbuffer to the buffer.

Reimplemented in WvLinkedBufferStore, and WvLinkedBufferStore.

Definition at line 111 of file include/wvbufstore.h.

◆ prependsubbuffer() [1/2]

virtual void WvBufStore::prependsubbuffer ( WvBufStore * buffer,
bool autofree )
inlineprotectedvirtualinherited

Prepends a subbuffer to the buffer.

Reimplemented in WvLinkedBufferStore, and WvLinkedBufferStore.

Definition at line 115 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufstore.h.

◆ prependsubbuffer() [2/2]

virtual void WvBufStore::prependsubbuffer ( WvBufStore * buffer,
bool autofree )
inlineprotectedvirtualinherited

Prepends a subbuffer to the buffer.

Reimplemented in WvLinkedBufferStore, and WvLinkedBufferStore.

Definition at line 115 of file include/wvbufstore.h.

◆ unlinksubbuffer() [1/2]

virtual bool WvBufStore::unlinksubbuffer ( WvBufStore * buffer,
bool allowautofree )
inlineprotectedvirtualinherited

Unlinks the specified subbuffer.

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

Reimplemented in WvLinkedBufferStore, and WvLinkedBufferStore.

Definition at line 123 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufstore.h.

◆ unlinksubbuffer() [2/2]

virtual bool WvBufStore::unlinksubbuffer ( WvBufStore * buffer,
bool allowautofree )
inlineprotectedvirtualinherited

Unlinks the specified subbuffer.

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

Reimplemented in WvLinkedBufferStore, and WvLinkedBufferStore.

Definition at line 123 of file include/wvbufstore.h.

Member Data Documentation

◆ data

void * WvCircularBufStore::data
protected

◆ xsize

size_t WvCircularBufStore::xsize
protected

◆ head

size_t WvCircularBufStore::head
protected

◆ totalused

size_t WvCircularBufStore::totalused
protected

◆ totalinit

size_t WvCircularBufStore::totalinit
protected

◆ xautofree

bool WvCircularBufStore::xautofree
protected

◆ granularity

int WvBufStore::granularity
protectedinherited

The documentation for this class was generated from the following files: