acme
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages Concepts
_defer_payload_stream.h
1#pragma once
2
3
4
5template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
6inline void __exchange(::payload_stream& stream, ::array_base < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >& array)
7{
8
9 __exchange_array(stream, array);
10
11}
12
13
14template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
15inline void __exchange(::payload_stream& stream, ::raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >& array)
16{
17
18 __exchange_array(stream, array);
19
20}
21
22
23template < typename TYPE, ::enum_type t_etypeContainer >
24inline void __exchange(::payload_stream& stream, ::numeric_array < TYPE, t_etypeContainer >& array)
25{
26
27 __exchange_array(stream, array);
28
29}
30
31
32template < typename Type, typename RawType, ::enum_type t_etypeContainer >
33inline void __exchange(::payload_stream& stream, ::string_array_base < Type, RawType, t_etypeContainer >& array)
34{
35
36 __exchange_array(stream, array);
37
38}
39
40
41
42template < class ARRAY >
43inline void __exchange_array(::payload_stream& stream, ARRAY& array)
44{
45
46 if (stream.is_storing())
47 {
48
49 __exchange_save_array(stream, array);
50
51 }
52 else
53 {
54
55 __exchange_load_array(stream, array);
56 }
57
58}
59
60
61template < typename ARRAY >
62inline void __exchange_save_array(::payload_stream& stream, ARRAY& array)
63{
64
65 auto c = array.get_count();
66
67 stream.stream_exchange(e_property_count, c);
68
69 //if (stream.fail())
70 //{
71
72 // return;
73
74 //}
75
76 for (::collection::index i = 0; i < c; i++)
77 {
78
79 stream.stream_exchange(i, __typed(array.element_at(i)));
80
81 //if (stream.fail())
82 //{
83
84 // return;
85
86 //}
87
88 }
89
90}
91
92
93template < typename ARRAY >
94inline void __exchange_load_array(::payload_stream& stream, ARRAY& array)
95{
96
97 auto c = array.get_count();
98
99 stream.stream_exchange(e_property_count, c);
100
101 //if (stream.fail())
102 //{
103
104 // return;
105
106 //}
107
108 array.set_size(c);
109
110 for (::collection::index i = 0; i < c; i++)
111 {
112
113 auto& t = __typed_defer_new(array.element_at(i));
114
115 stream.stream_exchange(i, t);
116
117 //if (stream.fail())
118 //{
119
120 // array.set_size(i);
121
122 // return;
123
124 //}
125
126 }
127
128}
129
130
131
132
133
134template < typename OBJECT >
135inline void __exchange(::payload_stream& s, ::pointer<OBJECT> pparticle)
136{
137
138 s.__defer_construct(pparticle);
139
140 __exchange(s, *pparticle);
141
142}
143
144
145template < typename TYPE >
146inline void payload_stream::stream_exchange(const ::atom& atom, TYPE& t)
147{
148
149 var_exchange(atom, t);
150
151}
152
153
154
155
Definition array.h:340
Definition atom.h:233
Definition ___serialization_draft.h:93
Definition pointer.h:46
Definition ___serialization_draft.h:42