AbstractBuffer< T > Class Template Reference

An abstract base class for buffers. More...

#include <AbstractBuffer.h++>

Inheritance diagram for AbstractBuffer< T >:

Inheritance graph
[legend]
Collaboration diagram for AbstractBuffer< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~AbstractBuffer () throw ()
 Destructor.
virtual void setSize (size_t newSize)
 Resize the buffer.
virtual void clear () throw ()
 Clear the buffer.
size_t getSize () const throw ()
 Get the size of the buffer.
virtual size_t getRemaining () const =0 throw ()
 Get the number of elements remaining in the buffer.
virtual bool hasRemaining () const throw ()
 Test if the buffer has elements available to be read or written.
T * getBase () throw ()
 Get a pointer to the base of the buffer.
const T * getBase () const throw ()
 Get a pointer to the base of the buffer.

Protected Member Functions

 AbstractBuffer (size_t size)
 Construct a new buffer with the given size.

Protected Attributes

T * _data
 A pointer to the raw buffer.
size_t _size
 The size of the buffer.


Detailed Description

template<typename T>
class ccxx::AbstractBuffer< T >

An abstract base class for buffers.

Author:
Mark Lindner

Constructor & Destructor Documentation

~AbstractBuffer (  )  throw () [inline, virtual]

Destructor.

AbstractBuffer ( size_t  size  )  [inline, protected]

Construct a new buffer with the given size.

Parameters:
size The capacity of the buffer, in elements.


Member Function Documentation

void clear (  )  throw () [inline, virtual]

const T* getBase (  )  const throw () [inline]

Get a pointer to the base of the buffer.

T* getBase (  )  throw () [inline]

Get a pointer to the base of the buffer.

virtual size_t getRemaining (  )  const throw () [pure virtual]

Get the number of elements remaining in the buffer.

Implemented in Buffer< T >, CircularBuffer< T >, Buffer< char >, Buffer< byte_t >, CircularBuffer< C >, and CircularBuffer< byte_t >.

size_t getSize (  )  const throw () [inline]

Get the size of the buffer.

Returns:
The size, in elements.

virtual bool hasRemaining (  )  const throw () [inline, virtual]

Test if the buffer has elements available to be read or written.

Reimplemented in Buffer< T >, Buffer< char >, and Buffer< byte_t >.

void setSize ( size_t  newSize  )  [inline, virtual]

Resize the buffer.

Parameters:
newSize The new size, in elements.

Reimplemented in CircularBuffer< T >, JavaBuffer, CircularBuffer< C >, and CircularBuffer< byte_t >.


Member Data Documentation

T* _data [protected]

A pointer to the raw buffer.

size_t _size [protected]

The size of the buffer.


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

Generated on Sat Apr 17 23:03:07 2010 for libcommonc++ by  doxygen 1.5.9