9 #ifndef POLY_ACCESS_PACK_H
10 #define POLY_ACCESS_PACK_H
11 #include "polyPackBase.h"
17 typename enable_if<is_base_of<PolyPackBase, typename T::element_type> >::T
18 pack_smart_ptr(pack_t& x,
const string& d,
const T& a,
25 typename T::element_type::Type t=a->type();
32 typename enable_if<Not<is_base_of<PolyPackBase, typename T::element_type> > >::T
37 pack_smart_ptr(pack_t& x,
const string& d,
const T& a,
48 typename enable_if<is_base_of<PolyPackBase, typename T::element_type> >::T
49 unpack_smart_ptr(unpack_t& x,
const string& d, T& a, dummy<0> dum=0)
55 typename T::element_type::Type t;
57 a.reset(T::element_type::create(t));
65 typename enable_if<Not<is_base_of<PolyPackBase, typename T::element_type> > >::T
70 unpack_smart_ptr(pack_t& x,
const string& d, T& a, dummy<1> dum=0)
76 a.reset(
new typename T::element_type);
85 namespace classdesc_access
87 namespace cd = classdesc;
93 void operator()(
cd::pack_t& x,
const cd::string& d, U& a)
94 {pack_smart_ptr(x,d,a);}
101 void operator()(
cd::unpack_t& x,
const cd::string& d, U& a)
102 {unpack_smart_ptr(x,d,a);}
109 void operator()(
cd::pack_t& x,
const cd::string& d, U& a)
110 {pack_smart_ptr(x,d,a);}
117 void operator()(
cd::unpack_t& x,
const cd::string& d, U& a)
118 {unpack_smart_ptr(x,d,a);}
121 #if defined(__cplusplus) && __cplusplus >= 201103L
122 template <
class T,
class D>
126 void operator()(
cd::pack_t& x,
const cd::string& d, U& a)
127 {pack_smart_ptr(x,d,a);}
130 template <
class T,
class D>
131 struct access_unpack<std::unique_ptr<T,D>>
134 void operator()(
cd::unpack_t& x,
const cd::string& d, U& a)
135 {unpack_smart_ptr(x,d,a);}
class to allow access to private members
Definition: classdesc_access.h:21
class to allow access to private members
Definition: classdesc_access.h:22
void unpack(unpack_t &targ, const string &desc, is_treenode dum, T *&arg)
unserialise a tree.
Definition: pack_graph.h:44
void pack(pack_t &targ, const string &desc, is_treenode dum, const T *const &arg)
serialise a tree (or DAG)
Definition: pack_graph.h:28
Definition: pack_base.h:124