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

The in place raw memory buffer type. More...

#include <wvbuf.h>

Inheritance diagram for WvInPlaceBuf:
Inheritance graph
[legend]

Public Member Functions

 WvInPlaceBuf (void *_data, size_t _avail, size_t _size, bool _autofree=false)
 
 WvInPlaceBuf (size_t _size)
 
void reset (void *_data, size_t _avail, size_t _size, bool _autofree=false)
 
 WvInPlaceBuf (void *_data, size_t _avail, size_t _size, bool _autofree=false)
 
 WvInPlaceBuf (size_t _size)
 
void reset (void *_data, size_t _avail, size_t _size, bool _autofree=false)
 
unsigned char * ptr () const
 Returns the underlying array pointer.
 
unsigned char * ptr () const
 Returns the underlying array pointer.
 
size_t size () const
 Returns the total size of the buffer.
 
size_t size () const
 Returns the total size of the buffer.
 
bool get_autofree () const
 Returns the autofree flag.
 
bool get_autofree () const
 Returns the autofree flag.
 
void set_autofree (bool _autofree)
 Sets or clears the autofree flag.
 
void set_autofree (bool _autofree)
 Sets or clears the autofree flag.
 
void reset (unsigned char *_data, size_t _avail, size_t _size, bool _autofree=false)
 Resets the underlying buffer pointer and properties.
 
void setavail (size_t _avail)
 Sets the amount of available data using the current buffer and resets the read index to the beginning of the buffer.
 
void setavail (size_t _avail)
 Sets the amount of available data using the current buffer and resets the read index to the beginning of the buffer.
 
WvBufStoregetstore ()
 Returns a pointer to the underlying storage class object.
 
WvBufStoregetstore ()
 Returns a pointer to the underlying storage class object.
 
bool isreadable () const
 Returns true if the buffer supports reading.
 
bool isreadable () const
 Returns true if the buffer supports reading.
 
size_t used () const
 Returns the number of elements in the buffer currently available for reading.
 
size_t used () const
 Returns the number of elements in the buffer currently available for reading.
 
const T * get (size_t count)
 Reads exactly the specified number of elements and returns a pointer to a storage location owned by the buffer.
 
get ()
 Reads the next element from the buffer.
 
const T * get (size_t count)
 Reads exactly the specified number of elements and returns a pointer to a storage location owned by the buffer.
 
get ()
 Reads the next element from the buffer.
 
void skip (size_t count)
 Skips exactly the specified number of elements.
 
void skip (size_t count)
 Skips exactly the specified number of elements.
 
size_t optgettable () const
 Returns the optimal maximum number of elements in the buffer currently available for reading without incurring significant overhead.
 
size_t optgettable () const
 Returns the optimal maximum number of elements in the buffer currently available for reading without incurring significant overhead.
 
void unget (size_t count)
 Ungets exactly the specified number of elements by returning them to the buffer for subsequent reads.
 
void unget (size_t count)
 Ungets exactly the specified number of elements by returning them to the buffer for subsequent reads.
 
size_t ungettable () const
 Returns the maximum number of elements that may be ungotten at this time.
 
size_t ungettable () const
 Returns the maximum number of elements that may be ungotten at this time.
 
const T * peek (int offset, size_t count)
 Returns a const pointer into the buffer at the specified offset to the specified number of elements without actually adjusting the current get() index.
 
peek (int offset=0)
 Returns the element at the specified offset in the buffer.
 
const T * peek (int offset, size_t count)
 Returns a const pointer into the buffer at the specified offset to the specified number of elements without actually adjusting the current get() index.
 
peek (int offset=0)
 Returns the element at the specified offset in the buffer.
 
size_t peekable (int offset)
 
size_t peekable (int offset)
 
size_t optpeekable (int offset)
 
size_t optpeekable (int offset)
 
void zap ()
 Clears the buffer.
 
void zap ()
 Clears the buffer.
 
void move (T *buf, size_t count)
 Efficiently copies the specified number of elements from the buffer to the specified UNINITIALIZED storage location and removes the elements from the buffer.
 
void move (T *buf, size_t count)
 Efficiently copies the specified number of elements from the buffer to the specified UNINITIALIZED storage location and removes the elements from the buffer.
 
void copy (T *buf, int offset, size_t count)
 Efficiently copies the specified number of elements from the buffer to the specified UNINITIALIZED storage location but does not remove the elements from the buffer.
 
void copy (T *buf, int offset, size_t count)
 Efficiently copies the specified number of elements from the buffer to the specified UNINITIALIZED storage location but does not remove the elements from the buffer.
 
bool iswritable () const
 Returns true if the buffer supports writing.
 
bool iswritable () const
 Returns true if the buffer supports writing.
 
size_t free () const
 Returns the number of elements that the buffer can currently accept for writing.
 
size_t free () const
 Returns the number of elements that the buffer can currently accept for writing.
 
T * alloc (size_t count)
 Allocates exactly the specified number of elements and returns a pointer to an UNINITIALIZED storage location owned by the buffer.
 
T * alloc (size_t count)
 Allocates exactly the specified number of elements and returns a pointer to an UNINITIALIZED storage location owned by the buffer.
 
size_t optallocable () const
 Returns the optimal maximum number of elements that the buffer can currently accept for writing without incurring significant overhead.
 
size_t optallocable () const
 Returns the optimal maximum number of elements that the buffer can currently accept for writing without incurring significant overhead.
 
void unalloc (size_t count)
 Unallocates exactly the specified number of elements by removing them from the buffer and releasing their storage.
 
void unalloc (size_t count)
 Unallocates exactly the specified number of elements by removing them from the buffer and releasing their storage.
 
size_t unallocable () const
 Returns the maximum number of elements that may be unallocated at this time.
 
size_t unallocable () const
 Returns the maximum number of elements that may be unallocated at this time.
 
T * mutablepeek (int offset, size_t count)
 Returns a non-const pointer info the buffer at the specified offset to the specified number of elements without actually adjusting the current get() index.
 
T * mutablepeek (int offset, size_t count)
 Returns a non-const pointer info the buffer at the specified offset to the specified number of elements without actually adjusting the current get() index.
 
void put (const T *data, size_t count)
 Writes the specified number of elements from the specified storage location into the buffer at its tail.
 
void put (T &value)
 Writes the element into the buffer at its tail.
 
void put (const T *data, size_t count)
 Writes the specified number of elements from the specified storage location into the buffer at its tail.
 
void put (T &value)
 Writes the element into the buffer at its tail.
 
void poke (const T *data, int offset, size_t count)
 Efficiently copies the specified number of elements from the specified storage location into the buffer at a particular offset.
 
void poke (T &value, int offset)
 Writes the element into the buffer at the specified offset.
 
void poke (const T *data, int offset, size_t count)
 Efficiently copies the specified number of elements from the specified storage location into the buffer at a particular offset.
 
void poke (T &value, int offset)
 Writes the element into the buffer at the specified offset.
 
void merge (Buffer &inbuf, size_t count)
 Efficiently moves count bytes from the specified buffer into this one.
 
void merge (Buffer &inbuf)
 Efficiently merges the entire contents of a buffer into this one.
 
void merge (Buffer &inbuf, size_t count)
 Efficiently moves count bytes from the specified buffer into this one.
 
void merge (Buffer &inbuf)
 Efficiently merges the entire contents of a buffer into this one.
 

Protected Types

typedef unsigned char Elem
 
typedef unsigned char Elem
 
typedef WvBufBase< T > Buffer
 
typedef WvBufBase< T > Buffer
 

Protected Attributes

WvInPlaceBufStore mystore
 
WvBufStorestore
 

Detailed Description

The in place raw memory buffer type.

Refines the interface to add support for untyped pointers.

Definition at line 164 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbuf.h.

Member Typedef Documentation

◆ Elem [1/2]

typedef unsigned char WvInPlaceBufBase< unsigned char >::Elem
protectedinherited

◆ Elem [2/2]

typedef unsigned char WvInPlaceBufBase< unsigned char >::Elem
protectedinherited

Definition at line 606 of file include/wvbufbase.h.

◆ Buffer [1/2]

template<class T >
typedef WvBufBase<T> WvBufBaseCommonImpl< T >::Buffer
protectedinherited

◆ Buffer [2/2]

template<class T >
typedef WvBufBase<T> WvBufBaseCommonImpl< T >::Buffer
protectedinherited

Definition at line 40 of file include/wvbufbase.h.

Constructor & Destructor Documentation

◆ WvInPlaceBuf() [1/6]

WvInPlaceBuf::WvInPlaceBuf ( void *  _data,
size_t  _avail,
size_t  _size,
bool  _autofree = false 
)
inline

◆ WvInPlaceBuf() [2/6]

WvInPlaceBuf::WvInPlaceBuf ( size_t  _size)
inlineexplicit

◆ WvInPlaceBuf() [3/6]

WvInPlaceBuf::WvInPlaceBuf ( )
inline

◆ WvInPlaceBuf() [4/6]

WvInPlaceBuf::WvInPlaceBuf ( void *  _data,
size_t  _avail,
size_t  _size,
bool  _autofree = false 
)
inline

Definition at line 167 of file include/wvbuf.h.

◆ WvInPlaceBuf() [5/6]

WvInPlaceBuf::WvInPlaceBuf ( size_t  _size)
inlineexplicit

Definition at line 171 of file include/wvbuf.h.

◆ WvInPlaceBuf() [6/6]

WvInPlaceBuf::WvInPlaceBuf ( )
inline

Definition at line 173 of file include/wvbuf.h.

Member Function Documentation

◆ reset() [1/3]

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

◆ reset() [2/3]

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

Definition at line 175 of file include/wvbuf.h.

◆ ptr() [1/2]

unsigned char * WvInPlaceBufBase< unsigned char >::ptr ( ) const
inlineinherited

Returns the underlying array pointer.

Returns: the element pointer

Definition at line 652 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

◆ ptr() [2/2]

unsigned char * WvInPlaceBufBase< unsigned char >::ptr ( ) const
inlineinherited

Returns the underlying array pointer.

Returns: the element pointer

Definition at line 652 of file include/wvbufbase.h.

◆ size() [1/2]

size_t WvInPlaceBufBase< unsigned char >::size ( ) const
inlineinherited

Returns the total size of the buffer.

Returns: the number of elements

Definition at line 662 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

◆ size() [2/2]

size_t WvInPlaceBufBase< unsigned char >::size ( ) const
inlineinherited

Returns the total size of the buffer.

Returns: the number of elements

Definition at line 662 of file include/wvbufbase.h.

◆ get_autofree() [1/2]

bool WvInPlaceBufBase< unsigned char >::get_autofree ( ) const
inlineinherited

Returns the autofree flag.

Returns: the autofree flag

Definition at line 672 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

◆ get_autofree() [2/2]

bool WvInPlaceBufBase< unsigned char >::get_autofree ( ) const
inlineinherited

Returns the autofree flag.

Returns: the autofree flag

Definition at line 672 of file include/wvbufbase.h.

◆ set_autofree() [1/2]

void WvInPlaceBufBase< unsigned char >::set_autofree ( bool  _autofree)
inlineinherited

Sets or clears the autofree flag.

"_autofree" is if true, the array will be freed when discarded

Definition at line 682 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

◆ set_autofree() [2/2]

void WvInPlaceBufBase< unsigned char >::set_autofree ( bool  _autofree)
inlineinherited

Sets or clears the autofree flag.

"_autofree" is if true, the array will be freed when discarded

Definition at line 682 of file include/wvbufbase.h.

◆ reset() [3/3]

void WvInPlaceBufBase< unsigned char >::reset ( unsigned char *  _data,
size_t  _avail,
size_t  _size,
bool  _autofree = false 
)
inlineinherited

Resets the underlying buffer pointer and properties.

If the old and new buffer pointers differ and the old buffer was specified as autofree, the old buffer is destroyed.

"_data" is the array of data to wrap "_avail" is the amount of data available for reading "_size" is the size of the array "_autofree" is if true, the array will be freed when discarded

Definition at line 698 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

◆ setavail() [1/2]

void WvInPlaceBufBase< unsigned char >::setavail ( size_t  _avail)
inlineinherited

Sets the amount of available data using the current buffer and resets the read index to the beginning of the buffer.

"_avail" is the amount of data available for reading

Definition at line 711 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

◆ setavail() [2/2]

void WvInPlaceBufBase< unsigned char >::setavail ( size_t  _avail)
inlineinherited

Sets the amount of available data using the current buffer and resets the read index to the beginning of the buffer.

"_avail" is the amount of data available for reading

Definition at line 711 of file include/wvbufbase.h.

◆ getstore() [1/2]

template<class T >
WvBufStore * WvBufBaseCommonImpl< T >::getstore ( )
inlineinherited

Returns a pointer to the underlying storage class object.

Returns: the low-level storage class object pointer, non-null

Definition at line 69 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

◆ getstore() [2/2]

template<class T >
WvBufStore * WvBufBaseCommonImpl< T >::getstore ( )
inlineinherited

Returns a pointer to the underlying storage class object.

Returns: the low-level storage class object pointer, non-null

Definition at line 69 of file include/wvbufbase.h.

◆ isreadable() [1/2]

template<class T >
bool WvBufBaseCommonImpl< T >::isreadable ( ) const
inlineinherited

Returns true if the buffer supports reading.

Returns: true if reading is supported

Definition at line 81 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

◆ isreadable() [2/2]

template<class T >
bool WvBufBaseCommonImpl< T >::isreadable ( ) const
inlineinherited

Returns true if the buffer supports reading.

Returns: true if reading is supported

Definition at line 81 of file include/wvbufbase.h.

◆ used() [1/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::used ( ) const
inlineinherited

◆ used() [2/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::used ( ) const
inlineinherited

Returns the number of elements in the buffer currently available for reading.

This function could also be called gettable().

Definition at line 92 of file include/wvbufbase.h.

◆ get() [1/4]

template<class T >
const T * WvBufBaseCommonImpl< T >::get ( size_t  count)
inlineinherited

Reads exactly the specified number of elements and returns a pointer to a storage location owned by the buffer.

The pointer is only valid until the next non-const buffer member is called. eg. alloc(size_t)

If count == 0, a NULL pointer may be returned.

It is an error for count to be greater than the number of available elements in the buffer.

For maximum efficiency, call this function multiple times with count no greater than optgettable() each time.

After this operation, at least count elements may be ungotten.

Definition at line 114 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

References WvBufBaseCommonImpl< T >::used().

Referenced by WvLogBuffer::_end_line(), WvSyslog::_end_line(), WvFunctorEncoder< IT, OT, FT >::_typedencode(), WvStream::blocking_getline(), WvStream::read(), and WvSSLStream::uwrite().

◆ get() [2/4]

template<class T >
T WvBufBaseCommonImpl< T >::get ( )
inlineinherited

Reads the next element from the buffer.

It is an error to invoke this method if used() == 0.

After this operation, at least 1 element may be ungotten.

Returns: the element

Definition at line 272 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

References WvBufBaseCommonImpl< T >::get().

Referenced by WvBufBaseCommonImpl< T >::get().

◆ get() [3/4]

template<class T >
const T * WvBufBaseCommonImpl< T >::get ( size_t  count)
inlineinherited

Reads exactly the specified number of elements and returns a pointer to a storage location owned by the buffer.

The pointer is only valid until the next non-const buffer member is called. eg. alloc(size_t)

If count == 0, a NULL pointer may be returned.

It is an error for count to be greater than the number of available elements in the buffer.

For maximum efficiency, call this function multiple times with count no greater than optgettable() each time.

After this operation, at least count elements may be ungotten.

Definition at line 114 of file include/wvbufbase.h.

References WvBufBaseCommonImpl< T >::used().

◆ get() [4/4]

template<class T >
T WvBufBaseCommonImpl< T >::get ( )
inlineinherited

Reads the next element from the buffer.

It is an error to invoke this method if used() == 0.

After this operation, at least 1 element may be ungotten.

Returns: the element

Definition at line 272 of file include/wvbufbase.h.

References WvBufBaseCommonImpl< T >::get().

◆ skip() [1/2]

template<class T >
void WvBufBaseCommonImpl< T >::skip ( size_t  count)
inlineinherited

Skips exactly the specified number of elements.

This is equivalent to invoking get(size_t) with the count and discarding the result, but may be faster for certain types of buffers. As with get(size_t), the call may be followed up by an unget(size_t).

It is an error for count to be greater than the number of available elements in the buffer.

"count" is the number of elements

Definition at line 136 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

◆ skip() [2/2]

template<class T >
void WvBufBaseCommonImpl< T >::skip ( size_t  count)
inlineinherited

Skips exactly the specified number of elements.

This is equivalent to invoking get(size_t) with the count and discarding the result, but may be faster for certain types of buffers. As with get(size_t), the call may be followed up by an unget(size_t).

It is an error for count to be greater than the number of available elements in the buffer.

"count" is the number of elements

Definition at line 136 of file include/wvbufbase.h.

◆ optgettable() [1/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::optgettable ( ) const
inlineinherited

Returns the optimal maximum number of elements in the buffer currently available for reading without incurring significant overhead.

Invariants:

Returns: the number of elements

Definition at line 154 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

Referenced by WvFunctorEncoder< IT, OT, FT >::_typedencode().

◆ optgettable() [2/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::optgettable ( ) const
inlineinherited

Returns the optimal maximum number of elements in the buffer currently available for reading without incurring significant overhead.

Invariants:

Returns: the number of elements

Definition at line 154 of file include/wvbufbase.h.

◆ unget() [1/2]

template<class T >
void WvBufBaseCommonImpl< T >::unget ( size_t  count)
inlineinherited

Ungets exactly the specified number of elements by returning them to the buffer for subsequent reads.

This operation may always be safely performed with count less than or equal to that specified in the last get(size_t) if no non-const buffer members have been called since then.

If count == 0, nothing happens.

It is an error for count to be greater than ungettable().

"count" is the number of elements

Definition at line 177 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

Referenced by WvSSLStream::uwrite().

◆ unget() [2/2]

template<class T >
void WvBufBaseCommonImpl< T >::unget ( size_t  count)
inlineinherited

Ungets exactly the specified number of elements by returning them to the buffer for subsequent reads.

This operation may always be safely performed with count less than or equal to that specified in the last get(size_t) if no non-const buffer members have been called since then.

If count == 0, nothing happens.

It is an error for count to be greater than ungettable().

"count" is the number of elements

Definition at line 177 of file include/wvbufbase.h.

◆ ungettable() [1/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::ungettable ( ) const
inlineinherited

Returns the maximum number of elements that may be ungotten at this time.

Returns: the number of elements

Definition at line 188 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

◆ ungettable() [2/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::ungettable ( ) const
inlineinherited

Returns the maximum number of elements that may be ungotten at this time.

Returns: the number of elements

Definition at line 188 of file include/wvbufbase.h.

◆ peek() [1/4]

template<class T >
const T * WvBufBaseCommonImpl< T >::peek ( int  offset,
size_t  count 
)
inlineinherited

Returns a const pointer into the buffer at the specified offset to the specified number of elements without actually adjusting the current get() index.

The pointer is only valid until the next non-const buffer member is called. eg. alloc(size_t)

If count == 0, a NULL pointer may be returned.

If offset is greater than zero, then elements will be returned beginning with the with the offset'th element that would be returned by get(size_t).

If offset equals zero, then elements will be returned beginning with the next one available for get(size_t).

If offset is less than zero, then elements will be returned beginning with the first one that would be returned on a get(size_t) following an unget(-offset).

It is an error for count to be greater than peekable(offset).

For maximum efficiency, call this function multiple times with count no greater than that returned by optpeekable(size_t) at incremental offsets.

"offset" is the buffer offset "count" is the number of elements Returns: the element storage pointer

Definition at line 225 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

Referenced by WvDBusMsg::demarshal(), WvDBusMsg::demarshal_bytes_needed(), WvHttpStream::execute(), and WvBufBaseCommonImpl< T >::peek().

◆ peek() [2/4]

template<class T >
T WvBufBaseCommonImpl< T >::peek ( int  offset = 0)
inlineinherited

Returns the element at the specified offset in the buffer.

It is an error to invoke this method if used() == 0.

"offset" is the offset, default 0 Returns: the element

Definition at line 286 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

References WvBufBaseCommonImpl< T >::peek().

◆ peek() [3/4]

template<class T >
const T * WvBufBaseCommonImpl< T >::peek ( int  offset,
size_t  count 
)
inlineinherited

Returns a const pointer into the buffer at the specified offset to the specified number of elements without actually adjusting the current get() index.

The pointer is only valid until the next non-const buffer member is called. eg. alloc(size_t)

If count == 0, a NULL pointer may be returned.

If offset is greater than zero, then elements will be returned beginning with the with the offset'th element that would be returned by get(size_t).

If offset equals zero, then elements will be returned beginning with the next one available for get(size_t).

If offset is less than zero, then elements will be returned beginning with the first one that would be returned on a get(size_t) following an unget(-offset).

It is an error for count to be greater than peekable(offset).

For maximum efficiency, call this function multiple times with count no greater than that returned by optpeekable(size_t) at incremental offsets.

"offset" is the buffer offset "count" is the number of elements Returns: the element storage pointer

Definition at line 225 of file include/wvbufbase.h.

◆ peek() [4/4]

template<class T >
T WvBufBaseCommonImpl< T >::peek ( int  offset = 0)
inlineinherited

Returns the element at the specified offset in the buffer.

It is an error to invoke this method if used() == 0.

"offset" is the offset, default 0 Returns: the element

Definition at line 286 of file include/wvbufbase.h.

References WvBufBaseCommonImpl< T >::peek().

◆ peekable() [1/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::peekable ( int  offset)
inlineinherited

◆ peekable() [2/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::peekable ( int  offset)
inlineinherited

Definition at line 231 of file include/wvbufbase.h.

◆ optpeekable() [1/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::optpeekable ( int  offset)
inlineinherited

◆ optpeekable() [2/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::optpeekable ( int  offset)
inlineinherited

Definition at line 236 of file include/wvbufbase.h.

◆ zap() [1/2]

template<class T >
void WvBufBaseCommonImpl< T >::zap ( )
inlineinherited

Clears the buffer.

For many types of buffers, calling zap() will increased the amount of free space available for writing (see below) by an amount greater than used(). Hence it is wise to zap() a buffer just before writing to it to maximize free space.

After this operation, used() == 0, and often ungettable() == 0.

Definition at line 257 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

Referenced by WvLogBuffer::_end_line(), WvSyslog::_end_line(), WvBackslashDecoder::_reset(), WvStream::unread(), WvSSLStream::uread(), and WvSSLStream::uwrite().

◆ zap() [2/2]

template<class T >
void WvBufBaseCommonImpl< T >::zap ( )
inlineinherited

Clears the buffer.

For many types of buffers, calling zap() will increased the amount of free space available for writing (see below) by an amount greater than used(). Hence it is wise to zap() a buffer just before writing to it to maximize free space.

After this operation, used() == 0, and often ungettable() == 0.

Definition at line 257 of file include/wvbufbase.h.

◆ move() [1/2]

template<class T >
void WvBufBaseCommonImpl< T >::move ( T *  buf,
size_t  count 
)
inlineinherited

Efficiently copies the specified number of elements from the buffer to the specified UNINITIALIZED storage location and removes the elements from the buffer.

It is an error for count to be greater than used().

For maximum efficiency, choose as large a count as possible.

The pointer buf may be NULL only if count == 0.

After this operation, an indeterminate number of elements may be ungotten.

"buf" is the buffer that will receive the elements "count" is the number of elements

Definition at line 309 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

Referenced by WvSSLStream::uread(), and WvEncoderStream::uread().

◆ move() [2/2]

template<class T >
void WvBufBaseCommonImpl< T >::move ( T *  buf,
size_t  count 
)
inlineinherited

Efficiently copies the specified number of elements from the buffer to the specified UNINITIALIZED storage location and removes the elements from the buffer.

It is an error for count to be greater than used().

For maximum efficiency, choose as large a count as possible.

The pointer buf may be NULL only if count == 0.

After this operation, an indeterminate number of elements may be ungotten.

"buf" is the buffer that will receive the elements "count" is the number of elements

Definition at line 309 of file include/wvbufbase.h.

◆ copy() [1/2]

template<class T >
void WvBufBaseCommonImpl< T >::copy ( T *  buf,
int  offset,
size_t  count 
)
inlineinherited

Efficiently copies the specified number of elements from the buffer to the specified UNINITIALIZED storage location but does not remove the elements from the buffer.

It is an error for count to be greater than peekable(offset).

For maximum efficiency, choose as large a count as possible.

The pointer buf may be NULL only if count == 0.

"buf" is the buffer that will receive the elements "offset" is the buffer offset "count" is the number of elements

Definition at line 330 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

◆ copy() [2/2]

template<class T >
void WvBufBaseCommonImpl< T >::copy ( T *  buf,
int  offset,
size_t  count 
)
inlineinherited

Efficiently copies the specified number of elements from the buffer to the specified UNINITIALIZED storage location but does not remove the elements from the buffer.

It is an error for count to be greater than peekable(offset).

For maximum efficiency, choose as large a count as possible.

The pointer buf may be NULL only if count == 0.

"buf" is the buffer that will receive the elements "offset" is the buffer offset "count" is the number of elements

Definition at line 330 of file include/wvbufbase.h.

◆ iswritable() [1/2]

template<class T >
bool WvBufBaseCommonImpl< T >::iswritable ( ) const
inlineinherited

Returns true if the buffer supports writing.

Returns: true if writing is supported

Definition at line 342 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

◆ iswritable() [2/2]

template<class T >
bool WvBufBaseCommonImpl< T >::iswritable ( ) const
inlineinherited

Returns true if the buffer supports writing.

Returns: true if writing is supported

Definition at line 342 of file include/wvbufbase.h.

◆ free() [1/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::free ( ) const
inlineinherited

Returns the number of elements that the buffer can currently accept for writing.

Returns: the number of elements

Definition at line 353 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

Referenced by WvSSLStream::uread(), and WvSSLStream::uwrite().

◆ free() [2/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::free ( ) const
inlineinherited

Returns the number of elements that the buffer can currently accept for writing.

Returns: the number of elements

Definition at line 353 of file include/wvbufbase.h.

◆ alloc() [1/2]

template<class T >
T * WvBufBaseCommonImpl< T >::alloc ( size_t  count)
inlineinherited

Allocates exactly the specified number of elements and returns a pointer to an UNINITIALIZED storage location owned by the buffer.

The pointer is only valid until the next non-const buffer member is called. eg. alloc(size_t)

If count == 0, a NULL pointer may be returned.

It is an error for count to be greater than free().

For best results, call this function multiple times with count no greater than optallocable() each time.

After this operation, at least count elements may be unallocated.

"count" is the number of elements Returns: the element storage pointer

Definition at line 379 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

Referenced by WvFunctorEncoder< IT, OT, FT >::_typedencode(), WvStream::blocking_getline(), WvDSAKey::getpem(), WvStream::read(), WvStream::read(), and WvSSLStream::uread().

◆ alloc() [2/2]

template<class T >
T * WvBufBaseCommonImpl< T >::alloc ( size_t  count)
inlineinherited

Allocates exactly the specified number of elements and returns a pointer to an UNINITIALIZED storage location owned by the buffer.

The pointer is only valid until the next non-const buffer member is called. eg. alloc(size_t)

If count == 0, a NULL pointer may be returned.

It is an error for count to be greater than free().

For best results, call this function multiple times with count no greater than optallocable() each time.

After this operation, at least count elements may be unallocated.

"count" is the number of elements Returns: the element storage pointer

Definition at line 379 of file include/wvbufbase.h.

◆ optallocable() [1/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::optallocable ( ) const
inlineinherited

Returns the optimal maximum number of elements that the buffer can currently accept for writing without incurring significant overhead.

Invariants:

Returns: the number of elements

Definition at line 397 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

Referenced by WvFunctorEncoder< IT, OT, FT >::_typedencode().

◆ optallocable() [2/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::optallocable ( ) const
inlineinherited

Returns the optimal maximum number of elements that the buffer can currently accept for writing without incurring significant overhead.

Invariants:

Returns: the number of elements

Definition at line 397 of file include/wvbufbase.h.

◆ unalloc() [1/2]

template<class T >
void WvBufBaseCommonImpl< T >::unalloc ( size_t  count)
inlineinherited

Unallocates exactly the specified number of elements by removing them from the buffer and releasing their storage.

This operation may always be safely performed with count less than or equal to that specified in the last alloc(size_t) or put(const T*, size_t) if no non-const buffer members have been called since then.

If count == 0, nothing happens.

It is an error for count to be greater than unallocable().

"count" is the number of elements

Definition at line 421 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

Referenced by WvBackslashDecoder::_encode(), WvStream::blocking_getline(), WvDSAKey::getpem(), WvStream::read(), WvStream::read(), and WvSSLStream::uread().

◆ unalloc() [2/2]

template<class T >
void WvBufBaseCommonImpl< T >::unalloc ( size_t  count)
inlineinherited

Unallocates exactly the specified number of elements by removing them from the buffer and releasing their storage.

This operation may always be safely performed with count less than or equal to that specified in the last alloc(size_t) or put(const T*, size_t) if no non-const buffer members have been called since then.

If count == 0, nothing happens.

It is an error for count to be greater than unallocable().

"count" is the number of elements

Definition at line 421 of file include/wvbufbase.h.

◆ unallocable() [1/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::unallocable ( ) const
inlineinherited

Returns the maximum number of elements that may be unallocated at this time.

For all practical purposes, this number will always be at least as large as the amount currently in use. It is provided primarily for symmetry, but also to handle cases where buffer reading (hence used()) is not supported by the implementation.

Invariants:

Returns: the number of elements

Definition at line 443 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

◆ unallocable() [2/2]

template<class T >
size_t WvBufBaseCommonImpl< T >::unallocable ( ) const
inlineinherited

Returns the maximum number of elements that may be unallocated at this time.

For all practical purposes, this number will always be at least as large as the amount currently in use. It is provided primarily for symmetry, but also to handle cases where buffer reading (hence used()) is not supported by the implementation.

Invariants:

Returns: the number of elements

Definition at line 443 of file include/wvbufbase.h.

◆ mutablepeek() [1/2]

template<class T >
T * WvBufBaseCommonImpl< T >::mutablepeek ( int  offset,
size_t  count 
)
inlineinherited

Returns a non-const pointer info the buffer at the specified offset to the specified number of elements without actually adjusting the current get() index.

Other than the fact that the returned storage is mutable, operates identically to peek(int, size_t).

"offset" is the buffer offset "count" is the number of elements Returns: the element storage pointer

Definition at line 461 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

Referenced by WvStream::blocking_getline().

◆ mutablepeek() [2/2]

template<class T >
T * WvBufBaseCommonImpl< T >::mutablepeek ( int  offset,
size_t  count 
)
inlineinherited

Returns a non-const pointer info the buffer at the specified offset to the specified number of elements without actually adjusting the current get() index.

Other than the fact that the returned storage is mutable, operates identically to peek(int, size_t).

"offset" is the buffer offset "count" is the number of elements Returns: the element storage pointer

Definition at line 461 of file include/wvbufbase.h.

◆ put() [1/4]

template<class T >
void WvBufBaseCommonImpl< T >::put ( const T *  data,
size_t  count 
)
inlineinherited

Writes the specified number of elements from the specified storage location into the buffer at its tail.

It is an error for count to be greater than free().

For maximum efficiency, choose as large a count as possible.

The pointer buf may be NULL only if count == 0.

After this operation, at least count elements may be unallocated.

"data" is the buffer that contains the elements "count" is the number of elements

Definition at line 483 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

Referenced by WvSyslog::_begin_line(), WvLogBuffer::_end_line(), WvSyslog::_end_line(), WvLogBuffer::_mid_line(), WvSyslog::_mid_line(), WvStream::blocking_getline(), WvX509::certreq(), WvDBusMsg::demarshal(), WvDBusMsg::demarshal_bytes_needed(), UniConfKey::printable(), UniIniGen::refresh(), WvX509Mgr::sign(), strreplace(), url_encode(), WvUnixDGSocket::uwrite(), WvSSLStream::uwrite(), WvBufStream::uwrite(), WvEncoderStream::uwrite(), and WvStream::write().

◆ put() [2/4]

template<class T >
void WvBufBaseCommonImpl< T >::put ( T &  value)
inlineinherited

Writes the element into the buffer at its tail.

It is an error to invoke this method if free() == 0.

After this operation, at least 1 element may be unallocated.

"valid" is the element

Definition at line 519 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

◆ put() [3/4]

template<class T >
void WvBufBaseCommonImpl< T >::put ( const T *  data,
size_t  count 
)
inlineinherited

Writes the specified number of elements from the specified storage location into the buffer at its tail.

It is an error for count to be greater than free().

For maximum efficiency, choose as large a count as possible.

The pointer buf may be NULL only if count == 0.

After this operation, at least count elements may be unallocated.

"data" is the buffer that contains the elements "count" is the number of elements

Definition at line 483 of file include/wvbufbase.h.

◆ put() [4/4]

template<class T >
void WvBufBaseCommonImpl< T >::put ( T &  value)
inlineinherited

Writes the element into the buffer at its tail.

It is an error to invoke this method if free() == 0.

After this operation, at least 1 element may be unallocated.

"valid" is the element

Definition at line 519 of file include/wvbufbase.h.

◆ poke() [1/4]

template<class T >
void WvBufBaseCommonImpl< T >::poke ( const T *  data,
int  offset,
size_t  count 
)
inlineinherited

Efficiently copies the specified number of elements from the specified storage location into the buffer at a particular offset.

If offset <= used() and offset + count > used(), the remaining data is simply tacked onto the end of the buffer with put().

It is an error for count to be greater than free() - offset.

"data" is the buffer that contains the elements "count" is the number of elements "offset" is the buffer offset, default 0

Definition at line 504 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

Referenced by WvBufBaseCommonImpl< T >::poke().

◆ poke() [2/4]

template<class T >
void WvBufBaseCommonImpl< T >::poke ( T &  value,
int  offset 
)
inlineinherited

Writes the element into the buffer at the specified offset.

It is an error to invoke this method if free() == 0.

After this operation, at least 1 element may be unallocated.

"value" is the element "offset" is the buffer offset

Definition at line 535 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

References WvBufBaseCommonImpl< T >::poke().

◆ poke() [3/4]

template<class T >
void WvBufBaseCommonImpl< T >::poke ( const T *  data,
int  offset,
size_t  count 
)
inlineinherited

Efficiently copies the specified number of elements from the specified storage location into the buffer at a particular offset.

If offset <= used() and offset + count > used(), the remaining data is simply tacked onto the end of the buffer with put().

It is an error for count to be greater than free() - offset.

"data" is the buffer that contains the elements "count" is the number of elements "offset" is the buffer offset, default 0

Definition at line 504 of file include/wvbufbase.h.

◆ poke() [4/4]

template<class T >
void WvBufBaseCommonImpl< T >::poke ( T &  value,
int  offset 
)
inlineinherited

Writes the element into the buffer at the specified offset.

It is an error to invoke this method if free() == 0.

After this operation, at least 1 element may be unallocated.

"value" is the element "offset" is the buffer offset

Definition at line 535 of file include/wvbufbase.h.

References WvBufBaseCommonImpl< T >::poke().

◆ merge() [1/4]

template<class T >
void WvBufBaseCommonImpl< T >::merge ( Buffer inbuf,
size_t  count 
)
inlineinherited

Efficiently moves count bytes from the specified buffer into this one.

In some cases, this may be a zero-copy operation.

It is an error for count to be greater than inbuf.used().

For maximum efficiency, choose as large a count as possible.

After this operation, an indeterminate number of elements may be ungotten from inbuf.

"inbuf" is the buffer from which to read "count" is the number of elements

Definition at line 558 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

Referenced by WvEncoderStream::finish_read(), WvEncoderStream::flush_read(), WvBufBaseCommonImpl< T >::merge(), and WvStream::unread().

◆ merge() [2/4]

template<class T >
void WvBufBaseCommonImpl< T >::merge ( Buffer inbuf)
inlineinherited

Efficiently merges the entire contents of a buffer into this one.

"inbuf" is the buffer from which to read

Definition at line 568 of file debian/libwvstreams-dev/usr/include/wvstreams/wvbufbase.h.

References WvBufBaseCommonImpl< T >::merge(), and WvBufBaseCommonImpl< T >::used().

◆ merge() [3/4]

template<class T >
void WvBufBaseCommonImpl< T >::merge ( Buffer inbuf,
size_t  count 
)
inlineinherited

Efficiently moves count bytes from the specified buffer into this one.

In some cases, this may be a zero-copy operation.

It is an error for count to be greater than inbuf.used().

For maximum efficiency, choose as large a count as possible.

After this operation, an indeterminate number of elements may be ungotten from inbuf.

"inbuf" is the buffer from which to read "count" is the number of elements

Definition at line 558 of file include/wvbufbase.h.

◆ merge() [4/4]

template<class T >
void WvBufBaseCommonImpl< T >::merge ( Buffer inbuf)
inlineinherited

Efficiently merges the entire contents of a buffer into this one.

"inbuf" is the buffer from which to read

Definition at line 568 of file include/wvbufbase.h.

References WvBufBaseCommonImpl< T >::merge(), and WvBufBaseCommonImpl< T >::used().

Member Data Documentation

◆ mystore

WvInPlaceBufStore WvInPlaceBufBase< unsigned char >::mystore
protectedinherited

◆ store

template<class T >
WvBufStore * WvBufBaseCommonImpl< T >::store
protectedinherited

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