8#ifndef PACKER_UTIL_HPP_
9#define PACKER_UTIL_HPP_
11#include "prp_all_zero.hpp"
12#include "Packer_Unpacker/Pack_selector.hpp"
13#include "memory/HeapMemory.hpp"
14#include "Vector/map_vector_grow_p.hpp"
15#include "Vector/vect_isel.hpp"
16#include "memory_ly/memory_conf.hpp"
17#include "util/Pack_stat.hpp"
19template<typename T, typename Mem, int pack_type=Pack_selector<T>::value >
class Packer;
20template<typename T, typename Mem, int pack_type=Pack_selector<T>::value >
class Unpacker;
22#include "Vector/vector_def.hpp"
31template<
typename encap,
typename Mem>
54 typedef typename boost::mpl::at<typename encap::T_type,T>::type obj_type;
62template<
typename encap,
typename Mem,
int ... prp>
74 typedef typename prp_all_zero<encap,
sizeof...(prp) == 0,prp...>::type b_prp;
79 boost::mpl::for_each_ref<b_prp>(functor);
84template<
typename encap,
typename Mem>
105 typedef typename boost::mpl::at<typename encap::type,T>::type obj_type;
111template<
typename Timp>
114 template<
typename T,
typename Mem,
typename encap>
121template<
unsigned int N1,
typename Timp>
124 template<
typename T,
typename Mem,
typename encap>
127 for (
int i = 0 ; i < N1 ; i++)
133template<
typename encap,
typename Mem>
166template<
typename encap,
typename Mem,
int ... prp>
172 typedef typename prp_all_zero<
typename encap::T_type,
sizeof...(prp) == 0,prp...>::type b_prp;
177 boost::mpl::for_each_ref<b_prp>(functor);
182template<
typename encap,
typename Mem,
int ... prp>
188 typedef typename prp_all_zero<
typename encap::T_type,
sizeof...(prp) == 0,prp...>::type b_prp;
193 boost::mpl::for_each_ref<b_prp>(functor);
198template<
typename encap,
typename Mem,
int ... prp>
206 :mem(mem), obj(obj), ps(ps)
214 typedef typename boost::mpl::at<typename encap::type,T>::type obj_type;
223 template<
typename T_value,
typename Mem,
typename encap>
226 typedef typename boost::mpl::at<typename encap::type,T_value>::type::value_type obj_type;
232template<
typename T,
unsigned int N1>
235 template<
typename T_value,
typename Mem,
typename encap>
238 for (
int i = 0 ; i < N1 ; i++)
240 typedef typename std::remove_all_extents< typename boost::mpl::at<typename encap::type,T_value>::type >::type::value_type obj_type;
248template<
typename encap,
typename Mem,
int ... prp>
258 :mem(mem), obj(obj), ps(ps),sub_id(sub_id)
266 typedef typename boost::mpl::at<typename encap::type,T>::type obj_type;
275template<
typename encap,
typename Mem,
int ... prp>
281 typedef typename prp_all_zero<encap,
sizeof...(prp) == 0,prp...>::type b_prp;
286 boost::mpl::for_each_ref<b_prp>(functor);
291template<
typename encap,
typename Mem,
int ... prp>
297 typedef typename prp_all_zero<encap,
sizeof...(prp) == 0,prp...>::type b_prp;
302 boost::mpl::for_each_ref<b_prp>(functor);
312template<
bool inte_layout,
typename obj_type,
typename Mem>
315 template<
unsigned int p>
static inline void call_pack_req(
const obj_type & obj,
size_t & req)
317 typedef typename boost::mpl::at<typename obj_type::type,boost::mpl::int_<p>>::type obj_t;
323template<
typename obj_type,
typename Mem>
326 template<
unsigned int p>
static inline void call_pack_req(
const obj_type & obj,
size_t & req)
328 typedef typename boost::mpl::at<typename obj_type::type,boost::mpl::int_<p>>::type obj_t;
334template<
typename>
struct Debug;
338template<
typename obj_type,
typename Mem>
359template<
typename obj_type,
typename Mem>
379 typedef decltype(
obj.template get<T::value>()[
sub_id]) obj_t;
387template<
typename obj_type,
typename Mem,
int ... prp>
399 typedef typename prp_all_zero<obj_type,
sizeof...(prp) == 0,prp...>::type b_prp;
404 boost::mpl::for_each_ref<b_prp>(functor);
408template<
bool inte_layout,
typename obj_type,
typename Mem>
413 typedef typename boost::mpl::at<typename obj_type::type,boost::mpl::int_<p>>::type obj_t;
420template<
typename obj_type,
typename Mem,
int ... prp>
432 typedef typename prp_all_zero<obj_type,
sizeof...(prp) == 0,prp...>::type b_prp;
437 boost::mpl::for_each_ref<b_prp>(functor);
442template<
typename obj_type,
typename Mem>
446 const obj_type & obj;
450 :mem(mem), obj(obj), sts(sts)
467template<
typename obj_type,
typename Mem,
int ... prp>
480 typedef typename prp_all_zero<obj_type,
sizeof...(prp) == 0,prp...>::type b_prp;
485 boost::mpl::for_each_ref<b_prp>(functor);
491template<
typename obj_type,
typename Mem>
519 typedef typename boost::mpl::at<typename obj_type::type,T>::type obj_t;
526template<
typename obj_type,
typename Mem,
int ... prp>
539 typedef typename prp_all_zero<obj_type,
sizeof...(prp) == 0,prp...>::type b_prp;
544 boost::mpl::for_each_ref<b_prp>(functor);
static void pack(ExtPreAlloc< Mem >, const T &obj)
Error, no implementation.
static size_t packRequest(const T &obj, size_t &req)
Error, no implementation.
static void unpack(ExtPreAlloc< Mem >, T &obj)
Error, no implementation.
static void call_packRequest(const obj_type &obj, size_t sub_id, size_t &req)
Pack the object.
static void call_packRequest(const obj_type &obj, size_t &req)
Pack the object.
Calls a packer in nested way.
static void call_pack(const obj_type &obj, ExtPreAlloc< Mem > &mem, Pack_stat &sts)
Call the packer.
Calls an unpacker in nested way.
static void call_unpack(obj_type &&obj, ExtPreAlloc< Mem > &mem, Unpack_stat &ps)
constructor
static void call_packRequest(encap &obj, size_t &req)
pack/serialize
const obj_type & obj
object to pack
size_t & req
offset of the packed memory
void operator()(T &t)
It calls the pack request for each property.
const obj_type & obj
object to pack
size_t & req
offset of the packed memory
void operator()(T &t)
It calls the pack request for each property.
encap & obj
encap object to pack (serialize)
void operator()(T &t)
It calls the pack request for each property.
void operator()(T &t)
It calls the packer for each property.
Pack_stat & sts
serialization status
void operator()(T &t)
It calls the packer for each property.
const encap & obj
Object to serialize.
ExtPreAlloc< Mem > & mem
Memory that pack/serialize the object.
ExtPreAlloc< Mem > & mem
Memory that pack/serialize the object.
void operator()(T &t)
It calls the packer for each property.
const encap & obj
Object to serialize.
Pack_stat & sts
serialization status
call_unpack_agg_functor(ExtPreAlloc< Mem > &mem, obj_type &obj, Unpack_stat &ps)
constructor
void operator()(T &t)
It calls the unpacker for each property.
Unpack_stat & ps
statistic about packing
obj_type & obj
object to pack
ExtPreAlloc< Mem > & mem
Memory where to pack.
void operator()(T &t)
It calls the unpacker for each property.
void operator()(T &t)
It calls the unpacker for each property.
Structure to convert a variadic template into boost::mpl::vector.