|
PSCF v1.3.3
|
Save archive for packed heterogeneous binary data. More...
#include <MemoryOArchive.h>
Public Member Functions | |
| MemoryOArchive () | |
| Constructor. | |
| virtual | ~MemoryOArchive () |
| Destructor. | |
| virtual void | allocate (size_t capacity) |
| Allocate memory. | |
| void | clear () |
| Resets the cursor to the beginning. | |
| template<typename T> | |
| MemoryOArchive & | operator<< (T &data) |
| Save (write) one object to this archive via the << operator. | |
| template<typename T> | |
| MemoryOArchive & | operator& (T &data) |
| Save (write) one object to this archive via the & operator. | |
| template<typename T, size_t N> | |
| MemoryOArchive & | operator<< (T(&data)[N]) |
| Save a fixed size array via operator <<. | |
| template<typename T, size_t N> | |
| MemoryOArchive & | operator& (T(&data)[N]) |
| Save a fixed size array via operator &. | |
| template<typename T> | |
| void | pack (const T &data) |
| Pack a T object. | |
| template<typename T> | |
| void | pack (const T *array, int n) |
| Pack a C array. | |
| template<typename T> | |
| void | pack (const T *array, int m, int n, int np) |
| Pack a 2D C array. | |
| Byte * | begin () const |
| Return pointer to beginning of block. | |
| Byte * | cursor () const |
| Return pointer to current position (cursor). | |
| size_t | capacity () const |
| Return capacity in Bytes. | |
| bool | isAllocated () const |
| Has memory been allocated? | |
Static Public Member Functions | |
| static bool | is_saving () |
| Returns true;. | |
| static bool | is_loading () |
| Returns false;. | |
Save archive for packed heterogeneous binary data.
Definition at line 31 of file MemoryOArchive.h.
| Util::MemoryOArchive::MemoryOArchive | ( | ) |
Constructor.
Definition at line 19 of file MemoryOArchive.cpp.
Referenced by operator&(), operator&(), operator<<(), and operator<<().
|
virtual |
Destructor.
Definition at line 33 of file MemoryOArchive.cpp.
References Util::Memory::deallocate().
|
inlinestatic |
Returns true;.
Definition at line 218 of file MemoryOArchive.h.
|
inlinestatic |
Returns false;.
Definition at line 221 of file MemoryOArchive.h.
|
virtual |
Allocate memory.
| capacity | size of memory block in bytes |
Definition at line 44 of file MemoryOArchive.cpp.
References Util::Memory::allocate(), begin(), capacity(), and UTIL_THROW.
| void Util::MemoryOArchive::clear | ( | ) |
Resets the cursor to the beginning.
Definition at line 62 of file MemoryOArchive.cpp.
References begin(), isAllocated(), and UTIL_THROW.
|
inline |
Save (write) one object to this archive via the << operator.
| data | object of type T to be saved to this archive |
Definition at line 254 of file MemoryOArchive.h.
References MemoryOArchive().
|
inline |
Save (write) one object to this archive via the & operator.
Equivalent to << operator.
| data | object of type T to be saved to this archive |
Definition at line 264 of file MemoryOArchive.h.
References MemoryOArchive().
|
inline |
Save a fixed size array via operator <<.
The implementation applies the serialize function to each element. This template should thus work for any type T for which a serialize function exists.
| data | array of fixed size N with elements of type T |
Definition at line 274 of file MemoryOArchive.h.
References MemoryOArchive().
|
inline |
Save a fixed size array via operator &.
Equivalent to the corresponding << operator.
| data | array of fixed size N with elements of type T |
Definition at line 286 of file MemoryOArchive.h.
References MemoryOArchive().
|
inline |
|
inline |
Pack a C array.
| array | C array |
| n | number of elements |
Definition at line 318 of file MemoryOArchive.h.
References UTIL_THROW.
|
inline |
Pack a 2D C array.
Pack m rows of n elements from array of type T array[mp][np], with n <= np and m <= mp.
| array | poiner 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 338 of file MemoryOArchive.h.
References UTIL_THROW.
|
inline |
Return pointer to beginning of block.
Definition at line 241 of file MemoryOArchive.h.
Referenced by allocate(), and clear().
|
inline |
Return pointer to current position (cursor).
Definition at line 247 of file MemoryOArchive.h.
|
inline |
Return capacity in Bytes.
Definition at line 235 of file MemoryOArchive.h.
Referenced by allocate().
|
inline |