acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_serializable_impl.h
1#pragma once
2
3
4namespace file
5{
6
7 namespace array
8 {
9
10 //template < class ARRAY >
11 //void write(stream & ostream, const ARRAY & a)
12 //{
13 // ::collection::count count = a.get_count();
14 // ostream.write(count);
15 // for (::collection::index index = 0; index < count; index++)
16 // {
17 // ostream << a.element_at(index);
18 // }
19 //}
20
21 //template < class ARRAY >
22 //void read(stream & istream, ARRAY & a)
23 //{
24 // ::collection::count count;
25 // //istream >> count;
26 // istream.read(count);
27
28 // /*if (istream.fail())
29 // {
30 // return;
31 // }*/
32
33 // a.allocate(count);
34 // for (::collection::index index = 0; index < count; index++)
35 // {
36 // istream >> a.element_at(index);
37 // //if (istream.fail())
38 // //{
39 // // return;
40 // //}
41 // }
42 // a.on_after_read();
43 //}
44
45
46 } // namespace array
47
48 namespace ptra
49 {
50
51 //template < class ARRAY >
52 //void write(stream & ostream, const ARRAY & a)
53 //{
54 // ::collection::count count = a.get_count();
55 // ostream.write(count);
56 // for (::collection::index index = 0; index < count; index++)
57 // {
58 // ostream << *a.element_at(index);
59 // }
60 //}
61
62 //template < class ARRAY >
63 //void read(stream & istream, ARRAY & a)
64 //{
65 // ::collection::count count;
66 // //istream >> count;
67 // istream.read(count);
68
69 // //if (istream.fail())
70 // //{
71 // // return;
72 // //}
73
74 // a.allocate(count);
75 // for (::collection::index index = 0; index < count; index++)
76 // {
77 // istream >> *a.element_at(index);
78 // //if (istream.fail())
79 // //{
80 // // return;
81 // //}
82 // }
83 // a.on_after_read();
84 //}
85
86
87 } // namespace array
88
89 namespace map_base
90 {
91
92 //template < class type_map >
93 //void write(stream & ostream, const type_map & m)
94 //{
95
96 // ostream.write(m.get_count());
97
98 // auto p = m.get_start();
99
100 // while (p != nullptr)
101 // {
102
103 // ostream << p->element1();
104
105 // ostream << p->element2();
106
107 // p = m.get_next(p);
108
109 // }
110
111 //}
112
113
114 //template < class type_map >
115 //void read(stream & istream, type_map & m)
116 //{
117
118 // ::collection::count count;
119
120 // istream.read(count);
121
122 // //if (istream.fail())
123 // //{
124
125 // // return;
126
127 // //}
128
129 // typename type_map::BASE_KEY key;
130
131 // typename type_map::BASE_VALUE value;
132
133 // for (::collection::index index = 0; index < count; index++)
134 // {
135
136 // istream >> key;
137
138 // //if (istream.fail())
139 // //{
140
141 // // return;
142
143 // //}
144
145 // istream >> value;
146
147 // //if (istream.fail())
148 // //{
149
150 // // return;
151
152 // //}
153
154 // m.set_at(key, value);
155
156 // }
157
158 // m.on_after_read();
159
160 //}
161
162 } // namespace map_base
163
164
165
166} // namespace file
167
168
169//template < class TYPE, class ARG_TYPE = const TYPE &, class ALLOCATOR = ::allocator::def < TYPE > >
170//stream & operator << (stream & s, array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > & a)
171//{
172//
173// s.stream_array(a);
174//
175// return s;
176//
177//}
178
179
180//template < class TYPE, class ARG_TYPE = const TYPE &, class ALLOCATOR = ::allocator::def < TYPE > >
181//stream & operator >> (stream & s, array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > & a)
182//{
183//
184// s (a);
185//
186// return s;
187//
188//}
189
190
191
192//template<class TYPE, class ARG_TYPE = const TYPE &>
193//stream & operator << (stream & stream, raw_array < TYPE, ARG_TYPE> & a)
194//{
195//
196// ASSERT(stream.is_storing());
197//
198// stream.stream_array(a);
199//
200// return stream;
201//
202//}
203
204
205//template<class TYPE, class ARG_TYPE = const TYPE &>
206//stream & operator >> (stream & s, raw_array < TYPE, ARG_TYPE > & a)
207//{
208//
209// s.stream_array(a);
210//
211// return s;
212//
213//}
214
215
216
217
218
219
220
221
222//inline memsize stream::gcount() { return m_gcount; }
223//inline filesize stream::tellg() { return m_p->tell(); }
224//inline stream & stream::seekg(filesize position) { m_p->seek_from_begin(position); return *this; }
225//inline stream & stream::seekg(filesize offset, ::enum_seek eseek) { m_p->seek(offset, eseek); return *this; }
226
227//inline filesize stream::get_left() const { return m_p->get_length() - m_p->get_position(); }
Definition filesystem.h:16