acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
stream.h
1#pragma once
2
3
4//#define __EXCHANGE(xxx) binary_stream.stream_exchange(__STRING(xxx), m_##xxx)
5//#define __TYPE_EXCHANGE(xxx) binary_stream.stream_exchange(__STRING(xxx), t.m_##xxx)
6
7//class payload_stream;
8
9
10// Use cases:
11// - Entry i32_point convenience syntax sugar
12// - syntax sugar
13//template < typename TYPE >
14//inline binary_stream & operator >> (binary_stream & binary_stream, TYPE & t);
15//
16//template < typename TYPE >
17//inline binary_stream & operator << (binary_stream & binary_stream, const TYPE & t);
18//
19//template < typename TYPE >
20//inline payload_stream & operator >> (payload_stream & binary_stream, TYPE & t);
21//
22//template < typename TYPE >
23//inline payload_stream & operator << (payload_stream & binary_stream, const TYPE & t);
24//
25//template < typename TYPE >
26//inline text_stream & operator >> (text_stream & binary_stream, TYPE & t);
27//
28//template < typename TYPE >
29//inline text_stream & operator << (text_stream & binary_stream, const TYPE & t);
30
31//template < typename TYPE >
32//inline ::file::file & operator >> (::file::file & file, TYPE & t);
33//
34//template < typename TYPE >
35//inline ::file::file & operator << (::file::file & file, const TYPE & t);
36//
37
38
39
40 /*inline void __exchange(::binary_stream & s, bool & b);
41
42
43 inline void __exchange(::binary_stream & s, ::i8 & i);
44 inline void __exchange(::binary_stream & s, ::i16 & i);
45 inline void __exchange(::binary_stream & s, ::i32 & i);
46 inline void __exchange(::binary_stream & s, ::i64 & i);
47 inline void __exchange(::binary_stream & s, ::u8 & u);
48 inline void __exchange(::binary_stream & s, ::u16 & u);
49 inline void __exchange(::binary_stream & s, ::u32 & u);
50 inline void __exchange(::binary_stream & s, ::u64 & u);
51
52
53 inline void __exchange(::binary_stream & s, long & l);
54
55
56 inline void __exchange(::binary_stream & s, ::f32 & f);
57 inline void __exchange(::binary_stream & s, ::f64 & d);
58 inline void __exchange(::binary_stream & s, ::earth::time & time);
59 inline void __exchange(::binary_stream & s, const ::scoped_string & scopedstr);
60 inline void __exchange(::binary_stream & s, string & str);
61 inline void __exchange(::binary_stream & s, ::file::path & path);
62 inline void __exchange(::binary_stream & s, ::atom & atom);
63 inline void __exchange(::binary_stream & s, ::payload & payload);
64 inline void __exchange(::binary_stream & s, ::property & property);
65 inline void __exchange(::binary_stream & s, ::matter & matter);
66
67
68 inline void __exchange(::binary_stream & s, ::i32_rectangle & rectangle);
69 inline void __exchange(::binary_stream & s, ::i64_rectangle & rectangle);
70 inline void __exchange(::binary_stream & s, ::f32_rectangle & rectangle);
71 inline void __exchange(::binary_stream & s, ::f64_rectangle & rectangle);
72
73
74 inline void __exchange(::binary_stream & s, ::i32_size & rectangle);
75 inline void __exchange(::binary_stream & s, ::i64_size & rectangle);
76 inline void __exchange(::binary_stream & s, ::f32_size & rectangle);
77 inline void __exchange(::binary_stream & s, ::f64_size & rectangle);
78
79
80 inline void __exchange(::binary_stream & s, ::i32_point & rectangle);
81 inline void __exchange(::binary_stream & s, ::i64_point & rectangle);
82 inline void __exchange(::binary_stream & s, ::f32_point & rectangle);
83 inline void __exchange(::binary_stream & s, ::f64_point & rectangle);
84
85
86template < typename OBJECT >
87inline void __exchange(::binary_stream & s, ::pointer<OBJECT>& pparticle)
88{
89 __exchange(s, __typed_defer_create(pparticle));
90}
91
92
93template < typename BLOCK_TYPE >
94inline void __exchange(binary_stream & s, memory_template < BLOCK_TYPE > & block);
95
96template < typename ARRAY >
97inline void __exchange_array(::binary_stream & s, const ARRAY & array) { __exchange_array(s, (ARRAY &)array); }
98
99
100inline void __exchange(::binary_stream & s, const ::file::path_array_base & patha) { __exchange_array(s, patha); }
101
102template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
103inline void __exchange(::binary_stream & s, const ::base_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > & array) { __exchange_array(s, (::base_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > &)array); }
104
105template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
106inline void __exchange(::binary_stream & s, const ::raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > & array) { __exchange_array(s, (::raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > &)array); }
107
108template < typename TYPE, ::enum_type t_etypeContainer = e_type_element >
109inline void __exchange(::binary_stream & s, const ::numeric_array < TYPE, t_etypeContainer > & array) { __exchange_array(s, (::numeric_array < TYPE, t_etypeContainer > &) array); }
110
111template < typename Type, typename RawType, ::enum_type t_etypeContainer >
112inline void __exchange(::binary_stream & s, const ::string_base_array < Type, RawType, t_etypeContainer > & array) { __exchange_array(s, (::string_base_array < Type, RawType, t_etypeContainer > &) array); }
113
114template < typename ARRAY >
115inline void __exchange_save_array(::binary_stream & s, ARRAY & array);
116
117template < typename ARRAY >
118inline void __exchange_load_array(::binary_stream & s, ARRAY & array);
119
120template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
121inline void __exchange(::binary_stream & s, ::base_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > & array);
122
123template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
124inline void __exchange(::binary_stream & s, ::raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > & array);
125
126template < typename TYPE, ::enum_type t_etypeContainer = e_type_element >
127inline void __exchange(::binary_stream & s, ::numeric_array < TYPE, t_etypeContainer > & array);
128
129template < typename Type, typename RawType, ::enum_type t_etypeContainer >
130inline void __exchange(::binary_stream & s, ::string_base_array < Type, RawType, t_etypeContainer > & array);*/
131
132
133#define FIRST_VERSION 0
134
135
136enum enum_set_storing
137{
138
139 e_set_storing
140
141};
142
143
144enum enum_set_loading
145{
146
147 e_set_loading
148
149};
150
151
152
153class stream_base :
154 public ::particle
155//class CLASS_DECL_ACME stream_base
156{
157public:
158
159
160 e_str_flag m_estrflag;
161 ::file::e_iostate m_iostate;
162 memsize m_gcount;
163 ::file::enum_stream m_estream = ::file::e_stream_none;
164
165
166 stream_base()
167 {
168
169 //m_bStoring = false;
170 m_gcount = 0;
171 m_iostate = ::file::goodbit;
172 //m_iVersion = FIRST_VERSION;
173
174 }
175 stream_base(const ::stream_base & meta) = delete;
176 stream_base(::stream_base && meta) = delete;
177
178
179 //virtual ::file::file * get_file() = 0;
180
181
182 //bool bad() const
183 //{
184 // return (m_iostate & ::file::badbit) != 0;
185 //}
186
187 //bool fail() const
188 //{
189 // return ((::i32)m_iostate & ((::i32) ::file::badbit | (::i32) ::file::failbit)) != 0;
190 //}
191
192 //bool eof() const
193 //{
194 // return (m_iostate & ::file::eofbit) != 0;
195 //}
196
197 //bool good() const
198 //{
199 // return m_iostate == ::file::goodbit;
200 //}
201
202 //void setstate(::i32 state)
203 //{
204 // clear((::file::e_iostate) (rdstate() | state));
205 //}
206
207 //void set_fail_bit()
208 //{
209 // setstate(::file::failbit);
210 //}
211
212 //void clear(::i32 state = ::file::goodbit)
213 //{
214 // m_iostate = (::file::e_iostate) state;
215 //}
216
217 virtual bool is_version(::i32 i);
218
219
220 //::file::e_iostate rdstate() const
221 //{
222
223 // return m_iostate;
224
225 //}
226
227
228 //bool operator ! ()
229 //{
230
231 // return fail();
232
233 //}
234
235
236
237};
238
239template < typename S, typename T >
240void stream_exchange(S & s, T & t)
241{
242
243 if(s.m_estream == ::file::e_stream_output)
244 {
245
246 s << t;
247
248 }
249 else if(s.m_estream == ::file::e_stream_input)
250 {
251
252 s >> t;
253
254 }
255 else
256 {
257
258 throw "wrong state m_estream is bad";
259
260 }
261
262}
263
264
265//template < typename POINTER_TYPE >
266//class raw_pointer < ::pointer<POINTER_TYPE >>
267//{
268//public:
269//
270// using RAW_POINTER = typename ::pointer<POINTER_TYPE>::RAW_POINTER;
271//
272//};
273
274//
275//class CLASS_DECL_ACME property_set_stream :
276// virtual public matter
277//{
278//public:
279//
280//
281// ::property_set * m_ppropertyset;
282//
283//
284// property_set_stream() : m_ppropertyset(nullptr) { }
285// property_set_stream(::property_set & set) : m_ppropertyset(&set) { }
286//
287// virtual binary_stream * branch(const ::atom & atom);
288//
289//};
290//
291//
292//class CLASS_DECL_ACME payload_stream :
293// virtual public matter
294//{
295//public:
296//
297//
298// ::payload * m_ppayload;
299//
300//
301// payload_stream() : m_ppayload(nullptr) { }
302// payload_stream(::payload & payload) : m_ppayload(&payload) { }
303//
304// virtual binary_stream * branch(const ::atom &);
305//
306//
307//};
308
309
310//class CLASS_DECL_ACME stream_stack
311//{
312//public:
313//
314//
315// ::pointer<binary_stream>m_pstream;
316//
317//
318// stream_stack(binary_stream * pstream, const ::atom & atom);
319//
320//
321// binary_stream & binary_stream() { return *m_pstream; }
322//
323//
324//};
325//
326
327//class CLASS_DECL_ACME binary_stream :
328// public stream_meta,
329// virtual public object
330//{
331//public:
332//
333//
334// ::payload * m_pvarOptions;
335//
336//
337// binary_stream():m_pvarOptions(nullptr) {}
338// ~binary_stream() override;
339//
340// inline ::payload & options();
341//
342//
343// virtual ::file::path get_file_path() const;
344//
345// virtual void close();
346//
347// inline void defer_set_storing() { if (!is_storing()) set_storing(); }
348//
349// virtual string factory_id_to_text(const :: atom & atom);
350// virtual ::atom text_to_factory_id(const ::scoped_string & scopedstrText);
351//
352// template < typename TYPE >
353// void default_exchange(TYPE & t);
354//
355// template < typename TYPE >
356// void write_only(TYPE & t);
357//
358// template < typename TYPE >
359// void stream_exchange(const ::atom & atom, TYPE & t);
360//
361// inline void exchange(const ::atom & atom, void * pdata, memsize s);
362//
363// void add_exception(const ::exception & e) override;
364// void on_catch_all_exception() override;
365//
366// virtual void write_element(const ::atom & atom, ::particle * pparticle);
367//
368// virtual ::pointer<::element>read_element(const ::atom & atom);
369//
370//
371// virtual bool is_open() const;
372//
373//
374// virtual bool is_stream_null() const;
375// virtual bool is_stream_set() const;
376//
377// virtual void * get_internal_data();
378// virtual memsize get_internal_data_size() const;
379// virtual bool set_internal_data_size(memsize c);
380// virtual filesize get_position() const;
381//
382//
383// virtual void read(memory_base & m);
384// virtual void write(const memory_base & m);
385//
386// virtual bool is_reader_null() const;
387// virtual bool is_reader_set() const;
388//
389// virtual void read_to_hex(string & str, filesize iStart = -1, filesize iEnd = -1);
390//
391// virtual void write_from_hex(const void *pdata, memsize nCount);
392//
393// virtual void write(const void *pdata, memsize nCount);
394//
395// virtual void write(const void *pdata, memsize nCount, memsize * dwWritten);
396//
397// virtual bool is_writer_null();
398// virtual bool is_writer_set();
399//
400// virtual void flush();
401//
402// virtual void set_length(filesize len);
403//
404// // This number represents a following binary_stream of data with this length.
405// // So the extra bytes representing the variable length quantity are
406// // neglectable and worth due the very fast variable length encoding.
407// inline void write_buffer_length(::u64 u)
408// {
409//
410// if (u < 255)
411// {
412//
413// write((::u8) u);
414//
415// }
416// else if (u < 65535)
417// {
418//
419// write((::u8)255);
420// write((::u16)u);
421//
422// }
423// else
424// {
425//
426// write((::u8)255);
427// write((::u16)65535);
428// write((::u64)u);
429//
430// }
431//
432// }
433//
434// inline void read_buffer_length(::u64 & u)
435// {
436//
437// ::u8 uRead;
438//
439// read(uRead);
440//
441// if (uRead < 255)
442// {
443//
444// u = uRead;
445//
446// }
447// else
448// {
449//
450// ::u16 uRead;
451//
452// read(uRead);
453//
454// if (uRead < 65535)
455// {
456//
457// u = uRead;
458//
459// }
460// else
461// {
462//
463// read(u);
464//
465// }
466//
467// }
468//
469// }
470//
471//
472// virtual void write(::i8 ch) { raw_write(ch); }
473// virtual void write(uchar uch) { raw_write(uch); }
474// virtual void write(::i8 i) { raw_write(i); }
475// virtual void write(::i16 i) { raw_write(i); }
476// virtual void write(::u16 u) { raw_write(u); }
477//#ifdef WINDOWS
478// virtual void write(unichar wch) { raw_write(wch); }
479//#endif
480// virtual void write(bool b) { write((::u8)b?1: 0); }
481// virtual void write(::i32 i) { raw_write(i); }
482// virtual void write(::u32 u) { raw_write(u); }
483// virtual void write(::i64 i) { raw_write(i); }
484// virtual void write(::u64 u) { raw_write(u); }
485//#if defined(__APPLE__) || defined(__ANDROID__) || defined(WINDOWS) || defined(RASPBERRYPIOS)
486// virtual void write(ulong ul) { raw_write(ul); }
487// virtual void write(long l) { raw_write(l); }
488// //inline void write (::i64 hi);
489//#endif
490// virtual void write(::f32 f) { raw_write(f); }
491// virtual void write(::f64 d) { raw_write(d); }
492// //virtual void write(const ::i32_point & point) { raw_write(point); }
493// //virtual void write(const ::i32_size & size) { raw_write(size); }
494// //virtual void write(const ::i32_rectangle &crect) { raw_write(crect); }
495// virtual void write(const ::scoped_string & scopedstr);
496//#ifdef WINDOWS
497// virtual void write(const wide_character * wch) { write(string(wch)); }
498//#endif
499// virtual void write(const atom & atom);
500// virtual void write(const ::payload & payload);
501// virtual void write(const property & property);
502// virtual void write(const ::scoped_string & scopedstr) ;
503// virtual void write(const ::particle * pparticle);
504// virtual void write(const ::matter & matter);
505// virtual void write(const ::property_set & set);
506// virtual void write(const block & block);
507//
508// //::filesize tellp();
509// //virtual void seekp(filesize position) ;
510// //virtual void seekp(filesize offset, ::enum_seek eseek);
511// virtual void put(::i8 ch);
512//
513//
514// template < typename TYPE >
515// inline auto read() { TYPE t; read(t); return t; }
516//
517//
518// virtual void read(bool & b);
519// virtual void read(::i8 & ch);
520// virtual void read(uchar & uch);
521//#ifdef WINDOWS
522// virtual void read(unichar & wch);
523// virtual void read(long & l);
524//#elif defined(__APPLE__) || defined(__ANDROID__) || defined(WINDOWS) || defined(RASPBERRYPIOS)
525// virtual void read(long & l);
526//#endif
527// virtual void read(::i8 & i);
528// virtual void read(::i16 & i);
529// virtual void read(::u16 & u);
530// virtual void read(::i32 & i);
531// virtual void read(::u32 & u);
532// virtual void read(::i64 & i);
533// virtual void read(::u64 & u);
534//#if defined(__APPLE__) || defined(__ANDROID__) || defined(WINDOWS) || defined(RASPBERRYPIOS)
535// virtual void read(ulong & u);
536// //inline void read (::i64 & u);
537//#endif
538// virtual void read(::f32 & f);
539// virtual void read(::f64 & d);
540// //virtual void read(::i32_point & point);
541// //virtual void read(::i32_size & size);
542// //virtual void read(::i32_rectangle & rectangle);
543// virtual void read(atom & atom);
544// virtual void read(::payload & payload);
545// virtual void read_var_type(enum_type & etype);
546// virtual void read_var_body(::payload & payload, enum_type etype);
547// virtual void read(property & property);
548// virtual void read(string & str);
549// //virtual void read(::particle * pparticle);
550// virtual void read(::matter & matter);
551// virtual void read(::property_set & set);
552// virtual void read(block & block);
553//
554// virtual void save_var_type(::enum_type etype);
555//
556//
557//
558// virtual void exchange(const ::atom & atom, ::i8 & ch) { stream_exchange(atom, ch); }
559// virtual void exchange(const ::atom & atom, uchar & uch) { stream_exchange(atom, uch); }
560// virtual void exchange(const ::atom & atom, ::i8 & i) { stream_exchange(atom, i); }
561// virtual void exchange(const ::atom & atom, ::i16 & i) { stream_exchange(atom, i); }
562// virtual void exchange(const ::atom & atom, ::u16 & u) { stream_exchange(atom, u); }
563//#ifdef WINDOWS
564// virtual void exchange(const ::atom & atom, unichar & wch) { stream_exchange(atom, wch); }
565//#endif
566// virtual void exchange(const ::atom & atom, bool & b) { stream_exchange(atom, b); }
567// virtual void exchange(const ::atom & atom, ::i32 & i) { stream_exchange(atom, i); }
568// virtual void exchange(const ::atom & atom, ::u32 & u) { stream_exchange(atom, u); }
569// virtual void exchange(const ::atom & atom, ::i64 & i) { stream_exchange(atom, i); }
570// virtual void exchange(const ::atom & atom, ::u64 & u) { stream_exchange(atom, u); }
571//#if defined(__APPLE__) || defined(__ANDROID__) || defined(WINDOWS) || defined(RASPBERRYPIOS)
572// virtual void exchange(const ::atom & atom, ulong & ul) { stream_exchange(atom, ul); }
573// virtual void exchange(const ::atom & atom, long & l) { stream_exchange(atom, l); }
574// //inline void exchange(const ::atom & atom, ::i64 & hi);
575//#endif
576// virtual void exchange(const ::atom & atom, ::f32 & f) { stream_exchange(atom, f); }
577// virtual void exchange(const ::atom & atom, ::f64 & d) { stream_exchange(atom, d); }
578// virtual void exchange(const ::atom & atom, ::i32_point & point) { stream_exchange(atom, point); }
579// virtual void exchange(const ::atom & atom, ::i32_size & size) { stream_exchange(atom, size); }
580// virtual void exchange(const ::atom & atom, ::i32_rectangle & crect) { stream_exchange(atom, crect); }
581// virtual void exchange(const ::atom & atom, ::f64_point& point) { stream_exchange(atom, point); }
582// virtual void exchange(const ::atom & atom, ::f64_size& size) { stream_exchange(atom, size); }
583// virtual void exchange(const ::atom & atom, ::f64_rectangle& crect) { stream_exchange(atom, crect); }
584// virtual void exchange(const ::atom & atom, const ::scoped_string & scopedstr);
585//#ifdef WINDOWS
586// virtual void exchange(const ::atom & atom, const wide_character * wch);
587//#endif
588// virtual void exchange(const ::atom & atom, ::atom & idExchange);
589// virtual void exchange(const ::atom & atom, ::payload & payload);
590// virtual void exchange(const ::atom & atom, property & property);
591// virtual void exchange(const ::atom & atom, string & str) ;
592// virtual void exchange(const ::atom & atom, ::particle * pparticle);
593// virtual void exchange(const ::atom & atom, ::matter & matter);
594// virtual void exchange(const ::atom & atom, ::property_set & set);
595// virtual void exchange(const ::atom & atom, block & block);
596//
597//
598// virtual void getline(char_pointer sz, character_count n) ;
599// ::i32 get();
600// ::i32 peek();
601//
605//
606// ::filesize get_left() const;
607//
608// //inline bool is_storing() const { return m_bStoring; }
609// //inline bool is_loading() const { return !m_bStoring; }
610//
611//
612// //virtual void write_file(const ::file::path & path, const ::matter & matter);
613// //virtual void read_file(const ::file::path & path, ::matter & matter);
614//
615// //virtual void write_link(const ::scoped_string & scopedstrLink, ::pointer<::matter>& matter);
616// //virtual void read_link(const ::scoped_string & scopedstrLink, ::pointer<::matter>& matter);
617//
618// //virtual void write_link(const ::matter * preference, const ::scoped_string & scopedstrLink, bool bReadOnly, ::matter * pobjectSaveOptions = nullptr);
619//
620// //virtual bool write_link(const ::matter * preference);
621// //virtual void read_link(::matter * preference);
622//
623//
624// //virtual bool get_object_link(const ::matter * preference, string & strLink, bool & bReadOnly);
625// //virtual void set_object_link(const ::matter * preference, const ::scoped_string & scopedstrLink, bool bReadOnly);
626//
627//
628// //virtual ::file::path get_link_path(const ::scoped_string & scopedstrLink);
629//
630// bool is_version(::collection::index i);
631//
632// template < typename BLOCK_TYPE >
633// inline void raw_write(const BLOCK_TYPE & t) // must be POD type // block transfer // classes/structures with no virtual members
634// {
635//
636// write(&t, sizeof(t));
637//
638// }
639//
640//
641// //template < typename BLOCK_TYPE >
642// //inline void raw_read(BLOCK_TYPE & t) // must be POD type // block transfer // classes/structures with no virtual members
643// //{
644//
645// // full_read(&t, sizeof(t));
646//
647// //}
648//
649//
650// //inline void full_read(void * pdata, memsize nCount)
651// //{
652//
653// // if (!fail())
654// // {
655//
656// // if (m_p->read(pdata, nCount) !=nCount)
657// // {
658//
659// // set_fail_bit();
660//
661// // }
662//
663// // }
664//
665// //}
666//
667//
668// //void xml_export(const ::xml::exportable & xmlexportable);
669//
670// //void xml_import(::xml::importable & xmlimportable);
671//
672//
673// template < typename BASE_TYPE >
674// inline binary_stream & save_object(const BASE_TYPE * pparticle);
675//
676// template < typename BASE_TYPE >
677// inline ::pointer<BASE_TYPE>load_object();
678//
679// virtual ::pointer<::matter>create_object_from_text(const ::scoped_string & scopedstrText);
680//
681//
682//
683//};
684
685
686//stream_stack::stream_stack(binary_stream * pstreamStack, const ::atom & atom)
687//{
688//
689// m_pstream = pstreamStack->branch(atom);
690//
691//}
692
693//
694//template < typename BASE_TYPE >
695//::pointer<BASE_TYPE>__load_object(binary_stream & binary_stream);
696//
697
698
699//
700//inline binary_stream & operator << (binary_stream & os, binary_stream & (*pfnSimpleOutput)(binary_stream &))
701//{
702//
703// (*pfnSimpleOutput)(os);
704//
705//}
706
707
708//namespace std
709//{
710//
711//
712// inline binary_stream & endl(binary_stream & os)
713// {
714//
715// os.put('\n');
716//
717// os.flush();
718//
719// return os;
720//
721// }
722//
723//
724//} // namespace std
725//
726//
727
728//
729//
730//inline binary_stream & operator >> (binary_stream & s, ::i32 & i) { s.read(i); return s; }
731//
732//inline binary_stream & operator >> (binary_stream & s, ::u32 & u) { s.read(u); return s; }
733//
734//inline binary_stream & operator >> (binary_stream & s, ::i64 & i) { s.read(i); return s; }
735//
736//inline binary_stream & operator >> (binary_stream & s, ::u64 & u) { s.read(u); return s; }
737//
738//#ifdef __APPLE__
739//
740//inline binary_stream & operator >> (binary_stream & s, ulong & u) { s.read(u); return s; }
741//
742//#endif
743//
744//inline binary_stream & operator >> (binary_stream & s, ::f32 & f) { s.read(f); return s; }
745//
746//inline binary_stream & operator >> (binary_stream & s, ::f64 & d) { s.read(d); return s; }
747//
748//inline binary_stream & operator >> (binary_stream & s, ::i32_point & point) { s.read(point); return s; }
749//
750//inline binary_stream & operator >> (binary_stream & s, ::i32_size & size) { s.read(size); return s; }
751//
752//inline binary_stream & operator >> (binary_stream & s, ::i32_rectangle & rectangle) { s.read(rectangle); return s; }
753//
754//inline binary_stream & operator >> (binary_stream & s, ::atom & atom) { s.read(atom); return s; }
755//
756//inline binary_stream & operator >> (binary_stream & s, ::payload & payload) { s.read(payload); return s; }
757//
758//inline binary_stream & operator >> (binary_stream & s, property & property) { s.read(property); return s; }
759//
760//inline binary_stream & operator >> (binary_stream & s, string & str) { s.read(str); return s; }
761//
762//inline binary_stream & operator >> (binary_stream & s, block & block) { s.read(block); return s; }
763//
765
766//
767//inline binary_stream & operator >> (binary_stream & s, bool & b) { s.read(b); return s; }
768//
769//inline binary_stream & operator >> (binary_stream & s, ::i8 & ch) { s.read(ch); return s; }
770//
771//inline binary_stream & operator >> (binary_stream & s, uchar & uch) { s.read(uch); return s; }
772//
773//#if defined(WINDOWS)
774//
775//inline binary_stream & operator >> (binary_stream & s, ::wd16_character & wch) { s.read(wch); return s; }
776//
777//#else
778//
779//inline binary_stream & operator >> (binary_stream & s, ::wd32_character & wch) { s.read(wch); return s; }
780//
781//#endif
782//
783//inline binary_stream & operator >> (binary_stream & s, ::i8 & i) { s.read(i); return s; }
784//
785//inline binary_stream & operator >> (binary_stream & s, ::i16 & i) { s.read(i); return s; }
786//
787//inline binary_stream & operator >> (binary_stream & s, ::u16 & u) { s.read(u); return s; }
788//
789//inline binary_stream & operator >> (binary_stream & s, e_set_loading) { s->set_loading(); return s; }
790//
791//template < class KEY, class ARG_KEY, class PAYLOAD, class ARG_VALUE, class PAIR >
792//inline binary_stream & operator >>(binary_stream & s, map_base < KEY, ARG_KEY, PAYLOAD, ARG_VALUE, PAIR > & m);
793//
794//template < typename TYPE >
795//inline binary_stream & operator >>(binary_stream & s, pointer_array < TYPE > & a);
796//
797//inline binary_stream & operator >> (binary_stream & s, ::file::path & path);
798//
799//inline binary_stream & operator >> (binary_stream & s, class ::time & class ::time);
800//
801//inline binary_stream & operator << (binary_stream & s, const ::file::path & path);
802//
803//inline binary_stream & operator << (binary_stream & s, const ::scoped_string & scopedstr) { s.write(str); return s; }
804//
805//inline binary_stream & operator << (binary_stream & s, e_set_storing) { s->set_storing(); s; }
806//
807//inline binary_stream & operator << (binary_stream & s, ::i8 ch) { s.write(ch); return s; }
808//
809//inline binary_stream & operator << (binary_stream & s, uchar uch) { s.write(uch); return s; }
810//
811//inline binary_stream & operator << (binary_stream & s, ::i8 sh) { s.write(sh); return s; }
812//
813//inline binary_stream & operator << (binary_stream & s, ::i16 sh) { s.write(sh); return s; }
814//
815//inline binary_stream & operator << (binary_stream & s, ::u16 u) { s.write(u); return s; }
816//
817//#ifdef WINDOWS
818//
819//inline binary_stream & operator << (binary_stream & s, unichar wch) { s.write(wch); return s; }
820//
821//#endif
822//
823//inline binary_stream & operator << (binary_stream & s, bool b) { s.write(b); return s; }
824//
825//inline binary_stream & operator << (binary_stream & s, ::i32 i) { s.write(i); return s; }
826//
827//inline binary_stream & operator << (binary_stream & s, ::u32 u) { s.write(u); return s; }
828//
829//inline binary_stream & operator << (binary_stream & s, ::i64 i) { s.write(i); return s; }
830//
831//inline binary_stream & operator << (binary_stream & s, ::u64 u) { s.write(u); return s; }
832//
833//#if defined(__APPLE__)
834//
835//inline binary_stream & operator << (binary_stream & s, const ulong u) { s.write(u); return s; }
836//
837//#endif
838//
839//inline binary_stream & operator << (binary_stream & s, ::f32 f) { s.write(f); return s; }
840//
841//inline binary_stream & operator << (binary_stream & s, ::f64 d) { s.write(d); return s; }
842//
843//inline binary_stream & operator << (binary_stream & s, const ::i32_point & point) { s.write(point); return s; }
844//
845//inline binary_stream & operator << (binary_stream & s, const ::i32_rectangle &rectangle) { s.write(rectangle); return s; }
846//
847//inline binary_stream & operator << (binary_stream & s, const ::i32_size & size) { s.write(size); return s; }
848//
849//inline binary_stream & operator << (binary_stream & s, const ::scoped_string & scopedstr) { s.write(scopedstr); return s; }
850//
851//inline binary_stream & operator << (binary_stream & s, const atom & atom) { s.write(atom); return s; }
852//
853//inline binary_stream & operator << (binary_stream & s, const ::payload & payload) { s.write(payload); return s; }
854//
855//inline binary_stream & operator << (binary_stream & s, const property & property) { s.write(property); return s; }
856//
857//inline binary_stream & operator << (binary_stream & s, const ::particle * pparticle) { s.write(pparticle); return s; }
858//
859//inline binary_stream & operator << (binary_stream & s, const ::matter & matter) { s.write(matter); return s; }
860//
861//inline binary_stream & operator << (binary_stream & s, const block & block) { s.write(block); return s; }
862//
863//inline binary_stream & operator << (binary_stream & s, e_str_flag eflag) { s.m_estrflag = (e_str_flag)((::i32)s.m_estrflag | (::i32)eflag); return s; }
864//
865//inline binary_stream & operator << (binary_stream & s, const ::file::set_width & w) { s.width(w.m_width); return s; }
866//
867
868
869//
870//template < class KEY, class ARG_KEY, class PAYLOAD, class ARG_VALUE, class PAIR >
871//inline binary_stream & operator <<(binary_stream & s, const map_base < KEY, ARG_KEY, PAYLOAD, ARG_VALUE, PAIR > & m);
872//
873//template < typename TYPE >
874//inline binary_stream & operator <<(binary_stream & s, const pointer_array < TYPE > & a);
875//
876//inline binary_stream & operator <<(binary_stream & s, const class time & time);
877//inline binary_stream & operator >>(binary_stream & s, class ::time & time);
878
879
880
881//
882//inline binary_stream & operator << (binary_stream & s, ::file::file * pfile);
883//
884//
885//
886//inline binary_stream & operator << (binary_stream & s, ::file_pointer & pfile)
887//{
888//
889// operator << (s, pfile.m_p);
890//
891//}
892//inline binary_stream & operator <<(binary_stream & s, const ::earth::time & time);
895//inline binary_stream & operator >>(binary_stream & s, ::earth::time & time);
896//inline binary_stream & operator >>(binary_stream & s, ::earth::zone_time & z);
897//
898//
899//
900//inline binary_stream & operator <<(binary_stream & s, const ::earth::zone_time & z);
901//
902//
903//
904//inline binary_stream & operator >>(binary_stream & s, class ::time & z);
905//
906//
907//
908//inline binary_stream & operator <<(binary_stream & s, const class ::time & z);
909//
910//
911//
912//inline binary_stream & operator >>(binary_stream & s, ::datetime::time_zone & z);
913//inline binary_stream & operator <<(binary_stream & s, const ::datetime::time_zone & z);
914//
915//
916//template < typename BASE_TYPE, typename SIZE_BASE_TYPE, typename RECTANGLE_BASE_TYPE >
917//inline binary_stream & operator << (binary_stream & s, const point_type < BASE_TYPE, SIZE_BASE_TYPE, RECTANGLE_BASE_TYPE > & point)
918//{
919//
920// s << point.x;
921// s << point.y;
922//
923// return s;
924//
925//}
926//
927//
928//
929//template < typename BASE_TYPE, typename SIZE_BASE_TYPE, typename RECTANGLE_BASE_TYPE >
930//inline binary_stream & operator >> (binary_stream & s, point_type < BASE_TYPE, SIZE_BASE_TYPE, RECTANGLE_BASE_TYPE > & point)
931//{
932// s >> point.x;
933// s >> point.y;
934// return s;
935//}
936//
937//
938//
939//template < typename BASE_TYPE, typename POINT_BASE_TYPE, typename RECTANGLE_BASE_TYPE >
940//inline binary_stream & operator << (binary_stream & s, const size_type < BASE_TYPE, POINT_BASE_TYPE, RECTANGLE_BASE_TYPE > & size)
941//{
942//
943// s << size.cx;
944// s << size.cy;
945//
946// return s;
947//
948//}
949//
950//
951//
952//template < typename BASE_TYPE, typename POINT_BASE_TYPE, typename RECTANGLE_BASE_TYPE >
953//inline binary_stream & operator >> (binary_stream & s, size_type < BASE_TYPE, POINT_BASE_TYPE, RECTANGLE_BASE_TYPE > & size)
954//{
955// s >> size.cx;
956// s >> size.cy;
957// return s;
958//}
959//
960//
962//
964//
965//
966//
967//template < typename BASE_TYPE, typename POINT_BASE_TYPE, typename SIZE_BASE_TYPE >
968//inline binary_stream & operator << (binary_stream & s, const rectangle_type < BASE_TYPE, POINT_BASE_TYPE, SIZE_BASE_TYPE > & rectangle)
969//{
970//
971// s << rectangle.left;
972// s << rectangle.top;
973// s << rectangle.right;
974// s << rectangle.bottom;
975//
976// return s;
977//
978//}
979//
980//
981//template < typename BASE_TYPE, typename POINT_BASE_TYPE, typename SIZE_BASE_TYPE >
982//inline binary_stream & operator >> (binary_stream & s, rectangle_type < BASE_TYPE, POINT_BASE_TYPE, SIZE_BASE_TYPE > & rectangle)
983//{
984//
985// s >> rectangle.left;
986// s >> rectangle.top;
987// s >> rectangle.right;
988// s >> rectangle.bottom;
989//
990// return s;
991//
992//}
993//
994//
995//