fpmas 1.6
Public Member Functions | List of all members
fpmas::io::Breakpoint< T > Class Template Reference

#include <breakpoint.h>

Inheritance diagram for fpmas::io::Breakpoint< T >:
Inheritance graph
[legend]
Collaboration diagram for fpmas::io::Breakpoint< T >:
Collaboration graph
[legend]

Public Member Functions

void dump (std::ostream &stream, const T &object) override
 
void load (std::istream &stream, T &object) override
 
virtual void dump (std::ostream &stream, const T &object)=0
 
virtual void load (std::istream &stream, T &object)=0
 

Detailed Description

template<typename T>
class fpmas::io::Breakpoint< T >

JSON based api::io::Breakpoint implementation.

Data is serialized / unserialized using nlohmann json serialization rules.

See also
https://github.com/nlohmann/json#arbitrary-types-conversions

Member Function Documentation

◆ dump()

template<typename T >
void fpmas::io::Breakpoint< T >::dump ( std::ostream &  stream,
const T &  object 
)
inlineoverridevirtual

Serializes the specified object with the nlohmann json library, and sends it to the output stream.

The MessagePack format is used for more compact dumps.

Parameters
streamoutput stream
objectobject to save

Implements fpmas::api::io::Breakpoint< T >.

◆ load()

template<typename T >
void fpmas::io::Breakpoint< T >::load ( std::istream &  stream,
T &  object 
)
inlineoverridevirtual

Loads data from the input stream into the specified object.

The stream must provide Json data in the MessagePack format, as performed by the dump() method.

Read data is then loaded into object using the following statement, where j is the json object parsed from the input stream:

nlohmann::json::json_serializer<T, void>::from_json(j, object);
Parameters
streaminput stream
objectT instance in which read data will be loaded

Implements fpmas::api::io::Breakpoint< T >.


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