# cCommBuffer Class Reference
[Parallel simulation extension]

`#include <ccommbuffer.h>`

Inheritance diagram for cCommBuffer:

List of all members.

## Detailed Description

Buffer for the communications layer of parallel simulation.

This is an abstract class which has different implementations for specific communication mechanisms. For example, the MPI implementation, cMPICommBuffer encapsulates MPI_Pack() and MPI_Unpack().

See also:
  cObject::netPack(), cObject::netUnpack()

## Public Member Functions

virtual | ~cCommBuffer ()
Buffer management
virtual bool | isBufferEmpty ()=0
virtual void | assertBufferEmpty ()=0
Pack basic types
virtual void | pack (char d)=0
virtual void | pack (unsigned char d)=0
virtual void | pack (bool d)=0
virtual void | pack (short d)=0
virtual void | pack (unsigned short d)=0
virtual void | pack (int d)=0
virtual void | pack (unsigned int d)=0
virtual void | pack (long d)=0
virtual void | pack (unsigned long d)=0
virtual void | pack (float d)=0
virtual void | pack (double d)=0
virtual void | pack (long double d)=0
void | pack (char *d)
virtual void | pack (const char *d)=0
virtual void | pack (opp_string &d)=0
Pack arrays of basic types
virtual void | pack (const char *d, int size)=0
virtual void | pack (unsigned char *d, int size)=0
virtual void | pack (bool *d, int size)=0
virtual void | pack (short *d, int size)=0
virtual void | pack (unsigned short *d, int size)=0
virtual void | pack (int *d, int size)=0
virtual void | pack (unsigned int *d, int size)=0
virtual void | pack (long *d, int size)=0
virtual void | pack (unsigned long *d, int size)=0
virtual void | pack (float *d, int size)=0
virtual void | pack (double *d, int size)=0
virtual void | pack (long double *d, int size)=0
void | pack (char **d, int size)
virtual void | pack (const char **d, int size)=0
virtual void | pack (opp_string *d, int size)=0
Unpack basic types
virtual void | unpack (char &d)=0
virtual void | unpack (unsigned char &d)=0
virtual void | unpack (bool &d)=0
virtual void | unpack (short &d)=0
virtual void | unpack (unsigned short &d)=0
virtual void | unpack (int &d)=0
virtual void | unpack (unsigned int &d)=0
virtual void | unpack (long &d)=0
virtual void | unpack (unsigned long &d)=0
virtual void | unpack (float &d)=0
virtual void | unpack (double &d)=0
virtual void | unpack (long double &d)=0
void | unpack (char *&d)
virtual void | unpack (const char *&d)=0
virtual void | unpack (opp_string &d)=0
Unpack arrays of basic types
virtual void | unpack (char *d, int size)=0
virtual void | unpack (unsigned char *d, int size)=0
virtual void | unpack (bool *d, int size)=0
virtual void | unpack (short *d, int size)=0
virtual void | unpack (unsigned short *d, int size)=0
virtual void | unpack (int *d, int size)=0
virtual void | unpack (unsigned int *d, int size)=0
virtual void | unpack (long *d, int size)=0
virtual void | unpack (unsigned long *d, int size)=0
virtual void | unpack (float *d, int size)=0
virtual void | unpack (double *d, int size)=0
virtual void | unpack (long double *d, int size)=0
void | unpack (char **d, int size)
virtual void | unpack (const char **d, int size)=0
virtual void | unpack (opp_string *d, int size)=0
Utility functions
bool | packFlag (bool flag)
bool | checkFlag ()
virtual void | packObject (cObject *obj)
virtual cObject * | unpackObject ()

## Constructor & Destructor Documentation

virtual cCommBuffer::~cCommBuffer | ( |  | ) | `[inline, virtual]`

| Virtual destructor.

## Member Function Documentation

virtual void cCommBuffer::assertBufferEmpty | ( |  | ) | `[pure 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.

bool cCommBuffer::checkFlag | ( |  | ) | `[inline]`

| Unpacks and returns a bool flag stored by packFlag().

virtual bool cCommBuffer::isBufferEmpty | ( |  | ) | `[pure 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.

virtual void cCommBuffer::pack | ( | opp_string * | d,
|  | int | size
| ) | `[pure virtual]`

| Packs an array of opp_strings.

virtual void cCommBuffer::pack | ( | const char ** | d,
|  | int | size
| ) | `[pure virtual]`

| Packs an array of strings.

void cCommBuffer::pack | ( | char ** | d,
|  | int | size
| ) | `[inline]`

| Packs an array of strings.

virtual void cCommBuffer::pack | ( | long double * | d,
|  | int | size
| ) | `[pure virtual]`

| Packs an array of long doubles.

virtual void cCommBuffer::pack | ( | double * | d,
|  | int | size
| ) | `[pure virtual]`

| Packs an array of doubles.

virtual void cCommBuffer::pack | ( | float * | d,
|  | int | size
| ) | `[pure virtual]`

| Packs an array of floats.

virtual void cCommBuffer::pack | ( | unsigned long * | d,
|  | int | size
| ) | `[pure virtual]`

| Packs an array of unsigned longs.

virtual void cCommBuffer::pack | ( | long * | d,
|  | int | size
| ) | `[pure virtual]`

| Packs an array of longs.

virtual void cCommBuffer::pack | ( | unsigned int * | d,
|  | int | size
| ) | `[pure virtual]`

| Packs an array of unsigned ints.

virtual void cCommBuffer::pack | ( | int * | d,
|  | int | size
| ) | `[pure virtual]`

| Packs an array of ints.

virtual void cCommBuffer::pack | ( | unsigned short * | d,
|  | int | size
| ) | `[pure virtual]`

| Packs an array of unsigned shorts.

virtual void cCommBuffer::pack | ( | short * | d,
|  | int | size
| ) | `[pure virtual]`

| Packs an array of shorts.

virtual void cCommBuffer::pack | ( | bool * | d,
|  | int | size
| ) | `[pure virtual]`

| Packs an array of bools.

virtual void cCommBuffer::pack | ( | unsigned char * | d,
|  | int | size
| ) | `[pure virtual]`

| Packs an array of unsigned chars.

virtual void cCommBuffer::pack | ( | const char * | d,
|  | int | size
| ) | `[pure virtual]`

| Packs an array of chars.

virtual void cCommBuffer::pack | ( | opp_string & | d | ) | `[pure virtual]`

| Packs a string.

virtual void cCommBuffer::pack | ( | const char * | d | ) | `[pure virtual]`

| Packs a string.

void cCommBuffer::pack | ( | char * | d | ) | `[inline]`

| Packs a string.

virtual void cCommBuffer::pack | ( | long double | d | ) | `[pure virtual]`

| Packs a long double.

virtual void cCommBuffer::pack | ( | double | d | ) | `[pure virtual]`

| Packs a double.

virtual void cCommBuffer::pack | ( | float | d | ) | `[pure virtual]`

| Packs a float.

virtual void cCommBuffer::pack | ( | unsigned long | d | ) | `[pure virtual]`

| Packs an unsigned long int.

virtual void cCommBuffer::pack | ( | long | d | ) | `[pure virtual]`

| Packs a long int.

virtual void cCommBuffer::pack | ( | unsigned int | d | ) | `[pure virtual]`

| Packs an unsigned int.

virtual void cCommBuffer::pack | ( | int | d | ) | `[pure virtual]`

| Packs an int.

virtual void cCommBuffer::pack | ( | unsigned short | d | ) | `[pure virtual]`

| Packs an unsigned short int.

virtual void cCommBuffer::pack | ( | short | d | ) | `[pure virtual]`

| Packs a short int.

virtual void cCommBuffer::pack | ( | bool | d | ) | `[pure virtual]`

| Packs a bool.

virtual void cCommBuffer::pack | ( | unsigned char | d | ) | `[pure virtual]`

| Packs an unsigned character.

virtual void cCommBuffer::pack | ( | char | d | ) | `[pure virtual]`

| Packs a character.

bool cCommBuffer::packFlag | ( | bool | flag | ) | `[inline]`

| Stores and returns the given flag.

virtual void cCommBuffer::packObject | ( | cObject * | obj | ) | `[virtual]`

| Packs an object.

virtual void cCommBuffer::unpack | ( | opp_string * | d,
|  | int | size
| ) | `[pure virtual]`

| Unpacks an array of opp_strings.

virtual void cCommBuffer::unpack | ( | const char ** | d,
|  | int | size
| ) | `[pure virtual]`

| Unpacks an array of strings -- storage for strings will be allocated via new char[].

void cCommBuffer::unpack | ( | char ** | d,
|  | int | size
| ) | `[inline]`

| Unpacks an array of strings -- storage for strings will be allocated via new char[].

virtual void cCommBuffer::unpack | ( | long double * | d,
|  | int | size
| ) | `[pure virtual]`

| Unpacks an array of long doubles.

virtual void cCommBuffer::unpack | ( | double * | d,
|  | int | size
| ) | `[pure virtual]`

| Unpacks an array of doubles.

virtual void cCommBuffer::unpack | ( | float * | d,
|  | int | size
| ) | `[pure virtual]`

| Unpacks an array of floats.

virtual void cCommBuffer::unpack | ( | unsigned long * | d,
|  | int | size
| ) | `[pure virtual]`

| Unpacks an array of unsigned longs.

virtual void cCommBuffer::unpack | ( | long * | d,
|  | int | size
| ) | `[pure virtual]`

| Unpacks an array of longs.

virtual void cCommBuffer::unpack | ( | unsigned int * | d,
|  | int | size
| ) | `[pure virtual]`

| Unpacks an array of unsigned ints.

virtual void cCommBuffer::unpack | ( | int * | d,
|  | int | size
| ) | `[pure virtual]`

| Unpacks an array of ints.

virtual void cCommBuffer::unpack | ( | unsigned short * | d,
|  | int | size
| ) | `[pure virtual]`

| Unpacks an array of unsigned shorts.

virtual void cCommBuffer::unpack | ( | short * | d,
|  | int | size
| ) | `[pure virtual]`

| Unpacks an array of shorts.

virtual void cCommBuffer::unpack | ( | bool * | d,
|  | int | size
| ) | `[pure virtual]`

| Unpacks an array of bools.

virtual void cCommBuffer::unpack | ( | unsigned char * | d,
|  | int | size
| ) | `[pure virtual]`

| Unpacks an array of unsigned chars.

virtual void cCommBuffer::unpack | ( | char * | d,
|  | int | size
| ) | `[pure virtual]`

| Unpacks an array of chars.

virtual void cCommBuffer::unpack | ( | opp_string & | d | ) | `[pure virtual]`

| Unpacks an opp_string.

virtual void cCommBuffer::unpack | ( | const char *& | d | ) | `[pure virtual]`

| Unpacks a string -- storage will be allocated for it via new char[].

void cCommBuffer::unpack | ( | char *& | d | ) | `[inline]`

| Unpacks a string -- storage will be allocated for it via new char[].

virtual void cCommBuffer::unpack | ( | long double & | d | ) | `[pure virtual]`

| Unpacks a long double.

virtual void cCommBuffer::unpack | ( | double & | d | ) | `[pure virtual]`

| Unpacks a double.

virtual void cCommBuffer::unpack | ( | float & | d | ) | `[pure virtual]`

| Unpacks a float.

virtual void cCommBuffer::unpack | ( | unsigned long & | d | ) | `[pure virtual]`

| Unpacks an unsigned long.

virtual void cCommBuffer::unpack | ( | long & | d | ) | `[pure virtual]`

| Unpacks a long.

virtual void cCommBuffer::unpack | ( | unsigned int & | d | ) | `[pure virtual]`

| Unpacks an unsigned int.

virtual void cCommBuffer::unpack | ( | int & | d | ) | `[pure virtual]`

| Unpacks an int.

virtual void cCommBuffer::unpack | ( | unsigned short & | d | ) | `[pure virtual]`

| Unpacks an unsigned short.

virtual void cCommBuffer::unpack | ( | short & | d | ) | `[pure virtual]`

| Unpacks a short.

virtual void cCommBuffer::unpack | ( | bool & | d | ) | `[pure virtual]`

| Unpacks a bool.

virtual void cCommBuffer::unpack | ( | unsigned char & | d | ) | `[pure virtual]`

| Unpacks an unsigned char.

virtual void cCommBuffer::unpack | ( | char & | d | ) | `[pure virtual]`

| Unpacks a char.

virtual cObject* cCommBuffer::unpackObject | ( |  | ) | `[virtual]`

| Unpacks and returns an object.

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

- ccommbuffer.h