Simpatico
v1.10
|
Input archive for packed heterogeneous binary data.
Definition at line 31 of file MemoryIArchive.h.
#include <MemoryIArchive.h>
Public Member Functions | |
MemoryIArchive () | |
Constructor. More... | |
~MemoryIArchive () | |
Destructor. More... | |
void | allocate (size_t capacity) |
Allocate memory block. More... | |
MemoryIArchive & | operator= (MemoryOArchive &other) |
Assignment from MemoryOArchive. More... | |
void | reset () |
Reset the cursor to the beginning (for rereading). More... | |
void | clear () |
Reset to empty state. More... | |
void | release () |
Release memory obtained by assignment. More... | |
template<typename T > | |
MemoryIArchive & | operator& (T &data) |
Load one object. More... | |
template<typename T > | |
MemoryIArchive & | operator>> (T &data) |
Load one object. More... | |
template<typename T > | |
void | unpack (T &data) |
Unpack one object of type T. More... | |
template<typename T > | |
void | unpack (T *array, int n) |
Read a C-array of objects of type T. More... | |
template<typename T > | |
void | unpack (T *array, int m, int n, int np) |
Unpack a 2D C array. More... | |
void | recv (MPI::Intracomm &comm, int source) |
Receive packed data via MPI. More... | |
Byte * | begin () const |
Return pointer to beginning of block. More... | |
Byte * | cursor () const |
Return pointer to current position (cursor). More... | |
Byte * | end () const |
Return pointer to end of packed block (one Byte past the last). More... | |
size_t | capacity () const |
Return capacity in Bytes. More... | |
bool | isAllocated () const |
Has memory been allocated? More... | |
Static Public Member Functions | |
static bool | is_saving () |
Returns true;. More... | |
static bool | is_loading () |
Returns false;. More... | |
Util::MemoryIArchive::MemoryIArchive | ( | ) |
Constructor.
Definition at line 20 of file MemoryIArchive.cpp.
Util::MemoryIArchive::~MemoryIArchive | ( | ) |
Destructor.
Definition at line 35 of file MemoryIArchive.cpp.
|
inlinestatic |
Returns true;.
Definition at line 196 of file MemoryIArchive.h.
|
inlinestatic |
Returns false;.
Definition at line 199 of file MemoryIArchive.h.
void Util::MemoryIArchive::allocate | ( | size_t | capacity | ) |
Allocate memory block.
capacity | sizeof of block, in Bytes. |
Definition at line 46 of file MemoryIArchive.cpp.
References capacity(), and UTIL_THROW.
Referenced by McMd::ReplicaMove::move().
MemoryIArchive & Util::MemoryIArchive::operator= | ( | MemoryOArchive & | other | ) |
Assignment from MemoryOArchive.
Definition at line 64 of file MemoryIArchive.cpp.
References isAllocated(), and UTIL_THROW.
void Util::MemoryIArchive::reset | ( | ) |
Reset the cursor to the beginning (for rereading).
Definition at line 84 of file MemoryIArchive.cpp.
References begin(), isAllocated(), and UTIL_THROW.
void Util::MemoryIArchive::clear | ( | ) |
Reset to empty state.
Resets cursor and end pointers to beginning of memory block.
Definition at line 95 of file MemoryIArchive.cpp.
References begin(), isAllocated(), and UTIL_THROW.
void Util::MemoryIArchive::release | ( | ) |
Release memory obtained by assignment.
Definition at line 110 of file MemoryIArchive.cpp.
References UTIL_THROW.
|
inline |
Load one object.
data | object to be loaded from this archive. |
Definition at line 240 of file MemoryIArchive.h.
|
inline |
Load one object.
data | object to be loaded from this archive. |
Definition at line 250 of file MemoryIArchive.h.
void Util::MemoryIArchive::unpack | ( | T & | data | ) |
Unpack one object of type T.
data | object to be loaded from this archive. |
Definition at line 260 of file MemoryIArchive.h.
References UTIL_THROW.
void Util::MemoryIArchive::unpack | ( | T * | array, |
int | n | ||
) |
Read a C-array of objects of type T.
array | array into which data should be loaded. |
n | expected number of elements in the array. |
Definition at line 275 of file MemoryIArchive.h.
References UTIL_THROW.
void Util::MemoryIArchive::unpack | ( | T * | array, |
int | m, | ||
int | n, | ||
int | np | ||
) |
Unpack a 2D C array.
Unpack m rows of n elements into array of type T array[mp][np], with m <= mp and n <= np.
array | pointer to [0][0] element of 2D array |
m | logical number of rows |
n | logical number of columns |
np | physical number of columns |
Definition at line 292 of file MemoryIArchive.h.
References unpack(), and UTIL_THROW.
void Util::MemoryIArchive::recv | ( | MPI::Intracomm & | comm, |
int | source | ||
) |
Receive packed data via MPI.
comm | MPI communicator |
source | rank of processor from which data is sent. |
Definition at line 133 of file MemoryIArchive.cpp.
References unpack(), and UTIL_THROW.
Referenced by McMd::ReplicaMove::move().
|
inline |
Return pointer to beginning of block.
Definition at line 207 of file MemoryIArchive.h.
|
inline |
Return pointer to current position (cursor).
Definition at line 213 of file MemoryIArchive.h.
|
inline |
Return pointer to end of packed block (one Byte past the last).
Definition at line 219 of file MemoryIArchive.h.
|
inline |
Return capacity in Bytes.
Definition at line 225 of file MemoryIArchive.h.
Referenced by allocate().
|
inline |
Has memory been allocated?
Definition at line 231 of file MemoryIArchive.h.
Referenced by clear(), operator=(), and reset().