OpenLB 1.7
|
Class for writing, reading, sending and receiving Serializable
objects.
More...
#include <serializer.h>
Public Member Functions | |
Serializer (Serializable &serializable, std::string fileName="") | |
Constructor. | |
void | resetCounter () |
Resets the _iBlock counter. | |
std::size_t | getSize () const |
Returns the total memory size in bits. | |
bool * | getNextBlock (std::size_t &sizeBlock, const bool loadingMode) |
Returns pointer to the memory of the current block and increments iBlock | |
template<bool includeLogOutputDir = true> | |
bool | load (std::string fileName="", const bool enforceUint=false) |
Loads a file and pushes the data into the serialized class. Always in parallel, i.e. one file per rank. | |
template<bool includeLogOutputDir = true> | |
bool | save (std::string fileName="", const bool enforceUint=false) |
Save _serializable into file filename . Always in parallel, i.e. one file per rank. | |
bool | load (const std::uint8_t *buffer) |
Loads serialized class from buffer. | |
bool | save (std::uint8_t *buffer) |
Saves serialized class to buffer. | |
void | computeSize (const bool enforceRecompute=false) |
computes _size based on the individual definition of getBlock() | |
Class for writing, reading, sending and receiving Serializable
objects.
For detailed information on the serialization concept, see the Serializable
documentation.
Definition at line 41 of file serializer.h.
olb::Serializer::Serializer | ( | Serializable & | serializable, |
std::string | fileName = "" ) |
Constructor.
If serializable
is omitted, it has to be provided in the save method.
Definition at line 44 of file serializer.hh.
void olb::Serializer::computeSize | ( | const bool | enforceRecompute = false | ) |
computes _size
based on the individual definition of getBlock()
Definition at line 112 of file serializer.hh.
References olb::Serializable::getSerializableSize().
bool * olb::Serializer::getNextBlock | ( | std::size_t & | sizeBlock, |
const bool | loadingMode ) |
Returns pointer to the memory of the current block and increments iBlock
Definition at line 59 of file serializer.hh.
References olb::Serializable::getBlock().
std::size_t olb::Serializer::getSize | ( | ) | const |
Returns the total memory size in bits.
Definition at line 54 of file serializer.hh.
bool olb::Serializer::load | ( | const std::uint8_t * | buffer | ) |
Loads serialized class from buffer.
Definition at line 99 of file serializer.hh.
References olb::buffer2serializer(), and olb::Serializable::postLoad().
bool olb::Serializer::load | ( | std::string | fileName = "", |
const bool | enforceUint = false ) |
Loads a file and pushes the data into the serialized class. Always in parallel, i.e. one file per rank.
Definition at line 65 of file serializer.hh.
References olb::istr2serializer(), and olb::Serializable::postLoad().
void olb::Serializer::resetCounter | ( | ) |
Resets the _iBlock
counter.
Definition at line 49 of file serializer.hh.
bool olb::Serializer::save | ( | std::string | fileName = "", |
const bool | enforceUint = false ) |
Save _serializable
into file filename
. Always in parallel, i.e. one file per rank.
Definition at line 81 of file serializer.hh.
References computeSize(), and olb::serializer2ostr().
bool olb::Serializer::save | ( | std::uint8_t * | buffer | ) |
Saves serialized class to buffer.
Definition at line 106 of file serializer.hh.
References olb::serializer2buffer().