|
PSCF v1.3.3
|
Input archive for packed heterogeneous binary data. More...
#include <MemoryIArchive.h>
Public Member Functions | |
| MemoryIArchive () | |
| Constructor. | |
| ~MemoryIArchive () | |
| Destructor. | |
| void | allocate (size_t capacity) |
| Allocate memory block. | |
| MemoryIArchive & | operator= (MemoryOArchive &other) |
| Assignment from MemoryOArchive. | |
| void | reset () |
| Reset the cursor to the beginning (for rereading). | |
| void | clear () |
| Reset to empty state. | |
| void | release () |
| Release memory obtained by assignment. | |
| template<typename T> | |
| MemoryIArchive & | operator>> (T &data) |
| Load (read) one object of type T via the >> operator. | |
| template<typename T> | |
| MemoryIArchive & | operator& (T &data) |
| Load (read) one object of type T via the & operator. | |
| template<typename T, size_t N> | |
| MemoryIArchive & | operator>> (T(&data)[N]) |
| Load a fixed size array via operator >>. | |
| template<typename T, size_t N> | |
| MemoryIArchive & | operator& (T(&data)[N]) |
| Load a fixed size array via operator &. | |
| template<typename T> | |
| void | unpack (T &data) |
| Unpack one object of type T. | |
| template<typename T> | |
| void | unpack (T *array, int n) |
| Read a C-array of objects of type T. | |
| template<typename T> | |
| void | unpack (T *array, int m, int n, int np) |
| Unpack a 2D C array. | |
| Byte * | begin () const |
| Return pointer to beginning of block. | |
| Byte * | cursor () const |
| Return pointer to current position (cursor). | |
| Byte * | end () const |
| Return pointer to end of packed block (one Byte past the last). | |
| 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;. | |
Input archive for packed heterogeneous binary data.
Definition at line 31 of file MemoryIArchive.h.
| Util::MemoryIArchive::MemoryIArchive | ( | ) |
Constructor.
Definition at line 20 of file MemoryIArchive.cpp.
Referenced by operator&(), operator&(), operator=(), operator>>(), and operator>>().
| Util::MemoryIArchive::~MemoryIArchive | ( | ) |
Destructor.
Definition at line 35 of file MemoryIArchive.cpp.
References Util::Memory::deallocate().
|
inlinestatic |
Returns true;.
Definition at line 220 of file MemoryIArchive.h.
|
inlinestatic |
Returns false;.
Definition at line 223 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 Util::Memory::allocate(), capacity(), and UTIL_THROW.
| MemoryIArchive & Util::MemoryIArchive::operator= | ( | MemoryOArchive & | other | ) |
Assignment from MemoryOArchive.
Definition at line 64 of file MemoryIArchive.cpp.
References isAllocated(), MemoryIArchive(), 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 (read) one object of type T via the >> operator.
| data | object to be loaded from this archive. |
Definition at line 264 of file MemoryIArchive.h.
References MemoryIArchive().
|
inline |
Load (read) one object of type T via the & operator.
| data | object to be loaded from this archive. |
Definition at line 274 of file MemoryIArchive.h.
References MemoryIArchive().
|
inline |
Load 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 284 of file MemoryIArchive.h.
References MemoryIArchive().
|
inline |
Load 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 296 of file MemoryIArchive.h.
References MemoryIArchive().
| void Util::MemoryIArchive::unpack | ( | T & | data | ) |
Unpack one object of type T.
| data | object to be loaded from this archive. |
Definition at line 308 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 323 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 340 of file MemoryIArchive.h.
References UTIL_THROW.
|
inline |
Return pointer to beginning of block.
Definition at line 231 of file MemoryIArchive.h.
|
inline |
Return pointer to current position (cursor).
Definition at line 237 of file MemoryIArchive.h.
|
inline |
Return pointer to end of packed block (one Byte past the last).
Definition at line 243 of file MemoryIArchive.h.
|
inline |
Return capacity in Bytes.
Definition at line 249 of file MemoryIArchive.h.
Referenced by allocate().
|
inline |
Has memory been allocated?
Definition at line 255 of file MemoryIArchive.h.
Referenced by clear(), operator=(), and reset().