Dakota  Version
Explore and Predict with Confidence
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MPIPackBuffer Class Reference

Class for packing MPI message buffers. More...

Public Member Functions

 MPIPackBuffer (int size_=1024)
 Constructor, which allows the default buffer size to be set.
 
 ~MPIPackBuffer ()
 Desctructor.
 
const char * buf ()
 Returns a pointer to the internal buffer that has been packed.
 
int size ()
 The number of bytes of packed data.
 
int capacity ()
 the allocated size of Buffer.
 
void reset ()
 Resets the buffer index in order to reuse the internal buffer.
 
void pack (const int *data, const int num=1)
 Pack one or more int's.
 
void pack (const u_int *data, const int num=1)
 Pack one or more unsigned int's.
 
void pack (const long *data, const int num=1)
 Pack one or more long's.
 
void pack (const u_long *data, const int num=1)
 Pack one or more unsigned long's.
 
void pack (const long long *data, const int num=1)
 Pack one or more long long's.
 
void pack (const unsigned long long *data, const int num=1)
 Pack one or more unsigned long long's.
 
void pack (const short *data, const int num=1)
 Pack one or more short's.
 
void pack (const u_short *data, const int num=1)
 Pack one or more unsigned short's.
 
void pack (const char *data, const int num=1)
 Pack one or more char's.
 
void pack (const u_char *data, const int num=1)
 Pack one or more unsigned char's.
 
void pack (const double *data, const int num=1)
 Pack one or more double's.
 
void pack (const float *data, const int num=1)
 Pack one or more float's.
 
void pack (const bool *data, const int num=1)
 Pack one or more bool's.
 
void pack (const int &data)
 Pack a int.
 
void pack (const u_int &data)
 Pack a unsigned int.
 
void pack (const long &data)
 Pack a long.
 
void pack (const u_long &data)
 Pack a unsigned long.
 
void pack (const long long &data)
 Pack a long long.
 
void pack (const unsigned long long &data)
 Pack a unsigned long long.
 
void pack (const short &data)
 Pack a short.
 
void pack (const u_short &data)
 Pack a unsigned short.
 
void pack (const char &data)
 Pack a char.
 
void pack (const u_char &data)
 Pack a unsigned char.
 
void pack (const double &data)
 Pack a double.
 
void pack (const float &data)
 Pack a float.
 
void pack (const bool &data)
 Pack a bool.
 

Protected Member Functions

void resize (const int newsize)
 Resizes the internal buffer.
 

Protected Attributes

char * Buffer
 The internal buffer for packing.
 
int Index
 The index into the current buffer.
 
int Size
 The total size that has been allocated for the buffer.
 

Detailed Description

Class for packing MPI message buffers.

A class that provides a facility for packing message buffers using the MPI_Pack facility. The MPIPackBuffer class dynamically resizes the internal buffer to contain enough memory to pack the entire object. When deleted, the MPIPackBuffer object deletes this internal buffer. This class is based on the Dakota_Version_3_0 version of utilib::PackBuffer from utilib/src/io/PackBuf.[cpp,h]. This snapshot preceded the introduction of templatization on data type, which was problematic at that time (would be more reliable now).


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