ESyS-Particle
4.0.1
|
Message buffer for sending and receiving packed data to mutltiple receivers. Data types are not checked. The implementation has been derived from the old CMPIVarSGBufferRoot class. More...
#include <packed_multi_message.h>
Public Member Functions | |
TML_PackedMultiMessage (MPI_Comm, int isize=64) | |
TML_PackedMultiMessageSlab | operator[] (int) |
char * | buffer () |
int * | offsets () |
int * | sizes () |
void | clear () |
void | begin_pack (int) |
void | begin_unpack (int) |
void | append (int, int) |
void | append (double, int) |
void | append (const string &, int) |
void | append (bool, int) |
int | pop_int (int) |
double | pop_double (int) |
string | pop_string (int) |
bool | pop_bool (int) |
Protected Member Functions | |
void | grow () |
void | growTo (int) |
Message buffer for sending and receiving packed data to mutltiple receivers. Data types are not checked. The implementation has been derived from the old CMPIVarSGBufferRoot class.
TML_PackedMultiMessage::TML_PackedMultiMessage | ( | MPI_Comm | comm, |
int | isize = 64 |
||
) |
Constructor for TML_PackedMultiMessage
comm | the MPI communicator |
isize | initial buffer size per slice, default 64 byte |
void TML_PackedMultiMessage::append | ( | int | i, |
int | nslice | ||
) |
Append an integer to a given slice of the buffer.
i | the integer |
nslice | the nr. of the slice |
References grow().
Referenced by TML_PackedMultiMessageSlab::append(), and append().
void TML_PackedMultiMessage::append | ( | double | d, |
int | nslice | ||
) |
Append a double to a given slice of the buffer.
d | the double |
nslice | the nr. of the slice |
References grow().
void TML_PackedMultiMessage::append | ( | const string & | str, |
int | nslice | ||
) |
Append a STL-string to a given slice of the buffer.
str | the string |
nslice | the nr. of the slice |
References grow().
void TML_PackedMultiMessage::append | ( | bool | b, |
int | nslice | ||
) |
Append boolean value to a given slice of the buffer.
b | the boolean |
nslice | the nr. of the slice |
References append().
void TML_PackedMultiMessage::begin_pack | ( | int | i | ) |
reset single packing posn to 0
Referenced by TML_PackedMultiMessageSlab::begin_pack().
void TML_PackedMultiMessage::begin_unpack | ( | int | i | ) |
reset single unpacking posn to 0
Referenced by TML_PackedMultiMessageSlab::begin_unpack().
void TML_PackedMultiMessage::clear | ( | ) |
clear message buffer, i.e. reset all positions to 0
void TML_PackedMultiMessage::grow | ( | ) | [protected] |
Grows the buffer to twice its current size, thus guaranteeing that append works in amortized constant time. Currently grows the buffer homogeneously, i.e. all slices have the same size.
Referenced by append().
void TML_PackedMultiMessage::growTo | ( | int | size | ) | [protected] |
Grow buffer to a specified size
size | the size to grow to |
TML_PackedMultiMessageSlab TML_PackedMultiMessage::operator[] | ( | int | i | ) |
return a slab
bool TML_PackedMultiMessage::pop_bool | ( | int | nslice | ) |
Pops a boolean from a given slice of the the buffer, i.e. it pops the last sizeof(MPI_INT) bytes of the buffer, interpreting them as a boolean (via pop_int()).
nslice | the nr. of the slice |
References pop_int().
Referenced by TML_PackedMultiMessageSlab::pop_bool().
double TML_PackedMultiMessage::pop_double | ( | int | nslice | ) |
Pops a double from a given slice of the the buffer.
nslice | the nr. of the slice |
Referenced by TML_PackedMultiMessageSlab::pop_double(), and TML_PackedMultiMessageSlab::pop_vec3().
int TML_PackedMultiMessage::pop_int | ( | int | nslice | ) |
Pops an integer from a given slice of the the buffer, i.e. it pops the last sizeof(MPI_INT) bytes of the buffer, interpreting them as an int.
nslice | the nr. of the slice |
Referenced by pop_bool(), and TML_PackedMultiMessageSlab::pop_int().
string TML_PackedMultiMessage::pop_string | ( | int | nslice | ) |
Pops a string from a given slice of the the buffer.
nslice | the nr. of the slice |