ImFusion C++ SDK 4.4.0
ImFusion::BinarySerializable Class Referenceabstract

#include <ImFusion/Base/BinarySerializable.h>

Interface for class which can be serialized and deserialized. More...

Inheritance diagram for ImFusion::BinarySerializable:

Detailed Description

Interface for class which can be serialized and deserialized.

Make sure to ensure platform independence, for instance by using fixed-sized types for binary serialization such as int32_t.

See also
Object Serialization

Public Member Functions

virtual size_t saveBufferSize () const =0
 Returns the total amount of bytes required for serialization.
virtual void loadFromBuffer (const char *buffer, size_t len)=0
 Restores the state of this object from a memory buffer, using maximum len bytes.
virtual void saveToBuffer (char *buffer) const =0
 Saves the state of this object into a memory buffer, using maximum saveBufferSize() bytes.
std::string saveToString () const
 Saves the state of this object into a string. Internally uses saveToBuffer.
void loadFromString (const std::string &str)
 Restores the state of this object from a string, internally using loadFromBuffer.

Protected Member Functions

template<typename T>
size_t serializeMember (char *&buffer, const T *data, size_t n=1) const
 Convenience method to memcpy n*sizeof(T) bytes of data to buffer, followed by an increment of buffer by n*sizeof(T).
template<typename T>
size_t deserializeMember (const char *&buffer, T *data, size_t n=1)
 Convenience method to memcpy n*sizeof(T) bytes of buffer to data, followed by an increment of buffer by n*sizeof(T).

Member Function Documentation

◆ saveBufferSize()

virtual size_t ImFusion::BinarySerializable::saveBufferSize ( ) const
pure virtual

Returns the total amount of bytes required for serialization.

Implemented in ImFusion::TimestampDataComponent, ImFusion::TrackingInstrumentFiducialsData, and ImFusion::VitalsDataComponent::TimeSeries.

◆ loadFromBuffer()

virtual void ImFusion::BinarySerializable::loadFromBuffer ( const char * buffer,
size_t len )
pure virtual

Restores the state of this object from a memory buffer, using maximum len bytes.

Implemented in ImFusion::TimestampDataComponent, ImFusion::TrackingInstrumentFiducialsData, and ImFusion::VitalsDataComponent::TimeSeries.

◆ saveToBuffer()

virtual void ImFusion::BinarySerializable::saveToBuffer ( char * buffer) const
pure virtual

Saves the state of this object into a memory buffer, using maximum saveBufferSize() bytes.

Implemented in ImFusion::TimestampDataComponent, ImFusion::TrackingInstrumentFiducialsData, and ImFusion::VitalsDataComponent::TimeSeries.


The documentation for this class was generated from the following file:
  • ImFusion/Base/BinarySerializable.h
Search Tab / S to search, Esc to close