sends::buffer Class Reference
[Sends Data Classes]

Preallocated buffer class. More...

#include <buffer.hh>

List of all members.

Public Types

typedef unsigned long size_type

Public Member Functions

 buffer (size_type length)
 Constructor.
 ~buffer (void)
 Destructor.
size_type capacity (void) const
 Buffer capacity.
void clear (void)
 Clear data buffer.
const char * data (void) const
 Data pointer.
char * data (void)
 Data pointer.
void free (void)
 Return buffer to the appropriate free list.
char & operator[] (size_type inx)
 Ith data byte.
char operator[] (size_type inx) const
 Ith data byte.
void power_clean (void)
 Scour data from buffer.
void purge (void)
 Purge the buffer.
size_type push (size_type n)
 Increment the data length pointer.
void resize (size_type n)
 Reset the data length.
void reserve (size_type n)
 Reserve specified length buffer.
void set_pool (buffer_pool *pool)
 Data length.
size_type size (void) const
 Data length.


Detailed Description

Preallocated buffer class.

The buffer class defines a preallocated fixed length buffer with a variable current size pointer.

Author:
John Zweizig
Version:
1.0; Last modified January 23, 2008

Member Typedef Documentation

typedef unsigned long sends::buffer::size_type

Data type used for length variables.


Constructor & Destructor Documentation

sends::buffer::buffer ( size_type  length  ) 

Constructor.

Construct a buffer with the specified length and free queue. The current length pointer is set to zero.

Parameters:
length Buffer capacity in bytes.
q Free queue pointer.

sends::buffer::~buffer ( void   ) 

Destructor.

Destroy a buffer.


Member Function Documentation

buffer::size_type sends::buffer::capacity ( void   )  const [inline]

Buffer capacity.

Return the allocated capacity of the buffer.

Returns:
Buffer capacity (defined at allocation time).

void sends::buffer::clear ( void   ) 

Clear data buffer.

Zero the current data length. The buffer remains allocated.

const char * sends::buffer::data ( void   )  const [inline]

Data pointer.

Return a constant pointer to the buffer data area.

Returns:
Constant pointer to the buffer data area.

char * sends::buffer::data ( void   )  [inline]

Data pointer.

Return apointer to the buffer data area.

Returns:
Pointer to the buffer data area.

void sends::buffer::free ( void   ) 

Return buffer to the appropriate free list.

Return the buffer to its free list. The buffer remains allocated.

char & sends::buffer::operator[] ( size_type  inx  )  [inline]

Ith data byte.

Return a referece to the ith byte in the data buffer.

Parameters:
inx Index of character to be referenced.
Returns:
Reference to the ith data byte.

char sends::buffer::operator[] ( size_type  inx  )  const [inline]

Ith data byte.

Return a constant reference to the ith byte in the data buffer.

Parameters:
inx Index of character to be referenced.
Returns:
Constant reference to the ith data byte.

void sends::buffer::power_clean ( void   ) 

Scour data from buffer.

Rewrite the entire buffer with zeroes and set the current data length to zero.

void sends::buffer::purge ( void   ) 

Purge the buffer.

Deallocate the buffer data vector and set the buffer capacity and current data lenth to zero.

size_type sends::buffer::push ( size_type  n  ) 

Increment the data length pointer.

Increase the current data length by the specified number of bytes. if the resulting length is greater than the buffer capacity, the data length is set to the buffer capacity.

Parameters:
n Number of bytesto add to the buffer data length.
Returns:
New data length.

void sends::buffer::resize ( size_type  n  ) 

Reset the data length.

Change the current data length of the buffer. The data contents and the capacity of the buffer remain unchanged. If the requested size is greater than the capacity of the buffer, the data length is set to the buffer length.

Parameters:
n New data length value.

void sends::buffer::reserve ( size_type  n  ) 

Reserve specified length buffer.

Expand the buffer capacity to the specified number of bytes. Any data currently contain in the buffer are lost and the current data length is set to zero. No action is taken if the current capacity of the buffer is greater than or equal to the requested length.

Parameters:
n New length of buffer.

void sends::buffer::set_pool ( buffer_pool pool  ) 

Data length.

Get the current data length.

Parameters:
pool Pointer to pool.

buffer::size_type sends::buffer::size ( void   )  const [inline]

Data length.

Get the current data length.

Returns:
Data length in bytes.


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

Generated on Tue Jun 10 12:18:12 2008 for SENDS by  doxygen 1.5.5