# cCommBufferBase Class Reference

Adds buffer (re)allocation functions to cCommBuffer. More...

`#include <ccommbufferbase.h>`

Inheritance diagram for cCommBufferBase:

List of all members.

## Public Member Functions

| cCommBufferBase ()
virtual | ~cCommBufferBase ()
Buffer management
char * | getBuffer ()
int | getBufferLength ()
void | allocateAtLeast (int size)
void | setMessageSize (int size)
int | getMessageSize ()
void | reset ()
virtual bool | isBufferEmpty ()
virtual void | assertBufferEmpty ()

## Detailed Description

Adds buffer (re)allocation functions to cCommBuffer.

This functionality is not always needed, e.g. PVM manages its pack/unpack buffers internally.

## Constructor & Destructor Documentation

cCommBufferBase::cCommBufferBase | ( |  | ) |

| Constructor.

virtual cCommBufferBase::~cCommBufferBase | ( |  | ) | `[virtual]`

| Destructor.

## Member Function Documentation

void cCommBufferBase::allocateAtLeast | ( | int | size | ) |

| Extend buffer to the given size is needed. Existing buffer contents may be lost.

virtual void cCommBufferBase::assertBufferEmpty | ( |  | ) | `[virtual]`

| Utility function. To be called after unpacking a communication buffer, it checks whether the buffer is empty. If it is not (i.e. an underflow or overflow occurred), an exception is thrown. Implements cCommBuffer.

char* cCommBufferBase::getBuffer | ( |  | ) |

| Returns the buffer after packing.

int cCommBufferBase::getBufferLength | ( |  | ) |

| Returns the size of the buffer.

int cCommBufferBase::getMessageSize | ( |  | ) |

| Returns message length in the buffer.

virtual bool cCommBufferBase::isBufferEmpty | ( |  | ) | `[virtual]`

| Returns true if all data in buffer was used up during unpacking. Returns false if there was underflow (too much data unpacked) or still there's unpacked data in the buffer. Implements cCommBuffer.

void cCommBufferBase::reset | ( |  | ) |

| Reset buffer to an empty state.

void cCommBufferBase::setMessageSize | ( | int | size | ) |

| Set message length in the buffer. Used after receiving a message and copying it to the buffer. Reimplemented in cFileCommBuffer.

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

- ccommbufferbase.h