Diffpack Documentation


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

CharPack Class Reference

pack arbitrary data byte by byte in a char vector. More...

#include <CharPack.h>

Inheritance diagram for CharPack::

CharPackMPI List of all members.

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

Detailed Description

pack arbitrary data byte by byte in a char vector.

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.


Constructor & Destructor Documentation

CharPack::CharPack ( ) [inline]
 

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.

CharPack::CharPack ( int nbytes ) [inline]
 

CharPack::~CharPack ( ) [inline]
 


Member Function Documentation

void CharPack::copy ( char * from,
int nbytes,
char * to ) [protected]
 

void CharPack::debugPrint ( Os os )
 

print the contents of the array for debugging purposes.

char * CharPack::getCharArray ( ) [inline]
 

get the pointer to the underlying char-array.

int CharPack::getCurrentIndex ( ) const [inline]
 

get the current array index.

int CharPack::getNoItems ( ) const [inline]
 

number of items packed in the array (equals number of calls to a pack function.

void CharPack::initPack ( ) [inline]
 

initialize the data before starting to pack.

void CharPack::initUnPack ( ) [inline]
 

initialize the data before starting to unpack.

bool CharPack::pack ( const Complex & c )
 

See documentation of one of the overloaded functions.

bool CharPack::pack ( const String & s )
 

See documentation of one of the overloaded functions.

bool CharPack::pack ( int i )
 

See documentation of one of the overloaded functions.

bool CharPack::pack ( real r )
 

pack a "real", "int", "String" or "Complex" into the array.

bool CharPack::redim ( int nbytes ) [inline]
 

See documentation of one of the overloaded functions.

bool CharPack::unpack ( Complex & c )
 

See documentation of one of the overloaded functions.

bool CharPack::unpack ( String & s )
 

See documentation of one of the overloaded functions.

bool CharPack::unpack ( int & i )
 

See documentation of one of the overloaded functions.

bool CharPack::unpack ( real & r )
 

unpack a "real", "int", "String" or "Complex" from the array.


Member Data Documentation

VecSimplest(char) CharPack::array [protected]
 

int CharPack::current_index [protected]
 

int CharPack::nitems [protected]
 


The documentation for this class was generated from the following file:
Copyright © 2003 inuTech GmbH. All rights reserved.