FleCSI User API Version: 2.3.0
 
Loading...
Searching...
No Matches
Serialization

Serialization without default constructibility. More...

Classes

struct  cast
 Aggregate helper that converts to any type via get. More...
 
struct  convert< T >
 Defines a serialization in terms of a representation type. More...
 
struct  traits< T, E >
 Extension point for serialization. More...
 
struct  value< T >
 Convenience for stateless types. More...
 

Functions

template<class F >
std::vector< std::byte > buffer (F &&f)
 Serialize into a buffer.
 
template<class T >
get (const std::byte *&p)
 Reconstruct an object, advancing past its serialized form.
 
template<class T >
get1 (const std::byte *p)
 Get a single object.
 
template<class... TT>
auto get_tuple (const std::byte *p, const std::byte *e=nullptr)
 Construct a tuple of objects.
 
template<class T , class S = typename std::vector<T>::size_type>
auto get_vector (const std::byte *&p)
 Construct a std::vector from a size and then elements.
 
template<class... TT, class P >
void put (P &p, const TT &... tt)
 Store objects and advance past their serialized form.
 
template<class... TT>
auto put_tuple (const TT &... tt)
 Serialize a fixed set of objects into a buffer.
 
template<class... TT>
std::size_t size (const TT &... tt)
 Compute the serialized size of a fixed set of objects.
 

Detailed Description

Serialization without default constructibility.

Supported types:

Function Documentation

◆ put()

template<class... TT, class P >
void put ( P &  p,
const TT &...  tt 
)

Store objects and advance past their serialized form.

Template Parameters
Pstd::size_t for calculating sizes, or std::byte* for actual serialization
Parameters
ppointer or size
ttobjects

◆ size()

template<class... TT>
std::size_t size ( const TT &...  tt)

Compute the serialized size of a fixed set of objects.

◆ get()

template<class T >
T get ( const std::byte *&  p)

Reconstruct an object, advancing past its serialized form.

◆ buffer()

template<class F >
std::vector< std::byte > buffer ( F &&  f)

Serialize into a buffer.

Parameters
fa function that accepts an argument for put

◆ get1()

template<class T >
T get1 ( const std::byte *  p)

Get a single object.

Parameters
pmay be an rvalue

◆ put_tuple()

template<class... TT>
auto put_tuple ( const TT &...  tt)

Serialize a fixed set of objects into a buffer.

Reconstruct with get_tuple.

◆ get_tuple()

template<class... TT>
auto get_tuple ( const std::byte *  p,
const std::byte *  e = nullptr 
)

Construct a tuple of objects.

Parameters
epointer to end of representation, if known

◆ get_vector()

template<class T , class S = typename std::vector<T>::size_type>
auto get_vector ( const std::byte *&  p)

Construct a std::vector from a size and then elements.

Template Parameters
Ssize type
Warning
get<std::vector<T>> is not guaranteed to be equivalent.