Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

Buffer Class Reference

#include <Buffer.h>

List of all members.


Detailed Description

Buffer.

A buffer has three main properties: position, capacity and limit. Capacity is the real size of the underlying array. Position is the index of the current element in the buffer (used only by buffer filling operations at the moment). Limit is the virtual size of the buffer. Operations such as filling up the buffer, seeking and so on never go over the limit mark of the buffer.

0 <= position <= limit <= capacity.

Definition at line 15 of file Buffer.h.

Public Member Functions

 Buffer (int size)
 Constructs a new buffer of specified capacity and limit.
 Buffer (const Buffer &rhs)
 Constructs a copy of the buffer.
Bufferoperator= (const Buffer &rhs)
 Makes this buffer a copy of the rhs buffer.
virtual ~Buffer ()
 destructor, deletes data
const char * GetData () const
 Gets the pointer to the first element of the underlying array.
char * GetData ()
 Gets the pointer to the first element of the underlying array.
int GetCapacity () const
 Gets the capacity of the buffer.
void SetCapacity (int size)
 Sets the capacity of the buffer. The underlying array grows and shrinks.
int GetPosition () const
 Gets the current position. position <= limit.
int GetLimit () const
 Gets the limit mark of the buffer. limit <= capacity.
void SetPosition (int pos)
 Sets the current position.
void SetLimit (int lim)
 Sets the limit mark. limit <= capacity.
bool Fill (const char *&src, int &srcLen)
 Tries to fill the buffer from current position up to the limit mark. Advances the position, src and srcLen. Returns true if the buffer has been filled.
bool Fill (char *&src, int &srcLen)
 Tries to fill the buffer from current position up to the limit mark. Advances the position, src and srcLen. Returns true if the buffer has been filled.
bool IsFull () const
 Checks whether the buffer is full, that is position == limit.

Static Private Member Functions

static int min (int a, int b)
 returns the lesser of or

Private Attributes

char * data
 the buffer itself
int capacity
 the the real size of the underlying array.
int limit
 Position is the index of the current element in the buffer (used only by buffer filling operations at the moment).
int position
 Limit is the virtual size of the buffer. Operations such as filling up the buffer, seeking and so on never go over the limit mark of the buffer.


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

Tekkotsu v3.0
Generated Fri May 11 20:07:47 2007 by Doxygen 1.4.7