OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
olb::Serializable Class Referenceabstract

Base class for serializable objects of constant size. For dynamic size use BufferSerializable. More...

#include <serializer.h>

+ Inheritance diagram for olb::Serializable:
+ Collaboration diagram for olb::Serializable:

Public Member Functions

virtual ~Serializable ()=default
 
virtual bool * getBlock (const std::size_t iBlock, std::size_t &sizeBlock, const bool loadingMode=false)=0
 Returns the address of the i-th block and its size.
 
virtual std::size_t getNblock () const =0
 Returns the number of blocks.
 
virtual std::size_t getSerializableSize () const =0
 Returns the binary size of the data to be saved.
 
template<bool includeLogOutputDir = true>
bool save (std::string fileName="", const bool enforceUint=false)
 Save Serializable into file fileName
 
template<bool includeLogOutputDir = true>
bool load (std::string fileName="", const bool enforceUint=false)
 Load Serializable from file fileName
 
bool save (std::uint8_t *buffer)
 Save Serializable into buffer of length getSerializableSize
 
bool load (const std::uint8_t *buffer)
 Load Serializable from buffer of length getSerializableSize
 
virtual void postLoad ()
 

Protected Member Functions

template<typename DataType >
void registerVar (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, bool *&dataPtr, const DataType &data, const size_t arrayLength=1) const
 Register primitive data types (int, double, ...) or arrays of those.
 
template<typename DataType >
void registerSerializableOfConstSize (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, bool *&dataPtr, DataType &data, const bool loadingMode=false)
 Register Serializable object of constant size.
 
template<typename DataType >
void registerSerializablesOfConstSize (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, bool *&dataPtr, DataType *data, const size_t arrayLength, const bool loadingMode=false)
 Register an array of Serializable objects of constant size.
 

Detailed Description

Base class for serializable objects of constant size. For dynamic size use BufferSerializable.

All serializable classes have to implement their individual getBlock() method. An individual getNblock() method must also be provided. An individual getSerializableSize() method should also be provided for efficiency reasons.

All Serializable subclasses with dynamic size (unknown at compile time, e.g. holding std::vector or std::map members) have to inherit from BufferSerializable. _Note: If the dynamic size is computable through constant values (see BlockLattice2D), the Serializable does not need to be a BufferSerializable.

The Basic Serialization Concept

Any serializable class inherits from either Serializable or BufferSerializable (if it contains dynamic-sized member variables) and has to implement its individual getBlock() method.

getBlock() is called by the Serializer repeatedly with an increasing counter iBlock. getBlock() returns a (bool*) address to the i-th data block and fills sizeBlock with the corresponding size. As long as getBlock() does not return a nullptr, iBlock is increased and getBlock() is called again by Serializer.

It is strongly recommended (and obligatory for the correct usage of register methods) to define std::size_t currentBlock = 0; within getBlock(). currentBlock will be increased by the register methods by the number of blocks they occupy.

For user's convenience the Serializable class provides register methods for data of constant size:

Method Suitable for
registerVar() Primitive data types and arrays of those (e.g. int, double, std::string, ...)
registerSerializableOfConstSize() Constant-sized Serializable object
registerSerializablesOfConstSize() Array of constant-sized Serializable objects

Note: Dynamic-sized objects need to inherit from BufferSerializable, which uses buffers and provides additional register methods for:

Method Suitable for
registerSerializable() Dynamic-sized Serializable object (for constant-sized Serializable

| use registerSerializableOfConstSize() registerStdVectorOfVars() | std::vector<DataType> (for primitive DataType, e.g. int, | double, ...) registerStdVectorOfSerializablesOfConstSize() | std::vector<DataType> (for Serializables of constant size) registerStdVectorOfSerializables() | std::vector<DataType> (for Serializables of dynamic size) registerMap() | std::map<DataTypeKey, DataTypeValue> (for primitive types)

Definition at line 145 of file serializer.h.

Constructor & Destructor Documentation

◆ ~Serializable()

virtual olb::Serializable::~Serializable ( )
virtualdefault

Member Function Documentation

◆ getBlock()

virtual bool * olb::Serializable::getBlock ( const std::size_t iBlock,
std::size_t & sizeBlock,
const bool loadingMode = false )
pure virtual

Returns the address of the i-th block and its size.

Parameters
iBlockIndex of the block to be returned
sizeBlockReference to the size of the returned block
Returns
Pointer to the current block

Each getBlock() method should look like this:

std::size_t currentBlock = 0;
bool* dataPtr = nullptr;

// ... register methods...

return dataPtr;

Implemented in olb::LoadBalancer< T >, olb::LoadBalancer< S >, olb::BlockData< D, T, U >, olb::BlockData< 2, T, BaseType >, olb::BlockData< 2, T, bool >, olb::BlockData< 2, T, T >, olb::BlockData< 3, S, S >, olb::BlockData< 3, T, BaseType >, olb::BlockData< 3, T, bool >, olb::BlockData< 3, T, T >, olb::BlockData< DESCRIPTOR::d, T, bool >, olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >, olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >, olb::ConcreteBlockLattice< T, DESCRIPTOR, Platform::CPU_SIMD >, olb::ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA >, olb::ConcreteBlockLattice< T, DESCRIPTOR, SOURCE >, olb::ConcreteBlockLattice< T, DESCRIPTOR, TARGET >, olb::CellIndexListD< T, DESCRIPTOR, FIELDS >, olb::ColumnVector< COLUMN, D >, olb::ColumnVector< ImplementationOf< FIELD::template column_type< int >, PLATFORM >::type, DESCRIPTOR::template size< NORMAL >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< S >, PLATFORM >::type, DESCRIPTOR::template size< olb::descriptors::MATERIAL >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< FIELD >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< NORMAL >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< olb::descriptors::MATERIAL >()>, olb::ColumnVector< olb::cpu::simd::Column< T >, D >, olb::ColumnVector< olb::cpu::sisd::Column< int >, 1 >, olb::Data< T, DESCRIPTOR, PLATFORM >, olb::Data< T, DESCRIPTOR, Platform::CPU_SISD >, olb::MultiFieldArrayD< T, DESCRIPTOR, PLATFORM, FIELDS >, olb::MultiFieldArrayD< T, DESCRIPTOR, PLATFORM, FIELDS... >, olb::MultiFieldArrayD< T, DESCRIPTOR, Platform::CPU_SISD, olb::descriptors::CELL_ID, FIELDS... >, olb::ConcreteParametersD< T, DESCRIPTOR, PLATFORM, PARAMETERS >, olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, typename DYNAMICS::parameters >, olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, typename OPERATOR::parameters >, olb::cpu::simd::Column< T >, olb::cpu::simd::CyclicColumn< T >, olb::ConcreteBlockMask< T, Platform::CPU_SIMD >, olb::cpu::sisd::Column< T >, olb::cpu::sisd::Column< BaseType >, olb::cpu::sisd::Column< bool >, olb::cpu::sisd::Column< int >, olb::cpu::sisd::Column< S >, olb::cpu::sisd::Column< U >, olb::cpu::sisd::CyclicColumn< T >, olb::ConcreteBlockMask< T, Platform::CPU_SISD >, olb::gpu::cuda::Column< T >, olb::gpu::cuda::Column< CellID >, olb::gpu::cuda::Column< std::uint8_t >, olb::gpu::cuda::CyclicColumn< T >, olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS >, olb::ConcreteBlockMask< T, Platform::GPU_CUDA >, olb::SuperLattice< T, DESCRIPTOR >, olb::SuperLattice< S, descriptor >, olb::SuperLattice< T, Lattice >, olb::SuperLattice< T, TDESCRIPTOR >, olb::BlockGeometry< T, D >, olb::BlockGeometry< S, D >, olb::BlockGeometry< T, 2 >, olb::BlockGeometry< T, 3 >, olb::BlockGeometry< T, DESCRIPTOR::d >, olb::Cuboid3D< T >, olb::Cuboid3D< S >, olb::CuboidGeometry3D< T >, olb::SuperGeometry< T, D >, olb::SuperGeometry< S, D >, olb::SuperGeometry< S, dim >, olb::SuperGeometry< T, 2 >, olb::SuperGeometry< T, 3 >, and olb::SuperGeometry< T, DESCRIPTOR::d >.

+ Here is the caller graph for this function:

◆ getNblock()

virtual std::size_t olb::Serializable::getNblock ( ) const
pure virtual

Returns the number of blocks.

All Serializable classes have to implement this method.

Implemented in olb::LoadBalancer< T >, olb::LoadBalancer< S >, olb::BlockData< D, T, U >, olb::BlockData< 2, T, BaseType >, olb::BlockData< 2, T, bool >, olb::BlockData< 2, T, T >, olb::BlockData< 3, S, S >, olb::BlockData< 3, T, BaseType >, olb::BlockData< 3, T, bool >, olb::BlockData< 3, T, T >, olb::BlockData< DESCRIPTOR::d, T, bool >, olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >, olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >, olb::ConcreteBlockLattice< T, DESCRIPTOR, Platform::CPU_SIMD >, olb::ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA >, olb::ConcreteBlockLattice< T, DESCRIPTOR, SOURCE >, olb::ConcreteBlockLattice< T, DESCRIPTOR, TARGET >, olb::CellIndexListD< T, DESCRIPTOR, FIELDS >, olb::ColumnVector< COLUMN, D >, olb::ColumnVector< ImplementationOf< FIELD::template column_type< int >, PLATFORM >::type, DESCRIPTOR::template size< NORMAL >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< S >, PLATFORM >::type, DESCRIPTOR::template size< olb::descriptors::MATERIAL >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< FIELD >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< NORMAL >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< olb::descriptors::MATERIAL >()>, olb::ColumnVector< olb::cpu::simd::Column< T >, D >, olb::ColumnVector< olb::cpu::sisd::Column< int >, 1 >, olb::Data< T, DESCRIPTOR, PLATFORM >, olb::Data< T, DESCRIPTOR, Platform::CPU_SISD >, olb::MultiFieldArrayD< T, DESCRIPTOR, PLATFORM, FIELDS >, olb::MultiFieldArrayD< T, DESCRIPTOR, PLATFORM, FIELDS... >, olb::MultiFieldArrayD< T, DESCRIPTOR, Platform::CPU_SISD, olb::descriptors::CELL_ID, FIELDS... >, olb::ConcreteParametersD< T, DESCRIPTOR, PLATFORM, PARAMETERS >, olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, typename DYNAMICS::parameters >, olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, typename OPERATOR::parameters >, olb::cpu::simd::Column< T >, olb::cpu::simd::CyclicColumn< T >, olb::ConcreteBlockMask< T, Platform::CPU_SIMD >, olb::cpu::sisd::Column< T >, olb::cpu::sisd::Column< BaseType >, olb::cpu::sisd::Column< bool >, olb::cpu::sisd::Column< int >, olb::cpu::sisd::Column< S >, olb::cpu::sisd::Column< U >, olb::cpu::sisd::CyclicColumn< T >, olb::ConcreteBlockMask< T, Platform::CPU_SISD >, olb::gpu::cuda::Column< T >, olb::gpu::cuda::Column< CellID >, olb::gpu::cuda::Column< std::uint8_t >, olb::gpu::cuda::CyclicColumn< T >, olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS >, olb::ConcreteBlockMask< T, Platform::GPU_CUDA >, olb::SuperLattice< T, DESCRIPTOR >, olb::SuperLattice< S, descriptor >, olb::SuperLattice< T, Lattice >, olb::SuperLattice< T, TDESCRIPTOR >, olb::BlockGeometry< T, D >, olb::BlockGeometry< S, D >, olb::BlockGeometry< T, 2 >, olb::BlockGeometry< T, 3 >, olb::BlockGeometry< T, DESCRIPTOR::d >, olb::Cuboid3D< T >, olb::Cuboid3D< S >, olb::CuboidGeometry3D< T >, olb::SuperGeometry< T, D >, olb::SuperGeometry< S, D >, olb::SuperGeometry< S, dim >, olb::SuperGeometry< T, 2 >, olb::SuperGeometry< T, 3 >, and olb::SuperGeometry< T, DESCRIPTOR::d >.

+ Here is the caller graph for this function:

◆ getSerializableSize()

virtual std::size_t olb::Serializable::getSerializableSize ( ) const
pure virtual

Returns the binary size of the data to be saved.

This method must be overloaded by all child classes.

Implemented in olb::LoadBalancer< T >, olb::LoadBalancer< S >, olb::BlockData< D, T, U >, olb::BlockData< 2, T, BaseType >, olb::BlockData< 2, T, bool >, olb::BlockData< 2, T, T >, olb::BlockData< 3, S, S >, olb::BlockData< 3, T, BaseType >, olb::BlockData< 3, T, bool >, olb::BlockData< 3, T, T >, olb::BlockData< DESCRIPTOR::d, T, bool >, olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >, olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >, olb::ConcreteBlockLattice< T, DESCRIPTOR, Platform::CPU_SIMD >, olb::ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA >, olb::ConcreteBlockLattice< T, DESCRIPTOR, SOURCE >, olb::ConcreteBlockLattice< T, DESCRIPTOR, TARGET >, olb::CellIndexListD< T, DESCRIPTOR, FIELDS >, olb::ColumnVector< COLUMN, D >, olb::ColumnVector< ImplementationOf< FIELD::template column_type< int >, PLATFORM >::type, DESCRIPTOR::template size< NORMAL >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< S >, PLATFORM >::type, DESCRIPTOR::template size< olb::descriptors::MATERIAL >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< FIELD >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< NORMAL >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< olb::descriptors::MATERIAL >()>, olb::ColumnVector< olb::cpu::simd::Column< T >, D >, olb::ColumnVector< olb::cpu::sisd::Column< int >, 1 >, olb::Data< T, DESCRIPTOR, PLATFORM >, olb::Data< T, DESCRIPTOR, Platform::CPU_SISD >, olb::MultiFieldArrayD< T, DESCRIPTOR, PLATFORM, FIELDS >, olb::MultiFieldArrayD< T, DESCRIPTOR, PLATFORM, FIELDS... >, olb::MultiFieldArrayD< T, DESCRIPTOR, Platform::CPU_SISD, olb::descriptors::CELL_ID, FIELDS... >, olb::ConcreteParametersD< T, DESCRIPTOR, PLATFORM, PARAMETERS >, olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, typename DYNAMICS::parameters >, olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, typename OPERATOR::parameters >, olb::cpu::simd::Column< T >, olb::cpu::simd::CyclicColumn< T >, olb::ConcreteBlockMask< T, Platform::CPU_SIMD >, olb::cpu::sisd::Column< T >, olb::cpu::sisd::Column< BaseType >, olb::cpu::sisd::Column< bool >, olb::cpu::sisd::Column< int >, olb::cpu::sisd::Column< S >, olb::cpu::sisd::Column< U >, olb::cpu::sisd::CyclicColumn< T >, olb::ConcreteBlockMask< T, Platform::CPU_SISD >, olb::gpu::cuda::Column< T >, olb::gpu::cuda::Column< CellID >, olb::gpu::cuda::Column< std::uint8_t >, olb::gpu::cuda::CyclicColumn< T >, olb::ConcreteParametersD< T, DESCRIPTOR, Platform::GPU_CUDA, PARAMETERS >, olb::ConcreteBlockMask< T, Platform::GPU_CUDA >, olb::SuperLattice< T, DESCRIPTOR >, olb::SuperLattice< S, descriptor >, olb::SuperLattice< T, Lattice >, olb::SuperLattice< T, TDESCRIPTOR >, olb::BlockGeometry< T, D >, olb::BlockGeometry< S, D >, olb::BlockGeometry< T, 2 >, olb::BlockGeometry< T, 3 >, olb::BlockGeometry< T, DESCRIPTOR::d >, olb::Cuboid3D< T >, olb::Cuboid3D< S >, olb::CuboidGeometry3D< T >, olb::SuperGeometry< T, D >, olb::SuperGeometry< S, D >, olb::SuperGeometry< S, dim >, olb::SuperGeometry< T, 2 >, olb::SuperGeometry< T, 3 >, and olb::SuperGeometry< T, DESCRIPTOR::d >.

+ Here is the caller graph for this function:

◆ load() [1/2]

bool olb::Serializable::load ( const std::uint8_t * buffer)

Load Serializable from buffer of length getSerializableSize

Definition at line 164 of file serializer.hh.

165{
166 Serializer tmpSerializer(*this);
167 return tmpSerializer.load(buffer);
168}

References olb::Serializer::load().

+ Here is the call graph for this function:

◆ load() [2/2]

template<bool includeLogOutputDir>
bool olb::Serializable::load ( std::string fileName = "",
const bool enforceUint = false )

Load Serializable from file fileName

Definition at line 152 of file serializer.hh.

153{
154 Serializer tmpSerializer(*this, fileName);
155 return tmpSerializer.load<includeLogOutputDir>();
156}

References olb::Serializer::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ postLoad()

virtual void olb::Serializable::postLoad ( )
inlinevirtual

Reimplemented in olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >, olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >, olb::ConcreteBlockLattice< T, DESCRIPTOR, Platform::CPU_SIMD >, olb::ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA >, olb::ConcreteBlockLattice< T, DESCRIPTOR, SOURCE >, olb::ConcreteBlockLattice< T, DESCRIPTOR, TARGET >, olb::ColumnVector< COLUMN, D >, olb::ColumnVector< ImplementationOf< FIELD::template column_type< int >, PLATFORM >::type, DESCRIPTOR::template size< NORMAL >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< S >, PLATFORM >::type, DESCRIPTOR::template size< olb::descriptors::MATERIAL >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< FIELD >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< NORMAL >()>, olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< olb::descriptors::MATERIAL >()>, olb::ColumnVector< olb::cpu::simd::Column< T >, D >, olb::ColumnVector< olb::cpu::sisd::Column< int >, 1 >, olb::cpu::simd::CyclicColumn< T >, olb::cpu::sisd::CyclicColumn< T >, olb::gpu::cuda::CyclicColumn< T >, olb::SuperLattice< T, DESCRIPTOR >, olb::SuperLattice< S, descriptor >, olb::SuperLattice< T, Lattice >, and olb::SuperLattice< T, TDESCRIPTOR >.

Definition at line 191 of file serializer.h.

191{ };
+ Here is the caller graph for this function:

◆ registerSerializableOfConstSize()

template<typename DataType >
void olb::Serializable::registerSerializableOfConstSize ( const std::size_t iBlock,
std::size_t & sizeBlock,
std::size_t & currentBlock,
bool *& dataPtr,
DataType & data,
const bool loadingMode = false )
inlineprotected

Register Serializable object of constant size.

This method is suitable for all Serializable objects that are of constant size.

For information about the parameters of this method, see registerVar().

This method registers a Serializable by simply delegating the getBlock() call to the Serializable.

Since those Serializable objects must(!) have constant return value from Serializable.getNblock(), the number of blocks is known both in reading and writing mode.

Note that DataType must only provide Serializable-equivalent methods and not necessarily inherit. E.g. Vector<T,D> is serializable despite not being derived from Serializable.

Definition at line 239 of file serializer.h.

241 {
242 if (iBlock >= currentBlock && iBlock < currentBlock + data.getNblock()) {
243 dataPtr = data.getBlock(iBlock - currentBlock, sizeBlock, loadingMode);
244 }
245 currentBlock += data.getNblock();
246 }
+ Here is the caller graph for this function:

◆ registerSerializablesOfConstSize()

template<typename DataType >
void olb::Serializable::registerSerializablesOfConstSize ( const std::size_t iBlock,
std::size_t & sizeBlock,
std::size_t & currentBlock,
bool *& dataPtr,
DataType * data,
const size_t arrayLength,
const bool loadingMode = false )
inlineprotected

Register an array of Serializable objects of constant size.

This method is suitable for all Serializable objects that are of constant size.

For information about the parameters of this method, see registerVar().

This method registers an array of Serializables by delegating the getBlock() call to the corresponding Serializable.

Since those Serializable objects must(!) have constant return value from Serializable.getNblock(), the number of blocks is known both in reading and writing mode.

Definition at line 261 of file serializer.h.

264 {
265 static_assert(std::is_base_of<Serializable, DataType>::value, "DataType must be a Serializable.");
266
267 if ( arrayLength > 0 ) {
268 if (iBlock >= currentBlock && iBlock < currentBlock + arrayLength * data[0].getNblock()) {
269 size_t local_iBlock = iBlock - currentBlock;
270 size_t dataBlockCount = data[0].getNblock();
271 dataPtr = data[local_iBlock / dataBlockCount].getBlock(local_iBlock % dataBlockCount, sizeBlock, loadingMode);
272 }
273 currentBlock += arrayLength * data[0].getNblock();
274 }
275 }
virtual std::size_t getNblock() const =0
Returns the number of blocks.

References getNblock().

+ Here is the call graph for this function:

◆ registerVar()

template<typename DataType >
void olb::Serializable::registerVar ( const std::size_t iBlock,
std::size_t & sizeBlock,
std::size_t & currentBlock,
bool *& dataPtr,
const DataType & data,
const size_t arrayLength = 1 ) const
inlineprotected

Register primitive data types (int, double, ...) or arrays of those.

This method is suitable for all primitive data types or arrays of those. The address of the data is returned in combination with the size sizeof(DataType) * arrayLength.

Parameters
iBlockiBlock from getBlock() - to determine if this is the current block.
sizeBlocksizeBlock from getBlock() - will be filled if this is the current block.
currentBlocklocal variable of getBlock() - will always be counted up by the number of blocks this method registers (always 1 in this case).
dataPtrdataPtr from getBlock() - will be filled with pointer to the data at iBlock if this is the current block.
dataReference to the data to be registered by this method. Fills dataPtr with a (bool*)-casted pointer to data if this is the current block.
arrayLengthNumber of elements of DataType in data, if data is an array. Defaults to 1 for single values.
Template Parameters
DataTypeType of data

Definition at line 212 of file serializer.h.

214 {
215 if (iBlock == currentBlock) {
216 sizeBlock = sizeof(DataType) * arrayLength;
217 dataPtr = (bool *) (&data);
218 }
219 currentBlock++;
220 }
+ Here is the caller graph for this function:

◆ save() [1/2]

template<bool includeLogOutputDir>
bool olb::Serializable::save ( std::string fileName = "",
const bool enforceUint = false )

Save Serializable into file fileName

Definition at line 145 of file serializer.hh.

146{
147 Serializer tmpSerializer(*this, fileName);
148 return tmpSerializer.save<includeLogOutputDir>();
149}

References olb::Serializer::save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save() [2/2]

bool olb::Serializable::save ( std::uint8_t * buffer)

Save Serializable into buffer of length getSerializableSize

Definition at line 158 of file serializer.hh.

159{
160 Serializer tmpSerializer(*this);
161 return tmpSerializer.save(buffer);
162}

References olb::Serializer::save().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: