Derecho  0.9
Distributed systems toolkit for RDMA
Classes | Typedefs | Functions | Variables
mutils Namespace Reference

Classes

struct  ByteRepresentable
 A non-POD type which wishes to mark itself byte representable should extend this class. More...
 
struct  Bytes
 
struct  ContextDeleter
 
struct  ContextDeleter< void >
 
struct  DeserializationManager
 The manager for any RemoteDeserializationContexts. More...
 
struct  dsr_info
 
struct  is_list
 
struct  is_list< std::list< T > >
 
struct  is_map
 
struct  is_map< std::map< K, V > >
 
struct  is_pair
 
struct  is_pair< std::pair< T, U > >
 
struct  is_string
 
struct  is_string< const std::string >
 
struct  is_string< std::string >
 
struct  marshalled
 The "marshalled" type is a wrapper for already-serialized types;. More...
 
struct  RemoteDeserializationContext
 If a class which implements ByteRepresentable requires a context in order to correctly deserialize, that context should be represented as a class that extends RemoteDeserializationContext. More...
 

Typedefs

template<typename T >
using context_ptr = std::unique_ptr< T, ContextDeleter< T > >
 
using RemoteDeserializationContext_p = RemoteDeserializationContext *
 
using RemoteDeserialization_v = std::vector< RemoteDeserializationContext_p >
 

Functions

template<typename T , restrict2(std::is_pod< T >::value) >
auto bytes_size (const T &)
 Just calls sizeof(T) More...
 
std::size_t bytes_size (const ByteRepresentable &b)
 calls b.bytes_size() when b is a ByteRepresentable; calls sizeof(decay_t<decltype(b)>) when b is a POD; custom logic is implemented for some STL types. More...
 
std::size_t bytes_size (const std::string &b)
 effectively strlen(). More...
 
template<typename... T>
std::size_t bytes_size (const std::tuple< T... > &t)
 
template<typename T , typename V >
std::size_t bytes_size (const std::pair< T, V > &pair)
 sums the size of both pair elements More...
 
std::size_t bytes_size (const std::vector< bool > &v)
 all of the elements of this vector, plus one int for the number of elements. More...
 
template<typename T >
std::size_t bytes_size (const std::vector< T > &v)
 
template<typename T >
std::size_t bytes_size (const std::list< T > &list)
 Sums the size of all elements of this list, plus one int for the number of elements. More...
 
template<typename T >
std::size_t bytes_size (const std::set< T > &s)
 All the elements of the set, plus one int for the number of elements. More...
 
template<typename K , typename V >
std::size_t bytes_size (const std::map< K, V > &m)
 Sums the size of each key and value in the map, plus one int for the number of entries. More...
 
template<typename... T>
std::size_t bytes_size_helper (const T &... t)
 Sums the size of each element of the tuple. More...
 
template<typename F , typename BR , typename... Args>
std::enable_if_t< std::is_pod< BR >::value > post_object (const F &f, const BR &br, Args &&... args)
 In-place serialization is also sometimes possible. More...
 
void post_object (const std::function< void(char const *const, std::size_t)> &f, const ByteRepresentable &br)
 
std::size_t to_bytes (const ByteRepresentable &b, char *v)
 calls b.to_bytes(v) when b is a ByteRepresentable; calls std::memcpy() when b is POD. More...
 
std::size_t to_bytes (const std::string &b, char *v)
 extracts the C string (char*) equivalent to this std::string and stores it in v More...
 
template<typename T >
std::enable_if_t< std::is_base_of< ByteRepresentable CMA T >::value, std::unique_ptr< T > > from_bytes (DeserializationManager *ctx, char const *v)
 Calls T::from_bytes(ctx,v) when T is a ByteRepresentable. More...
 
template<typename T >
std::enable_if_t< std::is_pod< T >::value, std::unique_ptr< std::decay_t< T > > > from_bytes (DeserializationManager *, char const *v)
 Calls T::from_bytes(ctx,v) when T is a ByteRepresentable. More...
 
template<typename T >
std::enable_if_t< std::is_base_of< ByteRepresentable CMA std::decay_t< T > >::value, context_ptr< T > > from_bytes_noalloc (DeserializationManager *ctx, const char *v, context_ptr< std::decay_t< T >>=context_ptr< std::decay_t< T >>{})
 Calls T::from_bytes_noalloc(ctx,v) when T is a ByteRepresentable. More...
 
template<typename T >
std::enable_if_t< std::is_pod< T >::value, context_ptr< std::decay_t< T > > > from_bytes_noalloc (DeserializationManager *, char *v)
 Calls T::from_bytes_noalloc(ctx,v) when T is a ByteRepresentable. More...
 
template<typename T >
std::enable_if_t< std::is_pod< T >::value, context_ptr< const std::decay_t< T > > > from_bytes_noalloc (DeserializationManager *, char const *const v, context_ptr< T >=context_ptr< T >{})
 
template<typename T , typename F >
auto deserialize_and_run (DeserializationManager *dsm, char *v, const F &fun)
 Calls mutils::from_bytes_noalloc<T>(ctx,v), dereferences the result, and passes it to fun. More...
 
void post_object (const std::function< void(char const *const, std::size_t)> &f, const std::string &str)
 
template<typename T , typename V >
void post_object (const std::function< void(char const *const, std::size_t)> &f, const std::pair< T, V > &pair)
 
template<typename... T>
void post_object_helper (const std::function< void(char const *const, std::size_t)> &f, const T &... t)
 
template<typename... T>
void post_object (const std::function< void(char const *const, std::size_t)> &f, const std::tuple< T... > &t)
 
void post_object (const std::function< void(char const *const, std::size_t)> &f, const std::vector< bool > &vec)
 
template<typename T >
void post_object (const std::function< void(char const *const, std::size_t)> &f, const std::vector< T > &vec)
 
template<typename T >
void post_object (const std::function< void(char const *const, std::size_t)> &f, const std::list< T > &list)
 
template<typename T >
void post_object (const std::function< void(char const *const, std::size_t)> &f, const std::set< T > &s)
 
template<typename K , typename V >
void post_object (const std::function< void(char const *const, std::size_t)> &f, const std::map< K, V > &map)
 
template<typename T , restrict(std::is_pod< T >::value) >
std::size_t to_bytes (const T &t, char *v)
 Special to_bytes for POD types, which just uses memcpy. More...
 
std::size_t to_bytes (const std::vector< bool > &vec, char *v)
 
template<typename T >
std::size_t to_bytes (const std::vector< T > &vec, char *v)
 
template<typename T >
std::size_t to_bytes (const std::list< T > &list, char *buffer)
 
template<typename T , typename V >
std::size_t to_bytes (const std::pair< T, V > &pair, char *buffer)
 
template<typename... T>
std::size_t to_bytes (const std::tuple< T... > &tuple, char *buffer)
 
template<typename T >
std::size_t to_bytes (const std::set< T > &s, char *_v)
 
template<typename K , typename V >
std::size_t to_bytes (const std::map< K, V > &m, char *buffer)
 
template<typename T >
std::unique_ptr< type_check< std::is_integral, T > > from_string (DeserializationManager *, char const *v, std::size_t length)
 
template<typename T >
std::unique_ptr< type_check< std::is_floating_point, T > > from_string (DeserializationManager *, char const *v, std::size_t length)
 
template<typename T >
std::unique_ptr< type_check< is_string, T > > from_string (DeserializationManager *, char const *v, std::size_t length)
 
template<typename T >
std::enable_if_t< std::is_pod< T >::value, context_ptr< std::decay_t< T > > > from_bytes_noalloc (DeserializationManager *, char *v, context_ptr< T >=context_ptr< T >{})
 
template<typename T >
std::unique_ptr< type_check< is_string, T > > from_bytes (DeserializationManager *, char const *v)
 
template<typename T >
context_ptr< type_check< is_string, T > > from_bytes_noalloc (DeserializationManager *, char const *v, context_ptr< T >=context_ptr< T >{})
 
template<typename T >
std::unique_ptr< type_check< is_set, T > > from_bytes (DeserializationManager *ctx, const char *_v)
 
template<typename T >
context_ptr< type_check< is_set, T > > from_bytes_noalloc (DeserializationManager *ctx, char const *v, context_ptr< T >=context_ptr< T >{})
 
template<typename T >
std::unique_ptr< type_check< is_pair, T > > from_bytes (DeserializationManager *ctx, const char *v)
 
template<typename L >
std::unique_ptr< type_check< is_list, L > > from_bytes (DeserializationManager *ctx, const char *buffer)
 
template<typename T >
context_ptr< type_check< is_pair, T > > from_bytes_noalloc (DeserializationManager *ctx, char const *v, context_ptr< T >=context_ptr< T >{})
 
template<typename T >
std::unique_ptr< T > boolvec_from_bytes (DeserializationManager *ctx, char const *v)
 
template<typename TupleType , std::size_t N>
auto from_bytes_helper (DeserializationManager *ctx, char const *v)
 
template<typename T >
std::unique_ptr< type_check< is_tuple, T > > from_bytes (DeserializationManager *ctx, char const *v)
 
template<typename T >
std::enable_if_t< is_vector< T >::value, std::unique_ptr< T > > from_bytes (DeserializationManager *ctx, char const *v)
 
template<typename T >
context_ptr< type_check< is_vector, T > > from_bytes_noalloc (DeserializationManager *ctx, char const *v, context_ptr< T >=context_ptr< T >{})
 
template<typename T >
std::enable_if_t< is_map< T >::value, std::unique_ptr< T > > from_bytes (DeserializationManager *ctx, char const *buffer)
 
template<typename T >
context_ptr< type_check< is_map, T > > from_bytes_noalloc (DeserializationManager *ctx, char const *v, context_ptr< T >=context_ptr< T >{})
 
std::size_t to_bytes_v (char *)
 For Serializing and Deserializing many objects at once. More...
 
template<typename T , typename... Rest>
std::size_t to_bytes_v (char *buf, const T &first, const Rest &... rest)
 
std::size_t from_bytes_v (DeserializationManager *, char const *const)
 
template<typename T , typename... Rest>
std::size_t from_bytes_v (DeserializationManager *dsm, char const *const buf, std::unique_ptr< T > &first, Rest &... rest)
 
std::size_t from_bytes_noalloc_v (DeserializationManager *, char const *const)
 
template<typename T , typename... Rest>
std::size_t from_bytes_noalloc_v_nc (DeserializationManager *dsm, char *buf, context_ptr< T > &first, context_ptr< Rest > &... rest)
 
template<typename T , typename... Rest>
std::size_t from_bytes_noalloc_v (DeserializationManager *dsm, char *buf, context_ptr< T > &first, context_ptr< Rest > &... rest)
 
template<typename T , typename... Rest>
std::size_t from_bytes_noalloc_v (DeserializationManager *dsm, char const *const buf, context_ptr< const T > &first, context_ptr< const Rest > &... rest)
 
template<typename F , typename R , typename... Args>
auto deserialize_and_run (DeserializationManager *dsm, char const *const v, const F &fun, std::function< R(Args...)> const *const)
 
template<typename F >
auto deserialize_and_run (DeserializationManager *dsm, char const *const v, const F &fun)
 
std::function< void(char const *const, std::size_t)> post_to_buffer (std::size_t &index, char *dest_buf)
 

Variables

std::function< void(char const *const, std::size_t)> post_to_buffer (std::size_t &index, char *dest_buf)
 Serialization is also implemented for the following STL types: vector pair string set. More...
 

Class Documentation

◆ mutils::dsr_info

struct mutils::dsr_info

Definition at line 954 of file SerializationSupport.hpp.

Class Members
time_point start_time
nanoseconds to_callfunc
nanoseconds to_exit

Typedef Documentation

◆ context_ptr

template<typename T >
using mutils::context_ptr = typedef std::unique_ptr<T,ContextDeleter<T> >

Definition at line 20 of file context_ptr.hpp.

◆ RemoteDeserialization_v

Definition at line 121 of file SerializationSupport.hpp.

◆ RemoteDeserializationContext_p

Definition at line 116 of file SerializationSupport.hpp.

Function Documentation

◆ boolvec_from_bytes()

template<typename T >
std::unique_ptr<T> mutils::boolvec_from_bytes ( DeserializationManager ctx,
char const *  v 
)

◆ bytes_size() [1/10]

template<typename T , restrict2(std::is_pod< T >::value) >
auto mutils::bytes_size ( const T &  )

Just calls sizeof(T)

Definition at line 201 of file SerializationSupport.hpp.

◆ bytes_size() [2/10]

std::size_t mutils::bytes_size ( const ByteRepresentable b)

calls b.bytes_size() when b is a ByteRepresentable; calls sizeof(decay_t<decltype(b)>) when b is a POD; custom logic is implemented for some STL types.

Definition at line 11 of file SerializationSupport.cpp.

◆ bytes_size() [3/10]

std::size_t mutils::bytes_size ( const std::string &  b)

effectively strlen().

Definition at line 20 of file SerializationSupport.cpp.

◆ bytes_size() [4/10]

template<typename... T>
std::size_t mutils::bytes_size ( const std::tuple< T... > &  t)

Definition at line 299 of file SerializationSupport.hpp.

◆ bytes_size() [5/10]

template<typename T , typename V >
std::size_t mutils::bytes_size ( const std::pair< T, V > &  pair)

sums the size of both pair elements

Definition at line 224 of file SerializationSupport.hpp.

◆ bytes_size() [6/10]

std::size_t mutils::bytes_size ( const std::vector< bool > &  v)

all of the elements of this vector, plus one int for the number of elements.

◆ bytes_size() [7/10]

template<typename T >
std::size_t mutils::bytes_size ( const std::vector< T > &  v)

Definition at line 234 of file SerializationSupport.hpp.

◆ bytes_size() [8/10]

template<typename T >
std::size_t mutils::bytes_size ( const std::list< T > &  list)

Sums the size of all elements of this list, plus one int for the number of elements.

Definition at line 254 of file SerializationSupport.hpp.

◆ bytes_size() [9/10]

template<typename T >
std::size_t mutils::bytes_size ( const std::set< T > &  s)

All the elements of the set, plus one int for the number of elements.

Definition at line 269 of file SerializationSupport.hpp.

◆ bytes_size() [10/10]

template<typename K , typename V >
std::size_t mutils::bytes_size ( const std::map< K, V > &  m)

Sums the size of each key and value in the map, plus one int for the number of entries.

Definition at line 282 of file SerializationSupport.hpp.

◆ bytes_size_helper()

template<typename... T>
std::size_t mutils::bytes_size_helper ( const T &...  t)

Sums the size of each element of the tuple.

Definition at line 295 of file SerializationSupport.hpp.

◆ deserialize_and_run() [1/3]

template<typename T , typename F >
auto mutils::deserialize_and_run ( DeserializationManager dsm,
char *  v,
const F &  fun 
)

Calls mutils::from_bytes_noalloc<T>(ctx,v), dereferences the result, and passes it to fun.

Returns whatever fun returns. Memory safe, assuming fun doesn't do something stupid.

◆ deserialize_and_run() [2/3]

template<typename F , typename R , typename... Args>
auto mutils::deserialize_and_run ( DeserializationManager dsm,
char const *const  v,
const F &  fun,
std::function< R(Args...)> const *  const 
)

Definition at line 966 of file SerializationSupport.hpp.

◆ deserialize_and_run() [3/3]

template<typename F >
auto mutils::deserialize_and_run ( DeserializationManager dsm,
char const *const  v,
const F &  fun 
)

Definition at line 1020 of file SerializationSupport.hpp.

◆ from_bytes() [1/9]

template<typename T >
std::enable_if_t<std::is_base_of<ByteRepresentable CMA T>::value, std::unique_ptr<T> > mutils::from_bytes ( DeserializationManager ctx,
char const *  v 
)

Calls T::from_bytes(ctx,v) when T is a ByteRepresentable.

uses std::memcpy() when T is a POD. custom logic is implemented for some STL types.

Definition at line 356 of file SerializationSupport.hpp.

◆ from_bytes() [2/9]

template<typename T >
std::enable_if_t< std::is_pod< T >::value, std::unique_ptr< std::decay_t< T > > > mutils::from_bytes ( DeserializationManager ,
char const *  v 
)

Calls T::from_bytes(ctx,v) when T is a ByteRepresentable.

uses std::memcpy() when T is a POD. custom logic is implemented for some STL types.

Definition at line 684 of file SerializationSupport.hpp.

◆ from_bytes() [3/9]

template<typename T >
std::unique_ptr<type_check<is_string, T> > mutils::from_bytes ( DeserializationManager ,
char const *  v 
)

Definition at line 739 of file SerializationSupport.hpp.

◆ from_bytes() [4/9]

template<typename T >
std::unique_ptr<type_check<is_set, T> > mutils::from_bytes ( DeserializationManager ctx,
const char *  _v 
)

Definition at line 754 of file SerializationSupport.hpp.

◆ from_bytes() [5/9]

template<typename T >
std::unique_ptr<type_check<is_pair, T> > mutils::from_bytes ( DeserializationManager ctx,
const char *  v 
)

Definition at line 775 of file SerializationSupport.hpp.

◆ from_bytes() [6/9]

template<typename L >
std::unique_ptr<type_check<is_list, L> > mutils::from_bytes ( DeserializationManager ctx,
const char *  buffer 
)

Definition at line 785 of file SerializationSupport.hpp.

◆ from_bytes() [7/9]

template<typename T >
std::unique_ptr<type_check<is_tuple, T> > mutils::from_bytes ( DeserializationManager ctx,
char const *  v 
)

Definition at line 823 of file SerializationSupport.hpp.

◆ from_bytes() [8/9]

template<typename T >
std::enable_if_t<is_vector<T>::value, std::unique_ptr<T> > mutils::from_bytes ( DeserializationManager ctx,
char const *  v 
)

Definition at line 830 of file SerializationSupport.hpp.

◆ from_bytes() [9/9]

template<typename T >
std::enable_if_t<is_map<T>::value, std::unique_ptr<T> > mutils::from_bytes ( DeserializationManager ctx,
char const *  buffer 
)

Definition at line 874 of file SerializationSupport.hpp.

◆ from_bytes_helper()

template<typename TupleType , std::size_t N>
auto mutils::from_bytes_helper ( DeserializationManager ctx,
char const *  v 
)

Definition at line 811 of file SerializationSupport.hpp.

◆ from_bytes_noalloc() [1/9]

template<typename T >
std::enable_if_t< std::is_base_of< ByteRepresentable CMA std::decay_t< T > >::value, context_ptr< T > > mutils::from_bytes_noalloc ( DeserializationManager ctx,
const char *  v,
context_ptr< std::decay_t< T >>  = context_ptr<std::decay_t<T>>{} 
)

Calls T::from_bytes_noalloc(ctx,v) when T is a ByteRepresentable.

returns raw pointer when T is a POD custom logic is implemented for some STL types.

Definition at line 377 of file SerializationSupport.hpp.

◆ from_bytes_noalloc() [2/9]

template<typename T >
std::enable_if_t<std::is_pod<T>::value, context_ptr<std::decay_t<T> > > mutils::from_bytes_noalloc ( DeserializationManager ,
char *  v 
)

Calls T::from_bytes_noalloc(ctx,v) when T is a ByteRepresentable.

returns raw pointer when T is a POD custom logic is implemented for some STL types.

◆ from_bytes_noalloc() [3/9]

template<typename T >
std::enable_if_t< std::is_pod< T >::value, context_ptr< const std::decay_t< T > > > mutils::from_bytes_noalloc ( DeserializationManager ,
char const *const  v,
context_ptr< T >  = context_ptr<T>{} 
)

Definition at line 704 of file SerializationSupport.hpp.

◆ from_bytes_noalloc() [4/9]

template<typename T >
std::enable_if_t<std::is_pod<T>::value, context_ptr<std::decay_t<T> > > mutils::from_bytes_noalloc ( DeserializationManager ,
char *  v,
context_ptr< T >  = context_ptr<T>{} 
)

Definition at line 696 of file SerializationSupport.hpp.

◆ from_bytes_noalloc() [5/9]

template<typename T >
context_ptr<type_check<is_string, T> > mutils::from_bytes_noalloc ( DeserializationManager ,
char const *  v,
context_ptr< T >  = context_ptr<T>{} 
)

Definition at line 747 of file SerializationSupport.hpp.

◆ from_bytes_noalloc() [6/9]

template<typename T >
context_ptr<type_check<is_set, T> > mutils::from_bytes_noalloc ( DeserializationManager ctx,
char const *  v,
context_ptr< T >  = context_ptr<T>{} 
)

Definition at line 769 of file SerializationSupport.hpp.

◆ from_bytes_noalloc() [7/9]

template<typename T >
context_ptr<type_check<is_pair, T> > mutils::from_bytes_noalloc ( DeserializationManager ctx,
char const *  v,
context_ptr< T >  = context_ptr<T>{} 
)

Definition at line 801 of file SerializationSupport.hpp.

◆ from_bytes_noalloc() [8/9]

template<typename T >
context_ptr<type_check<is_vector, T> > mutils::from_bytes_noalloc ( DeserializationManager ctx,
char const *  v,
context_ptr< T >  = context_ptr<T>{} 
)

Definition at line 867 of file SerializationSupport.hpp.

◆ from_bytes_noalloc() [9/9]

template<typename T >
context_ptr<type_check<is_map, T> > mutils::from_bytes_noalloc ( DeserializationManager ctx,
char const *  v,
context_ptr< T >  = context_ptr<T>{} 
)

Definition at line 893 of file SerializationSupport.hpp.

◆ from_bytes_noalloc_v() [1/3]

std::size_t mutils::from_bytes_noalloc_v ( DeserializationManager ,
char const * const   
)

Definition at line 58 of file SerializationSupport.cpp.

◆ from_bytes_noalloc_v() [2/3]

template<typename T , typename... Rest>
std::size_t mutils::from_bytes_noalloc_v ( DeserializationManager dsm,
char *  buf,
context_ptr< T > &  first,
context_ptr< Rest > &...  rest 
)

Definition at line 935 of file SerializationSupport.hpp.

◆ from_bytes_noalloc_v() [3/3]

template<typename T , typename... Rest>
std::size_t mutils::from_bytes_noalloc_v ( DeserializationManager dsm,
char const *const  buf,
context_ptr< const T > &  first,
context_ptr< const Rest > &...  rest 
)

Definition at line 942 of file SerializationSupport.hpp.

◆ from_bytes_noalloc_v_nc()

template<typename T , typename... Rest>
std::size_t mutils::from_bytes_noalloc_v_nc ( DeserializationManager dsm,
char *  buf,
context_ptr< T > &  first,
context_ptr< Rest > &...  rest 
)

Definition at line 926 of file SerializationSupport.hpp.

◆ from_bytes_v() [1/2]

std::size_t mutils::from_bytes_v ( DeserializationManager ,
char const * const   
)

Definition at line 54 of file SerializationSupport.cpp.

◆ from_bytes_v() [2/2]

template<typename T , typename... Rest>
std::size_t mutils::from_bytes_v ( DeserializationManager dsm,
char const *const  buf,
std::unique_ptr< T > &  first,
Rest &...  rest 
)

Definition at line 916 of file SerializationSupport.hpp.

◆ from_string() [1/3]

template<typename T >
std::unique_ptr<type_check<std::is_integral, T> > mutils::from_string ( DeserializationManager ,
char const *  v,
std::size_t  length 
)

Definition at line 656 of file SerializationSupport.hpp.

◆ from_string() [2/3]

template<typename T >
std::unique_ptr<type_check<std::is_floating_point, T> > mutils::from_string ( DeserializationManager ,
char const *  v,
std::size_t  length 
)

Definition at line 662 of file SerializationSupport.hpp.

◆ from_string() [3/3]

template<typename T >
std::unique_ptr<type_check<is_string, T> > mutils::from_string ( DeserializationManager ,
char const *  v,
std::size_t  length 
)

Definition at line 677 of file SerializationSupport.hpp.

◆ post_object() [1/10]

template<typename F , typename BR , typename... Args>
std::enable_if_t<std::is_pod<BR>::value> mutils::post_object ( const F &  f,
const BR &  br,
Args &&...  args 
)

In-place serialization is also sometimes possible.

This will take a function that expects buffers to be posted, and will post the object (potentially in multiple buffers) via repeated calls to the function

Definition at line 310 of file SerializationSupport.hpp.

◆ post_object() [2/10]

void mutils::post_object ( const std::function< void(char const *const, std::size_t)> &  f,
const ByteRepresentable br 
)

Definition at line 42 of file SerializationSupport.cpp.

◆ post_object() [3/10]

void mutils::post_object ( const std::function< void(char const *const, std::size_t)> &  f,
const std::string &  str 
)

Definition at line 46 of file SerializationSupport.cpp.

◆ post_object() [4/10]

template<typename T , typename V >
void mutils::post_object ( const std::function< void(char const *const, std::size_t)> &  f,
const std::pair< T, V > &  pair 
)

Definition at line 484 of file SerializationSupport.hpp.

◆ post_object() [5/10]

template<typename... T>
void mutils::post_object ( const std::function< void(char const *const, std::size_t)> &  f,
const std::tuple< T... > &  t 
)

Definition at line 498 of file SerializationSupport.hpp.

◆ post_object() [6/10]

void mutils::post_object ( const std::function< void(char const *const, std::size_t)> &  f,
const std::vector< bool > &  vec 
)

◆ post_object() [7/10]

template<typename T >
void mutils::post_object ( const std::function< void(char const *const, std::size_t)> &  f,
const std::vector< T > &  vec 
)

Definition at line 511 of file SerializationSupport.hpp.

◆ post_object() [8/10]

template<typename T >
void mutils::post_object ( const std::function< void(char const *const, std::size_t)> &  f,
const std::list< T > &  list 
)

Definition at line 526 of file SerializationSupport.hpp.

◆ post_object() [9/10]

template<typename T >
void mutils::post_object ( const std::function< void(char const *const, std::size_t)> &  f,
const std::set< T > &  s 
)

Definition at line 536 of file SerializationSupport.hpp.

◆ post_object() [10/10]

template<typename K , typename V >
void mutils::post_object ( const std::function< void(char const *const, std::size_t)> &  f,
const std::map< K, V > &  map 
)

Definition at line 546 of file SerializationSupport.hpp.

◆ post_object_helper()

template<typename... T>
void mutils::post_object_helper ( const std::function< void(char const *const, std::size_t)> &  f,
const T &...  t 
)

Definition at line 491 of file SerializationSupport.hpp.

◆ post_to_buffer()

std::function<void(char const* const, std::size_t)> mutils::post_to_buffer ( std::size_t &  index,
char *  dest_buf 
)

Definition at line 35 of file SerializationSupport.cpp.

◆ to_bytes() [1/10]

std::size_t mutils::to_bytes ( const ByteRepresentable b,
char *  v 
)

calls b.to_bytes(v) when b is a ByteRepresentable; calls std::memcpy() when b is POD.

Custom logic is implemented for some STL types. When ubuntu gets GCC5.0 or better, this will also work if b is trivially copyable.

Definition at line 7 of file SerializationSupport.cpp.

◆ to_bytes() [2/10]

std::size_t mutils::to_bytes ( const std::string &  b,
char *  v 
)

extracts the C string (char*) equivalent to this std::string and stores it in v

Definition at line 15 of file SerializationSupport.cpp.

◆ to_bytes() [3/10]

template<typename T , restrict(std::is_pod< T >::value) >
std::size_t mutils::to_bytes ( const T &  t,
char *  v 
)

Special to_bytes for POD types, which just uses memcpy.

Definition at line 566 of file SerializationSupport.hpp.

◆ to_bytes() [4/10]

std::size_t mutils::to_bytes ( const std::vector< bool > &  vec,
char *  v 
)

◆ to_bytes() [5/10]

template<typename T >
std::size_t mutils::to_bytes ( const std::vector< T > &  vec,
char *  v 
)

Definition at line 576 of file SerializationSupport.hpp.

◆ to_bytes() [6/10]

template<typename T >
std::size_t mutils::to_bytes ( const std::list< T > &  list,
char *  buffer 
)

Definition at line 584 of file SerializationSupport.hpp.

◆ to_bytes() [7/10]

template<typename T , typename V >
std::size_t mutils::to_bytes ( const std::pair< T, V > &  pair,
char *  buffer 
)

Definition at line 592 of file SerializationSupport.hpp.

◆ to_bytes() [8/10]

template<typename... T>
std::size_t mutils::to_bytes ( const std::tuple< T... > &  tuple,
char *  buffer 
)

Definition at line 599 of file SerializationSupport.hpp.

◆ to_bytes() [9/10]

template<typename T >
std::size_t mutils::to_bytes ( const std::set< T > &  s,
char *  _v 
)

Definition at line 606 of file SerializationSupport.hpp.

◆ to_bytes() [10/10]

template<typename K , typename V >
std::size_t mutils::to_bytes ( const std::map< K, V > &  m,
char *  buffer 
)

Definition at line 614 of file SerializationSupport.hpp.

◆ to_bytes_v() [1/2]

std::size_t mutils::to_bytes_v ( char *  )

For Serializing and Deserializing many objects at once.

The deserialization expects unique_ptr references; this is important! Also the buffer is at the beginning! This is important.

Definition at line 50 of file SerializationSupport.cpp.

◆ to_bytes_v() [2/2]

template<typename T , typename... Rest>
std::size_t mutils::to_bytes_v ( char *  buf,
const T &  first,
const Rest &...  rest 
)

Definition at line 908 of file SerializationSupport.hpp.

Variable Documentation

◆ post_to_buffer

std::function<void(char const* const, std::size_t)> mutils::post_to_buffer(std::size_t &index, char *dest_buf)

Serialization is also implemented for the following STL types: vector pair string set.

Constructs a buffer-consuming function that will copy its input to the provided destination buffer at the specified index. The created function can be used as an input to post_object to make post_object serialize the object to a buffer.

Parameters
indexThe offset within dest_buf at which the function should copy inputs
dest_bufThe buffer that should receive bytes read by the function
Returns
A function that consumes a byte buffer and writes it to dest_buf

Definition at line 476 of file SerializationSupport.hpp.