libDwm-0.6.0
DwmGZIO.hh
Go to the documentation of this file.
1 //===========================================================================
2 // @(#) $DwmPath: dwm/libDwm/tags/libDwm-0.6.0/include/DwmGZIO.hh 8401 $
3 // @(#) $Id: DwmGZIO.hh 8401 2016-04-17 06:44:31Z dwm $
4 //===========================================================================
5 // Copyright (c) Daniel W. McRobb 2004, 2016
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
10 // are met:
11 //
12 // 1. Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 // 2. Redistributions in binary form must reproduce the above copyright
15 // notice, this list of conditions and the following disclaimer in the
16 // documentation and/or other materials provided with the distribution.
17 // 3. The names of the authors and copyright holders may not be used to
18 // endorse or promote products derived from this software without
19 // specific prior written permission.
20 //
21 // IN NO EVENT SHALL DANIEL W. MCROBB BE LIABLE TO ANY PARTY FOR
22 // DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
23 // INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE,
24 // EVEN IF DANIEL W. MCROBB HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
25 // DAMAGE.
26 //
27 // THE SOFTWARE PROVIDED HEREIN IS ON AN "AS IS" BASIS, AND
28 // DANIEL W. MCROBB HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
29 // UPDATES, ENHANCEMENTS, OR MODIFICATIONS. DANIEL W. MCROBB MAKES NO
30 // REPRESENTATIONS AND EXTENDS NO WARRANTIES OF ANY KIND, EITHER
31 // IMPLIED OR EXPRESS, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32 // WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
33 // PURPOSE, OR THAT THE USE OF THIS SOFTWARE WILL NOT INFRINGE ANY PATENT,
34 // TRADEMARK OR OTHER RIGHTS.
35 //===========================================================================
36 
37 //---------------------------------------------------------------------------
40 //---------------------------------------------------------------------------
41 
42 #ifndef _DWMGZIO_HH_
43 #define _DWMGZIO_HH_
44 
45 extern "C" {
46  #include <inttypes.h>
47  #include <sys/types.h>
48 }
49 
50 #include <cstdio>
51 #include <deque>
52 #include <iostream>
53 #include <list>
54 #include <map>
55 #include <set>
56 #include <string>
57 #include <tuple>
58 #include <unordered_map>
59 #include <unordered_set>
60 #include <vector>
61 
62 #include "DwmPortability.hh"
63 #include "DwmGZReadable.hh"
64 #include "DwmGZWritable.hh"
65 
66 namespace Dwm {
67 
68  //--------------------------------------------------------------------------
80  //--------------------------------------------------------------------------
81  class GZIO
82  {
83  public:
84  //------------------------------------------------------------------------
87  //------------------------------------------------------------------------
88  static int Write(gzFile gzf, char c);
89 
90  //------------------------------------------------------------------------
93  //------------------------------------------------------------------------
94  static int Write(gzFile gzf, uint8_t c);
95 
96  //------------------------------------------------------------------------
100  //------------------------------------------------------------------------
101  static int Write(gzFile gzf, int16_t val);
102 
103  //------------------------------------------------------------------------
107  //------------------------------------------------------------------------
108  static int Write(gzFile gzf, uint16_t val);
109 
110  //------------------------------------------------------------------------
114  //------------------------------------------------------------------------
115  static int Write(gzFile gzf, int32_t val);
116 
117  //------------------------------------------------------------------------
121  //------------------------------------------------------------------------
122  static int Write(gzFile gzf, uint32_t val);
123 
124  //------------------------------------------------------------------------
128  //------------------------------------------------------------------------
129  static int Write(gzFile gzf, const int64_t & val);
130 
131  //------------------------------------------------------------------------
135  //------------------------------------------------------------------------
136  static int Write(gzFile gzf, const uint64_t & val);
137 
138  //------------------------------------------------------------------------
142  //------------------------------------------------------------------------
143  static int Write(gzFile gzf, float val);
144 
145  //------------------------------------------------------------------------
149  //------------------------------------------------------------------------
150  static int Write(gzFile gzf, const double & val);
151 
152  //------------------------------------------------------------------------
158  //------------------------------------------------------------------------
159  static int Write(gzFile gzf, const std::string & s);
160 
161  //------------------------------------------------------------------------
164  //------------------------------------------------------------------------
165  static int Read(gzFile gzf, char & c);
166 
167  //------------------------------------------------------------------------
170  //------------------------------------------------------------------------
171  static int Read(gzFile gzf, uint8_t & c);
172 
173  //------------------------------------------------------------------------
176  //------------------------------------------------------------------------
177  static int Read(gzFile gzf, int16_t & val);
178 
179  //------------------------------------------------------------------------
182  //------------------------------------------------------------------------
183  static int Read(gzFile gzf, uint16_t & val);
184 
185  //------------------------------------------------------------------------
188  //------------------------------------------------------------------------
189  static int Read(gzFile gzf, int32_t & val);
190 
191  //------------------------------------------------------------------------
194  //------------------------------------------------------------------------
195  static int Read(gzFile gzf, uint32_t & val);
196 
197  //------------------------------------------------------------------------
200  //------------------------------------------------------------------------
201  static int Read(gzFile gzf, int64_t & val);
202 
203  //------------------------------------------------------------------------
206  //------------------------------------------------------------------------
207  static int Read(gzFile gzf, uint64_t & val);
208 
209  //------------------------------------------------------------------------
213  //------------------------------------------------------------------------
214  static int Read(gzFile gzf, float & val);
215 
216  //------------------------------------------------------------------------
220  //------------------------------------------------------------------------
221  static int Read(gzFile gzf, double & val);
222 
223  //------------------------------------------------------------------------
228  //------------------------------------------------------------------------
229  static int Read(gzFile gzf, std::string & s);
230 
231  //------------------------------------------------------------------------
233  //------------------------------------------------------------------------
234  static int Write(gzFile gzf, const GZWritable & val)
235  {
236  return(val.Write(gzf));
237  }
238 
239  //------------------------------------------------------------------------
241  //------------------------------------------------------------------------
242  static int Read(gzFile gzf, GZReadable & val)
243  {
244  return(val.Read(gzf));
245  }
246 
247  //------------------------------------------------------------------------
250  //------------------------------------------------------------------------
251  template <typename _firstT, typename _secondT>
252  static int Read(gzFile gzf, std::pair<_firstT, _secondT> & p)
253  {
254  int rc = -1;
255  if (gzf) {
256  int bytesRead = Read(gzf, p.first);
257  if (bytesRead > 0) {
258  rc = bytesRead;
259  bytesRead = Read(gzf, p.second);
260  if (bytesRead > 0)
261  rc += bytesRead;
262  else
263  rc = -1;
264  }
265  }
266  return(rc);
267  }
268 
269  //------------------------------------------------------------------------
272  //------------------------------------------------------------------------
273  template <typename _firstT, typename _secondT>
274  static int Write(gzFile gzf, const std::pair<_firstT,_secondT> & p)
275  {
276  int rc = -1;
277  if (gzf) {
278  int bytesWritten = Write(gzf, p.first);
279  if (bytesWritten > 0) {
280  rc = bytesWritten;
281  bytesWritten = Write(gzf, p.second);
282  if (bytesWritten > 0) {
283  rc += bytesWritten;
284  }
285  else {
286  rc = -1;
287  }
288  }
289  }
290  return(rc);
291  }
292 
293  //------------------------------------------------------------------------
296  //------------------------------------------------------------------------
297  template <typename _keyT, typename _valueT,
298  typename _Compare, typename _Alloc>
299  static int Read(gzFile gzf, std::map<_keyT, _valueT, _Compare, _Alloc> & m)
300  {
301  return(PairAssocContRead<std::map<_keyT, _valueT, _Compare, _Alloc> >(gzf, m));
302  }
303 
304  //------------------------------------------------------------------------
307  //------------------------------------------------------------------------
308  template<typename _keyT, typename _valueT,
309  typename _Compare, typename _Alloc>
310  static int
311  Write(gzFile gzf, const std::map<_keyT,_valueT,_Compare,_Alloc> & m)
312  {
313  return(ContainerWrite<std::map<_keyT,_valueT,_Compare,_Alloc> >(gzf, m));
314  }
315 
316  //------------------------------------------------------------------------
319  //------------------------------------------------------------------------
320  template <typename _keyT, typename _valueT,
321  typename _Compare, typename _Alloc>
322  static int
323  Read(gzFile gzf, std::multimap<_keyT, _valueT, _Compare, _Alloc> & m)
324  {
325  return(PairAssocContRead<std::multimap<_keyT,_valueT,_Compare,_Alloc> >(gzf, m));
326  }
327 
328  //------------------------------------------------------------------------
331  //------------------------------------------------------------------------
332  template <typename _keyT, typename _valueT,
333  typename _Compare, typename _Alloc>
334  static int
335  Write(gzFile gzf, const std::multimap<_keyT,_valueT, _Compare, _Alloc> & m)
336  {
337  return(ContainerWrite<std::multimap<_keyT,_valueT,_Compare,_Alloc> >(gzf, m));
338  }
339 
340  //------------------------------------------------------------------------
343  //------------------------------------------------------------------------
344  template <typename _valueT, typename _Alloc>
345  static int Read(gzFile gzf, std::vector<_valueT, _Alloc> & v)
346  {
347  return(ContainerRead<std::vector<_valueT, _Alloc> >(gzf, v));
348  }
349 
350  //------------------------------------------------------------------------
353  //------------------------------------------------------------------------
354  template <typename _valueT, typename _Alloc>
355  static int Write(gzFile gzf, const std::vector<_valueT, _Alloc> & v)
356  {
357  return(ContainerWrite<std::vector<_valueT, _Alloc> >(gzf, v));
358  }
359 
360  //------------------------------------------------------------------------
363  //------------------------------------------------------------------------
364  template <typename _valueT, typename _Alloc>
365  static int Read(gzFile gzf, std::deque<_valueT, _Alloc> & d)
366  {
367  return(ContainerRead<std::deque<_valueT, _Alloc> >(gzf, d));
368  }
369 
370  //------------------------------------------------------------------------
373  //------------------------------------------------------------------------
374  template <typename _valueT, typename _Alloc>
375  static int Write(gzFile gzf, const std::deque<_valueT, _Alloc> & d)
376  {
377  return(ContainerWrite<std::deque<_valueT, _Alloc> >(gzf, d));
378  }
379 
380  //------------------------------------------------------------------------
383  //------------------------------------------------------------------------
384  template <typename _valueT, typename _Alloc>
385  static int Read(gzFile gzf, std::list<_valueT, _Alloc> & l)
386  {
387  return(ContainerRead<std::list<_valueT, _Alloc> >(gzf, l));
388  }
389 
390  //------------------------------------------------------------------------
393  //------------------------------------------------------------------------
394  template <typename _valueT, typename _Alloc>
395  static int Write(gzFile gzf, const std::list<_valueT, _Alloc> & l)
396  {
397  return(ContainerWrite<std::list<_valueT, _Alloc> >(gzf, l));
398  }
399 
400  //------------------------------------------------------------------------
403  //------------------------------------------------------------------------
404  template <typename _valueT, typename _Compare, typename _Alloc>
405  static int Read(gzFile gzf, std::set<_valueT, _Compare, _Alloc> & l)
406  {
407  return(ContainerRead<std::set<_valueT, _Compare, _Alloc> >(gzf, l));
408  }
409 
410  //------------------------------------------------------------------------
413  //------------------------------------------------------------------------
414  template <typename _valueT, typename _Compare, typename _Alloc>
415  static int Write(gzFile gzf, const std::set<_valueT, _Compare, _Alloc> & l)
416  {
417  return(ContainerWrite<std::set<_valueT, _Compare, _Alloc> >(gzf, l));
418  }
419 
420  //------------------------------------------------------------------------
423  //------------------------------------------------------------------------
424  template <typename _valueT, typename _Compare, typename _Alloc>
425  static int Read(gzFile gzf, std::multiset<_valueT, _Compare, _Alloc> & l)
426  {
427  return(ContainerRead<std::multiset<_valueT, _Compare, _Alloc> >(gzf, l));
428  }
429 
430  //------------------------------------------------------------------------
433  //------------------------------------------------------------------------
434  template <typename _valueT, typename _Compare, typename _Alloc>
435  static int
436  Write(gzFile gzf, const std::multiset<_valueT, _Compare, _Alloc> & l)
437  {
438  return(ContainerWrite<std::multiset<_valueT, _Compare, _Alloc> >(gzf, l));
439  }
440 
441  //------------------------------------------------------------------------
443  //------------------------------------------------------------------------
444  template <typename T, typename... Args>
445  static int Write(gzFile gzf, const std::tuple<T, Args...> & t)
446  {
447  return(WriteTuple<std::tuple<T, Args...> >(gzf, t));
448  }
449 
450  //------------------------------------------------------------------------
452  //------------------------------------------------------------------------
453  template <typename T, typename... Args>
454  static int Read(gzFile gzf, std::tuple<T, Args...> & t)
455  {
456  return(ReadTuple<std::tuple<T, Args...> >(gzf, t));
457  }
458 
459  //------------------------------------------------------------------------
461  //------------------------------------------------------------------------
462  template <typename T>
463  static int WriteTuple(gzFile gzf, const T & t)
464  {
465  return(TupleIOHelper<T,std::tuple_size<T>::value-1>::Write(gzf, t));
466  }
467 
468  //------------------------------------------------------------------------
470  //------------------------------------------------------------------------
471  template <typename T>
472  static int ReadTuple(gzFile gzf, T & t)
473  {
474  return(TupleIOHelper<T,std::tuple_size<T>::value-1>::Read(gzf, t));
475  }
476 
477  //------------------------------------------------------------------------
480  //------------------------------------------------------------------------
481  template<typename _keyT, typename _valueT, typename _Hash,
482  typename _Pred, typename _Alloc>
483  static int
484  Read(gzFile gzf, std::unordered_map<_keyT,_valueT,_Hash,_Pred,_Alloc> & hm)
485  {
486  return(PairAssocContRead<std::unordered_map<_keyT,_valueT,_Hash,_Pred,_Alloc> >(gzf, hm));
487  }
488 
489  //------------------------------------------------------------------------
492  //------------------------------------------------------------------------
493  template<typename _keyT, typename _valueT, typename _Hash,
494  typename _Pred, typename _Alloc>
495  static int
496  Write(gzFile gzf,
497  const std::unordered_map<_keyT,_valueT,_Hash,_Pred,_Alloc> & hm)
498  {
499  return(ContainerWrite<std::unordered_map<_keyT,_valueT,_Hash,_Pred,_Alloc> >(gzf, hm));
500  }
501 
502  //------------------------------------------------------------------------
505  //------------------------------------------------------------------------
506  template<typename _valueT, typename _Hash,
507  typename _Pred, typename _Alloc>
508  static int
509  Read(gzFile gzf, std::unordered_set<_valueT,_Hash,_Pred,_Alloc> & hm)
510  {
511  return(ContainerRead<std::unordered_set<_valueT,_Hash,_Pred,_Alloc> >(gzf, hm));
512  }
513 
514  //------------------------------------------------------------------------
517  //------------------------------------------------------------------------
518  template<typename _valueT, typename _Hash,
519  typename _Pred, typename _Alloc>
520  static int
521  Write(gzFile gzf,
522  const std::unordered_set<_valueT,_Hash,_Pred,_Alloc> & hm)
523  {
524  return(ContainerWrite<std::unordered_set<_valueT,_Hash,_Pred,_Alloc> >(gzf, hm));
525  }
526 
527  //------------------------------------------------------------------------
530  //------------------------------------------------------------------------
531  template<typename _keyT, typename _valueT, typename _Hash,
532  typename _Pred, typename _Alloc>
533  static int
534  Read(gzFile gzf, std::unordered_multimap<_keyT,_valueT,_Hash,_Pred,_Alloc> & hm)
535  {
536  return(PairAssocContRead<std::unordered_multimap<_keyT,_valueT,_Hash,_Pred,_Alloc> >(gzf, hm));
537  }
538 
539  //------------------------------------------------------------------------
542  //------------------------------------------------------------------------
543  template<typename _keyT, typename _valueT, typename _Hash,
544  typename _Pred, typename _Alloc>
545  static int
546  Write(gzFile gzf,
547  const std::unordered_multimap<_keyT,_valueT,_Hash,_Pred,_Alloc> & hm)
548  {
549  return(ContainerWrite<std::unordered_multimap<_keyT,_valueT,_Hash,_Pred,_Alloc> >(gzf, hm));
550  }
551 
552  //------------------------------------------------------------------------
555  //------------------------------------------------------------------------
556  template<typename _valueT, typename _Hash,
557  typename _Pred, typename _Alloc>
558  static int
559  Read(gzFile gzf, std::unordered_multiset<_valueT,_Hash,_Pred,_Alloc> & hm)
560  {
561  return(ContainerRead<std::unordered_multiset<_valueT,_Hash,_Pred,_Alloc> >(gzf, hm));
562  }
563 
564  //------------------------------------------------------------------------
567  //------------------------------------------------------------------------
568  template<typename _valueT, typename _Hash,
569  typename _Pred, typename _Alloc>
570  static int
571  Write(gzFile gzf,
572  const std::unordered_multiset<_valueT,_Hash,_Pred,_Alloc> & hm)
573  {
574  return(ContainerWrite<std::unordered_multiset<_valueT,_Hash,_Pred,_Alloc> >(gzf, hm));
575  }
576 
577  private:
578  //------------------------------------------------------------------------
580  //------------------------------------------------------------------------
581  template <typename _inputIteratorT>
582  static int Write(gzFile gzf, _inputIteratorT f, _inputIteratorT l)
583  {
584  int rc = 0;
585  if (gzf) {
586  for ( ; f != l; ++f) {
587  int bytesWritten = Write(gzf, *f);
588  if (bytesWritten > 0) {
589  rc += bytesWritten;
590  }
591  else {
592  rc = -1;
593  break;
594  }
595  }
596  }
597  return(rc);
598  }
599 
600  //------------------------------------------------------------------------
604  //------------------------------------------------------------------------
605  template <typename _containerT>
606  static int ContainerRead(gzFile gzf, _containerT & c)
607  {
608  if (! c.empty())
609  c.clear();
610  int rc = -1;
611  if (gzf) {
612  uint32_t numEntries;
613  int bytesRead = Read(gzf, numEntries);
614  if (bytesRead == sizeof(numEntries)) {
615  rc = bytesRead;
616  for (uint32_t i = 0; i < numEntries; ++i) {
617  typename _containerT::value_type val;
618  bytesRead = Read(gzf, val);
619  if (bytesRead > 0) {
620  rc += bytesRead;
621  c.insert(c.end(), val);
622  }
623  else {
624  rc = -1;
625  break;
626  }
627  }
628  }
629  }
630  return(rc);
631  }
632 
633  //------------------------------------------------------------------------
637  //------------------------------------------------------------------------
638  template <typename _containerT>
639  static int ContainerWrite(gzFile gzf, const _containerT & c)
640  {
641  int rc = -1;
642  if (gzf) {
643  uint32_t numEntries = c.size();
644  uint32_t bytesWritten = Write(gzf, numEntries);
645  if (bytesWritten == sizeof(numEntries)) {
646  rc = bytesWritten;
647  if (numEntries) {
648  bytesWritten =
649  Write<typename _containerT::const_iterator>(gzf,
650  c.begin(),
651  c.end());
652  if (bytesWritten > 0)
653  rc += bytesWritten;
654  else
655  rc = -1;
656  }
657  }
658  }
659  return(rc);
660  }
661 
662  //------------------------------------------------------------------------
666  //------------------------------------------------------------------------
667  template <typename _containerT>
668  static int PairAssocContRead(gzFile gzf, _containerT & m)
669  {
670  int rc = -1;
671  if (! m.empty())
672  m.clear();
673  if (gzf) {
674  uint32_t numEntries;
675  int bytesRead = Read(gzf, numEntries);
676  if (bytesRead == sizeof(numEntries)) {
677  rc = bytesRead;
678  for (uint32_t i = 0; i < numEntries; ++i) {
679  typename _containerT::key_type key;
680  bytesRead = Read(gzf, key);
681  if (bytesRead > 0) {
682  rc += bytesRead;
683  typename _containerT::mapped_type val;
684  bytesRead = Read(gzf, val);
685  if (bytesRead > 0) {
686  rc += bytesRead;
687  m.insert(typename _containerT::value_type(key, val));
688  }
689  else {
690  rc = -1;
691  break;
692  }
693  }
694  else {
695  rc = -1;
696  break;
697  }
698  }
699  }
700  }
701  return(rc);
702  }
703 
704  //------------------------------------------------------------------------
707  //------------------------------------------------------------------------
708  template <typename T, size_t elt>
709  class TupleIOHelper;
710 
711  //------------------------------------------------------------------------
713  //------------------------------------------------------------------------
714  template <typename T>
715  class TupleIOHelper<T, 0>
716  {
717  public:
718  //----------------------------------------------------------------------
720  //----------------------------------------------------------------------
721  static int Write(gzFile gzf, const T & t)
722  {
723  return(GZIO::Write(gzf, std::get<0>(t)));
724  }
725 
726  //----------------------------------------------------------------------
728  //----------------------------------------------------------------------
729  static int Read(gzFile gzf, T & t)
730  {
731  return(GZIO::Read(gzf, std::get<0>(t)));
732  }
733  };
734 
735  //------------------------------------------------------------------------
737  //------------------------------------------------------------------------
738  template <typename T, size_t elt>
739  class TupleIOHelper
740  {
741  public:
742  //----------------------------------------------------------------------
744  //----------------------------------------------------------------------
745  static int Write(gzFile gzf, const T & t)
746  {
747  int rc = TupleIOHelper<T,elt-1>::Write(gzf, t);
748  if (rc > 0) {
749  int rcr = GZIO::Write(gzf, std::get<elt>(t));
750  if (rcr > 0) {
751  rc += rcr;
752  }
753  else {
754  rc = -1;
755  }
756  }
757  return(rc);
758  }
759 
760  //----------------------------------------------------------------------
762  //----------------------------------------------------------------------
763  static int Read(gzFile gzf, T & t)
764  {
765  int rc = TupleIOHelper<T,elt-1>::Read(gzf, t);
766  if (rc > 0) {
767  int rcr = GZIO::Read(gzf, std::get<elt>(t));
768  if (rcr > 0) {
769  rc += rcr;
770  }
771  else {
772  rc = -1;
773  }
774  }
775  return(rc);
776  }
777 
778  };
779 
780  };
781 
782 } // namespace Dwm
783 
784 #endif // _DWMGZIO_HH_
785 
786 //---------------------------- emacs settings -----------------------------
787 // Local Variables:
788 // mode: C++
789 // tab-width: 2
790 // indent-tabs-mode: nil
791 // c-basic-offset: 2
792 // End:
793 //-------------------------------------------------------------------------
static int Read(gzFile gzf, std::set< _valueT, _Compare, _Alloc > &l)
Reads a set<_valueT> from a gzFile.
Definition: DwmGZIO.hh:405
static int Write(gzFile gzf, const std::unordered_map< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm)
Writes an unordered_map to a gzFile.
Definition: DwmGZIO.hh:496
This class is a pure virtual class, defining an interface for classes that can write their contents t...
Definition: DwmGZWritable.hh:57
static int Read(gzFile gzf, std::pair< _firstT, _secondT > &p)
Reads a pair<_firstT,_secondT> from a gzFile.
Definition: DwmGZIO.hh:252
static int Write(gzFile gzf, const GZWritable &val)
Wrapper function to write a GZWritable object to a gzFile.
Definition: DwmGZIO.hh:234
static int Read(gzFile gzf, std::unordered_set< _valueT, _Hash, _Pred, _Alloc > &hm)
Reads an unordered_set from a gzFile.
Definition: DwmGZIO.hh:509
Dwm::GZReadable pure virtual class definition.
static int Read(gzFile gzf, std::list< _valueT, _Alloc > &l)
Reads a list<_valueT> from a gzFile.
Definition: DwmGZIO.hh:385
static int Write(gzFile gzf, const std::vector< _valueT, _Alloc > &v)
Writes a vector<_valueT> to a gzFile.
Definition: DwmGZIO.hh:355
static int Read(gzFile gzf, std::multimap< _keyT, _valueT, _Compare, _Alloc > &m)
Reads a multimap<_keyT,_valueT> from a gzFile.
Definition: DwmGZIO.hh:323
static int Write(gzFile gzf, const std::unordered_set< _valueT, _Hash, _Pred, _Alloc > &hm)
Writes an unordered_set to a gzFile.
Definition: DwmGZIO.hh:521
static int WriteTuple(gzFile gzf, const T &t)
T must be a tuple, n is the number of elements.
Definition: DwmGZIO.hh:463
virtual int Read(gzFile gzf)=0
Read from a gzFile.
virtual int Write(gzFile gzf) const =0
Write to a gzFile.
static int Write(gzFile gzf, const std::deque< _valueT, _Alloc > &d)
Writes a deque<_valueT> to a gzFile.
Definition: DwmGZIO.hh:375
static int Write(gzFile gzf, char c)
Writes c to gzf.
static int Read(gzFile gzf, char &c)
Reads from gzf.
This class contains a collection of static functions for reading and writing simple types in network ...
Definition: DwmGZIO.hh:81
static int Write(gzFile gzf, const std::list< _valueT, _Alloc > &l)
Writes a list<_valueT> to a gzFile.
Definition: DwmGZIO.hh:395
static int Read(gzFile gzf, GZReadable &val)
Wrapper function to read a GZReadable object from a gzFile.
Definition: DwmGZIO.hh:242
Definition: DwmBZ2IO.hh:67
This class is a pure virtual class, defining an interface for classes that can read their contents fr...
Definition: DwmGZReadable.hh:57
static int Write(gzFile gzf, const std::unordered_multiset< _valueT, _Hash, _Pred, _Alloc > &hm)
Writes an unordered_multiset to a gzFile.
Definition: DwmGZIO.hh:571
static int Write(gzFile gzf, const std::multiset< _valueT, _Compare, _Alloc > &l)
Writes a multiset<_valueT> to a gzFile.
Definition: DwmGZIO.hh:436
static int Write(gzFile gzf, const std::multimap< _keyT, _valueT, _Compare, _Alloc > &m)
Writes a multimap<_keyT,_valueT> to a gzFile.
Definition: DwmGZIO.hh:335
static int Read(gzFile gzf, std::vector< _valueT, _Alloc > &v)
Reads a vector<_valueT> from a gzFile.
Definition: DwmGZIO.hh:345
static int Read(gzFile gzf, std::multiset< _valueT, _Compare, _Alloc > &l)
Reads a multiset<_valueT> from a gzFile.
Definition: DwmGZIO.hh:425
static int Read(gzFile gzf, std::deque< _valueT, _Alloc > &d)
Reads a deque<_valueT> from a gzFile.
Definition: DwmGZIO.hh:365
Dwm::GZWritable pure virtual class definition.
static int Write(gzFile gzf, const std::set< _valueT, _Compare, _Alloc > &l)
Writes a set<_valueT> to a gzFile.
Definition: DwmGZIO.hh:415
static int ReadTuple(gzFile gzf, T &t)
T must be a tuple, n is the number of elements.
Definition: DwmGZIO.hh:472
static int Write(gzFile gzf, const std::unordered_multimap< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm)
Writes an unordered_multimap to a gzFile.
Definition: DwmGZIO.hh:546
static int Read(gzFile gzf, std::unordered_map< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm)
Reads an unordered_map from a gzFile.
Definition: DwmGZIO.hh:484
static int Write(gzFile gzf, const std::pair< _firstT, _secondT > &p)
Writes a pair<_firstT,_secondT> to a gzFile.
Definition: DwmGZIO.hh:274
static int Read(gzFile gzf, std::unordered_multimap< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm)
Reads an unordered_multimap from a gzFile.
Definition: DwmGZIO.hh:534
static int Read(gzFile gzf, std::map< _keyT, _valueT, _Compare, _Alloc > &m)
Reads a map<_keyT,_valueT> from a gzFile.
Definition: DwmGZIO.hh:299
static int Write(gzFile gzf, const std::map< _keyT, _valueT, _Compare, _Alloc > &m)
Writes a map<_keyT,_valueT> to a gzFile.
Definition: DwmGZIO.hh:311
A configure target for dealing with OS differences.
static int Read(gzFile gzf, std::unordered_multiset< _valueT, _Hash, _Pred, _Alloc > &hm)
Reads an unordered_multiset from a gzFile.
Definition: DwmGZIO.hh:559