Classdesc 3.44
pack_epilogue.h
1/*
2 @copyright Russell Standish 2000-2013
3 @author Russell Standish
4 This file is part of Classdesc
5
6 Open source licensed under the MIT license. See LICENSE for details.
7*/
8
9#ifndef CLASSDESC_PACK_EPILOGUE_H
10#define CLASSDESC_PACK_EPILOGUE_H
11
12#include "pack-allCDs.h"
13#include "pack_stl.h"
14
15#include "use_mbr_pointers.h"
16CLASSDESC_USE_OLDSTYLE_MEMBER_OBJECTS(pack)
17CLASSDESC_USE_OLDSTYLE_MEMBER_OBJECTS(unpack)
18
19namespace classdesc_access
20{
21 namespace cd=classdesc;
22
23#ifdef CLASSDESC_OBJECT_H
24 template <> struct access_pack<classdesc::object>: public cd::NullDescriptor<cd::pack_t>{};
25 template <> struct access_unpack<classdesc::object>: public cd::NullDescriptor<cd::pack_t>{};
26
27 template <class T, class B>
28 struct access_pack<classdesc::Object<T, B> >
29 {
30 template <class U>
31 void operator()(cd::pack_t& b, const cd::string& d, U& a)
32 {pack(b,d,cd::base_cast<B>::cast(a));}
33 };
34
35 template <class T, class B>
36 struct access_unpack<classdesc::Object<T, B> >
37 {
38 template <class U>
39 void operator()(cd::unpack_t& b, const cd::string& d, U& a)
40 {unpack(b,d,cd::base_cast<B>::cast(a));}
41 };
42
43
44#endif
45
46 // const arg versions
47 template <class T>
48 struct access_pack<const T>
49 {
50 void operator()(cd::pack_t& buf, const cd::string& desc, const T& arg)
51 {access_pack<T>()(buf,desc,arg);}
52 };
53
54
55 template <class T>
56 struct access_unpack<const T>
57 {
58 void operator()(cd::pack_t& buf, const cd::string& desc, const T& arg)
59 {access_unpack<T>()(buf,desc,arg);}
60 };
61
62// template <class T> typename
63// cd::enable_if<cd::is_sequence<T>,void>::T
64// pack_container(cd::pack_t& buf,const cd::string& desc, T& arg,
65// cd::dummy<0> dum=0)
66// {access_pack<cd::sequence<T> >()(buf,desc,arg);}
67//
68// template <class T> typename
69// cd::enable_if<cd::is_associative_container<T>,void>::T
70// pack_container(cd::pack_t& buf,const cd::string& desc, T& arg,
71// cd::dummy<1> dum=0)
72// {access_pack<cd::associative_container<T> >()(buf,desc,arg);}
73
74#ifdef CLASSDESC_PACK_STL_H
75 // handle containers from the generic access_ classes
76// template <class T>
77// struct access_pack
78// {
79// template <class U>
80// void operator()(cd::pack_t& buf,const cd::string& desc, U& arg)
81// {pack_container(buf,desc,arg);}
82// };
83//
84// template <class T> typename
85// cd::enable_if<classdesc::is_sequence<T>,void>::T
86// unpack_container(cd::pack_t& buf,const cd::string& desc, T& arg,
87// cd::dummy<0> dum=0)
88// {access_unpack<classdesc::sequence<T> >()(buf,desc,arg);}
89//
90// template <class T> typename
91// cd::enable_if<classdesc::is_associative_container<T>,void>::T
92// unpack_container(cd::pack_t& buf,const cd::string& desc, T& arg,
93// cd::dummy<1> dum=0)
94// {access_unpack<classdesc::associative_container<T> >()(buf,desc,arg);}
95//
96// template <class T>
97// struct access_unpack
98// {
99// template <class U>
100// void operator()(cd::pack_t& buf,const cd::string& desc, U& arg)
101// {unpack_container(buf,desc,arg);}
102// };
103#endif
104
105 // support for polymorphic types, if loaded
106//#ifdef NEW_POLY_H
107// template <class T> struct access_pack<cd::PolyBase<T> >:
108// public cd::NullDescriptor<cd::pack_t> {};
109// template <class T> struct access_unpack<cd::PolyBase<T> >:
110// public cd::NullDescriptor<cd::pack_t> {};
111// template <class T, class B> struct access_pack<cd::Poly<T,B> >
112// {
113// template <class U>
114// void operator()(cd::pack_t& t, const cd::string& d, U& a)
115// {
116// pack(t,d,cd::base_cast<B>::cast(a));
117// }
118// };
119// template <class T, class B> struct access_unpack<cd::Poly<T,B> >
120// {
121// template <class U>
122// void operator()(cd::pack_t& t, const cd::string& d, U& a)
123// {
124// unpack(t,d,cd::base_cast<B>::cast(a));
125// }
126// };
127//#endif
128
129#ifdef CLASSDESC_POLYPACKBASE_H
130 template <> struct access_pack<cd::PolyPackBase>:
131 public cd::NullDescriptor<cd::pack_t> {};
132 template <> struct access_unpack<cd::PolyPackBase>:
133 public cd::NullDescriptor<cd::unpack_t> {};
134 template <class T> struct access_pack<cd::PolyPack<T> >:
135 public cd::NullDescriptor<cd::pack_t> {};
136 template <class T> struct access_unpack<cd::PolyPack<T> >:
137 public cd::NullDescriptor<cd::unpack_t> {};
138#endif
139
140#ifdef CLASSDESC_POLYJSONBASE_H
141 template <> struct access_pack<cd::PolyJsonBase>:
142 public cd::NullDescriptor<cd::pack_t> {};
143 template <> struct access_unpack<cd::PolyJsonBase>:
144 public cd::NullDescriptor<cd::unpack_t> {};
145 template <class T> struct access_pack<cd::PolyJson<T> >:
146 public cd::NullDescriptor<cd::pack_t> {};
147 template <class T> struct access_unpack<cd::PolyJson<T> >:
148 public cd::NullDescriptor<cd::unpack_t> {};
149#endif
150
151//#ifdef CLASSDESC_POLYXMLBASE_H
152// template <> struct access_pack<cd::PolyXMLBase>:
153// public cd::NullDescriptor<cd::pack_t> {};
154// template <> struct access_unpack<cd::PolyXMLBase>:
155// public cd::NullDescriptor<cd::unpack_t> {};
156// template <class T> struct access_pack<cd::PolyXML<T> >:
157// public cd::NullDescriptor<cd::pack_t> {};
158// template <class T> struct access_unpack<cd::PolyXML<T> >:
159// public cd::NullDescriptor<cd::unpack_t> {};
160//#endif
161
162#ifdef CLASSDESC_FACTORY_H
163 template <class T, class U> struct access_pack<cd::Factory<T,U> >
164 {
165 void operator()(cd::pack_t& b,const cd::string& d, cd::Factory<T,U>& a)
166 {
167 pack(b,d,a.fmap);
168 }
169 };
170
171
172
173 template <class T, class U> struct access_unpack<cd::Factory<T,U> >
174 {
175 void operator()(cd::unpack_t& b,const cd::string& d, cd::Factory<T,U>& a)
176 {
177 unpack(b,d,a.fmap);
178 }
179 };
180
181#endif
182
183}
184#include "polyAccessPack.h"
185#include "pack_stream.h"
186#include "pack_stl.h"
187
188#endif
Contains access_* structs, and nothing else. These structs are used to gain access to private members...
Definition classdesc_access.h:20
Contains definitions related to classdesc functionality.
serialisation for standard containers
helper for constructing null descriptors
Definition classdesc.h:1106
class to allow access to private members
Definition classdesc_access.h:21
class to allow access to private members
Definition classdesc_access.h:22