WvStreams
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
WvDynBufStore Class Reference

The WvDynBuf storage class. More...

#include <wvbufstore.h>

Inheritance diagram for WvDynBufStore:
Inheritance graph
[legend]

Public Member Functions

 WvDynBufStore (size_t _granularity, size_t _minalloc, size_t _maxalloc)
 
virtual size_t free () const
 
virtual size_t optallocable () const
 
virtual void * alloc (size_t count)
 
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 void unalloc (size_t count)
 
virtual size_t unallocable () const
 
virtual size_t optpeekable (int offset) 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 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

virtual WvBufStorenewbuffer (size_t minsize)
 Called when a new buffer must be allocated to coalesce chunks. More...
 
virtual bool usessubbuffers () const
 Returns true if the buffer uses subbuffers for storage. More...
 
virtual size_t numsubbuffers () const
 Returns the number of subbuffers in the buffer. More...
 
virtual WvBufStorefirstsubbuffer () const
 Returns the first subbuffer. More...
 
virtual void appendsubbuffer (WvBufStore *buffer, bool autofree)
 Appends a subbuffer to the buffer. More...
 
virtual void prependsubbuffer (WvBufStore *buffer, bool autofree)
 Prepends a subbuffer to the buffer. More...
 
virtual bool unlinksubbuffer (WvBufStore *buffer, bool allowautofree)
 Unlinks the specified subbuffer. More...
 
virtual void recyclebuffer (WvBufStore *buffer)
 Called when a buffer with autofree is removed from the list. More...
 
int search (WvBufStoreList::Iter &it, int offset) const
 Searches for the buffer containing the offset. More...
 
WvBufStorecoalesce (WvBufStoreList::Iter &it, size_t count)
 Coalesces a sequence of buffers. More...
 

Protected Attributes

WvBufStoreList list
 
size_t totalused
 
size_t maxungettable
 
int granularity
 

Detailed Description

The WvDynBuf storage class.

Definition at line 480 of file wvbufstore.h.

Constructor & Destructor Documentation

◆ WvDynBufStore()

WvDynBufStore::WvDynBufStore ( size_t  _granularity,
size_t  _minalloc,
size_t  _maxalloc 
)

Definition at line 1117 of file wvbufferstore.cc.

Member Function Documentation

◆ free()

size_t WvDynBufStore::free ( ) const
virtual

Reimplemented from WvLinkedBufferStore.

Definition at line 1126 of file wvbufferstore.cc.

◆ optallocable()

size_t WvDynBufStore::optallocable ( ) const
virtual

Reimplemented from WvLinkedBufferStore.

Definition at line 1132 of file wvbufferstore.cc.

◆ alloc()

void * WvDynBufStore::alloc ( size_t  count)
virtual

Reimplemented from WvLinkedBufferStore.

Definition at line 1141 of file wvbufferstore.cc.

◆ newbuffer()

WvBufStore * WvDynBufStore::newbuffer ( size_t  minsize)
protectedvirtual

Called when a new buffer must be allocated to coalesce chunks.

"minsize" is the minimum size for the new buffer Returns: the new buffer

Reimplemented from WvLinkedBufferStore.

Definition at line 1152 of file wvbufferstore.cc.

References WvLinkedBufferStore::newbuffer().

◆ used()

size_t WvLinkedBufferStore::used ( ) const
virtualinherited

Implements WvBufStore.

Definition at line 798 of file wvbufferstore.cc.

◆ optgettable()

size_t WvLinkedBufferStore::optgettable ( ) const
virtualinherited

Reimplemented from WvBufStore.

Definition at line 805 of file wvbufferstore.cc.

◆ get()

const void * WvLinkedBufferStore::get ( size_t  count)
virtualinherited

Implements WvBufStore.

Definition at line 817 of file wvbufferstore.cc.

◆ unget()

void WvLinkedBufferStore::unget ( size_t  count)
virtualinherited

Implements WvBufStore.

Definition at line 858 of file wvbufferstore.cc.

◆ ungettable()

size_t WvLinkedBufferStore::ungettable ( ) const
virtualinherited

Implements WvBufStore.

Definition at line 872 of file wvbufferstore.cc.

◆ zap()

void WvLinkedBufferStore::zap ( )
virtualinherited

Implements WvBufStore.

Definition at line 896 of file wvbufferstore.cc.

◆ unalloc()

void WvLinkedBufferStore::unalloc ( size_t  count)
virtualinherited

Implements WvBufStore.

Definition at line 932 of file wvbufferstore.cc.

◆ unallocable()

size_t WvLinkedBufferStore::unallocable ( ) const
virtualinherited

Implements WvBufStore.

Definition at line 959 of file wvbufferstore.cc.

◆ optpeekable()

size_t WvLinkedBufferStore::optpeekable ( int  offset) const
virtualinherited

Reimplemented from WvBufStore.

Definition at line 965 of file wvbufferstore.cc.

◆ mutablepeek()

void * WvLinkedBufferStore::mutablepeek ( int  offset,
size_t  count 
)
virtualinherited

Implements WvBufStore.

Definition at line 977 of file wvbufferstore.cc.

◆ usessubbuffers()

bool WvLinkedBufferStore::usessubbuffers ( ) const
protectedvirtualinherited

Returns true if the buffer uses subbuffers for storage.

Reimplemented from WvBufStore.

Definition at line 745 of file wvbufferstore.cc.

◆ numsubbuffers()

size_t WvLinkedBufferStore::numsubbuffers ( ) const
protectedvirtualinherited

Returns the number of subbuffers in the buffer.

Reimplemented from WvBufStore.

Definition at line 751 of file wvbufferstore.cc.

◆ firstsubbuffer()

WvBufStore * WvLinkedBufferStore::firstsubbuffer ( ) const
protectedvirtualinherited

Returns the first subbuffer.

Returns: the buffer or NULL if none or not supported

Reimplemented from WvBufStore.

Definition at line 757 of file wvbufferstore.cc.

◆ appendsubbuffer()

void WvLinkedBufferStore::appendsubbuffer ( WvBufStore buffer,
bool  autofree 
)
protectedvirtualinherited

Appends a subbuffer to the buffer.

Reimplemented from WvBufStore.

Definition at line 763 of file wvbufferstore.cc.

◆ prependsubbuffer()

void WvLinkedBufferStore::prependsubbuffer ( WvBufStore buffer,
bool  autofree 
)
protectedvirtualinherited

Prepends a subbuffer to the buffer.

Reimplemented from WvBufStore.

Definition at line 771 of file wvbufferstore.cc.

◆ unlinksubbuffer()

bool WvLinkedBufferStore::unlinksubbuffer ( WvBufStore buffer,
bool  allowautofree 
)
protectedvirtualinherited

Unlinks the specified subbuffer.

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

Reimplemented from WvBufStore.

Definition at line 780 of file wvbufferstore.cc.

◆ recyclebuffer()

void WvLinkedBufferStore::recyclebuffer ( WvBufStore buffer)
protectedvirtualinherited

Called when a buffer with autofree is removed from the list.

This function is not called during object destruction.

"buffer" is the buffer to be destroyed

Definition at line 1004 of file wvbufferstore.cc.

◆ search()

int WvLinkedBufferStore::search ( WvBufStoreList::Iter &  it,
int  offset 
) const
protectedinherited

Searches for the buffer containing the offset.

"it" is the iterator updated to point to buffer found, or to an invalid region if the offset is invalid "offset" is the offset for which to search Returns: the corrected offset within the buffer at it.ptr()

Definition at line 1010 of file wvbufferstore.cc.

◆ coalesce()

WvBufStore * WvLinkedBufferStore::coalesce ( WvBufStoreList::Iter &  it,
size_t  count 
)
protectedinherited

Coalesces a sequence of buffers.

"it" is the iterator pointing to the first buffer "count" is the required number of contiguous used bytes Returns: the composite buffer

Definition at line 1042 of file wvbufferstore.cc.

References WvLinkedBufferStore::newbuffer().

◆ isreadable()

virtual bool WvBufStore::isreadable ( ) const
inlinevirtualinherited

Definition at line 47 of file wvbufstore.h.

◆ skip()

virtual void WvBufStore::skip ( size_t  count)
inlinevirtualinherited

Definition at line 53 of file wvbufstore.h.

◆ peekable()

size_t WvBufStore::peekable ( int  offset) const
virtualinherited

Definition at line 90 of file wvbufferstore.cc.

◆ peek()

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

Definition at line 60 of file 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()

virtual bool WvBufStore::iswritable ( ) const
inlinevirtualinherited

Definition at line 70 of file 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.

Member Data Documentation

◆ list

WvBufStoreList WvLinkedBufferStore::list
protectedinherited

Definition at line 404 of file wvbufstore.h.

◆ totalused

size_t WvLinkedBufferStore::totalused
protectedinherited

Definition at line 405 of file wvbufstore.h.

◆ maxungettable

size_t WvLinkedBufferStore::maxungettable
protectedinherited

Definition at line 406 of file wvbufstore.h.

◆ granularity

int WvBufStore::granularity
protectedinherited

Definition at line 33 of file wvbufstore.h.


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