#include <CharPack.h>
Inheritance diagram for CharPack::

Public Methods | |
| CharPack () | |
| CharPack (int nbytes) | |
| ~CharPack () | |
| bool | redim (int nbytes) |
| int | getNoItems () const |
| char* | getCharArray () |
| int | getCurrentIndex () const |
| void | initPack () |
| void | initUnPack () |
| bool | pack (real r) |
| bool | pack (int i) |
| bool | pack (const String &s) |
| bool | pack (const Complex &c) |
| bool | unpack (real &r) |
| bool | unpack (int &i) |
| bool | unpack (String &s) |
| bool | unpack (Complex &c) |
| void | debugPrint (Os os) |
Protected Methods | |
| void | copy (char *from, int nbytes, char *to) |
Protected Attributes | |
| VecSimplest(char) | array |
| int | current_index |
| int | nitems |
NAME: CharPack - pack arbitrary data byte by byte in a char vector
DESCRIPTION:
The class enables easy packing and unpacking of data (real, integers and strings) from a char array. This is useful for communication of complicated mixed data structures for message passing or for compact binary storage.
|
|
There are two constructors. One that takes no argument and requires a call to the "redim" function before use, and one that takes the upper limit of the char array (the number of bytes to be packed) as argument. Hopefully, the programmer is able to compute this length exactly. |
|
|
|
|
|
|
|
|
|
|
|
print the contents of the array for debugging purposes. |
|
|
get the pointer to the underlying char-array. |
|
|
get the current array index. |
|
|
number of items packed in the array (equals number of calls to a pack function. |
|
|
initialize the data before starting to pack. |
|
|
initialize the data before starting to unpack. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
unpack a "real", "int", "String" or "Complex" from the array. |
|
|
|
|
|
|
|
|
|