WvStreams
Public Member Functions | Protected Types | Protected Attributes | List of all members
WvConstInPlaceBufBase< T > Class Template Reference

A buffer that wraps a pre-allocated array and provides read-only access to its elements. More...

#include <wvbufbase.h>

Inheritance diagram for WvConstInPlaceBufBase< T >:
Inheritance graph
[legend]

Public Member Functions

 WvConstInPlaceBufBase (const T *_data, size_t _avail)
 Creates a new buffer backed by the supplied array. More...
 
 WvConstInPlaceBufBase ()
 Creates a new empty buffer with no backing array.
 
virtual ~WvConstInPlaceBufBase ()
 Destroys the buffer. More...
 
const T * ptr () const
 Returns the underlying array pointer. More...
 
void reset (const T *_data, size_t _avail)
 Resets the underlying buffer pointer and properties. More...
 
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. More...
 

Protected Types

typedef T Elem
 

Protected Attributes

WvConstInPlaceBufStore mystore
 

Detailed Description

template<class T>
class WvConstInPlaceBufBase< T >

A buffer that wraps a pre-allocated array and provides read-only access to its elements.

"T" is the type of object to store, must be a primitive or a struct without special initialization, copy, or assignment semantics

Definition at line 727 of file wvbufbase.h.

Constructor & Destructor Documentation

◆ WvConstInPlaceBufBase()

template<class T >
WvConstInPlaceBufBase< T >::WvConstInPlaceBufBase ( const T *  _data,
size_t  _avail 
)
inline

Creates a new buffer backed by the supplied array.

"_data" is the array of data to wrap "_avail" is the amount of data available for reading

Definition at line 741 of file wvbufbase.h.

◆ ~WvConstInPlaceBufBase()

template<class T >
virtual WvConstInPlaceBufBase< T >::~WvConstInPlaceBufBase ( )
inlinevirtual

Destroys the buffer.

Never frees the underlying array.

Definition at line 756 of file wvbufbase.h.

Member Function Documentation

◆ ptr()

template<class T >
const T* WvConstInPlaceBufBase< T >::ptr ( ) const
inline

Returns the underlying array pointer.

Returns: the element pointer

Definition at line 763 of file wvbufbase.h.

◆ reset()

template<class T >
void WvConstInPlaceBufBase< T >::reset ( const T *  _data,
size_t  _avail 
)
inline

Resets the underlying buffer pointer and properties.

Never frees the old buffer.

"_data" is the array of data to wrap "_avail" is the amount of data available for reading

Definition at line 777 of file wvbufbase.h.

◆ setavail()

template<class T >
void WvConstInPlaceBufBase< T >::setavail ( size_t  _avail)
inline

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 788 of file wvbufbase.h.


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