libDwm-0.6.0
DwmBZ2IO.hh
Go to the documentation of this file.
1 //===========================================================================
2 // @(#) $DwmPath: dwm/libDwm/tags/libDwm-0.6.0/include/DwmBZ2IO.hh 8401 $
3 // @(#) $Id: DwmBZ2IO.hh 8401 2016-04-17 06:44:31Z dwm $
4 //===========================================================================
5 // Copyright (c) Daniel W. McRobb 2004-2006, 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 _DWMBZ2IO_HH_
43 #define _DWMBZ2IO_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 
64 #include "DwmBZ2Readable.hh"
65 #include "DwmBZ2Writable.hh"
66 
67 namespace Dwm {
68 
69  //--------------------------------------------------------------------------
81  //--------------------------------------------------------------------------
82  class BZ2IO
83  {
84  public:
85  //------------------------------------------------------------------------
88  //------------------------------------------------------------------------
89  static int BZWrite(BZFILE *bzf, char c);
90 
91  //------------------------------------------------------------------------
94  //------------------------------------------------------------------------
95  static int BZWrite(BZFILE *bzf, uint8_t c);
96 
97  //------------------------------------------------------------------------
101  //------------------------------------------------------------------------
102  static int BZWrite(BZFILE *bzf, int16_t val);
103 
104  //------------------------------------------------------------------------
108  //------------------------------------------------------------------------
109  static int BZWrite(BZFILE *bzf, uint16_t val);
110 
111  //------------------------------------------------------------------------
115  //------------------------------------------------------------------------
116  static int BZWrite(BZFILE *bzf, int32_t val);
117 
118  //------------------------------------------------------------------------
122  //------------------------------------------------------------------------
123  static int BZWrite(BZFILE *bzf, uint32_t val);
124 
125  //------------------------------------------------------------------------
129  //------------------------------------------------------------------------
130  static int BZWrite(BZFILE *bzf, const int64_t & val);
131 
132  //------------------------------------------------------------------------
136  //------------------------------------------------------------------------
137  static int BZWrite(BZFILE *bzf, const uint64_t & val);
138 
139  //------------------------------------------------------------------------
143  //------------------------------------------------------------------------
144  static int BZWrite(BZFILE *bzf, float val);
145 
146  //------------------------------------------------------------------------
150  //------------------------------------------------------------------------
151  static int BZWrite(BZFILE *bzf, const double & val);
152 
153  //------------------------------------------------------------------------
159  //------------------------------------------------------------------------
160  static int BZWrite(BZFILE *bzf, const std::string & s);
161 
162  //------------------------------------------------------------------------
165  //------------------------------------------------------------------------
166  static int BZRead(BZFILE *bzf, char & c);
167 
168  //------------------------------------------------------------------------
171  //------------------------------------------------------------------------
172  static int BZRead(BZFILE *bzf, uint8_t & c);
173 
174  //------------------------------------------------------------------------
177  //------------------------------------------------------------------------
178  static int BZRead(BZFILE *bzf, int16_t & val);
179 
180  //------------------------------------------------------------------------
183  //------------------------------------------------------------------------
184  static int BZRead(BZFILE *bzf, uint16_t & val);
185 
186  //------------------------------------------------------------------------
189  //------------------------------------------------------------------------
190  static int BZRead(BZFILE *bzf, int32_t & val);
191 
192  //------------------------------------------------------------------------
195  //------------------------------------------------------------------------
196  static int BZRead(BZFILE *bzf, uint32_t & val);
197 
198  //------------------------------------------------------------------------
201  //------------------------------------------------------------------------
202  static int BZRead(BZFILE *bzf, int64_t & val);
203 
204  //------------------------------------------------------------------------
207  //------------------------------------------------------------------------
208  static int BZRead(BZFILE *bzf, uint64_t & val);
209 
210  //------------------------------------------------------------------------
214  //------------------------------------------------------------------------
215  static int BZRead(BZFILE *bzf, float & val);
216 
217  //------------------------------------------------------------------------
221  //------------------------------------------------------------------------
222  static int BZRead(BZFILE *bzf, double & val);
223 
224  //------------------------------------------------------------------------
229  //------------------------------------------------------------------------
230  static int BZRead(BZFILE *bzf, std::string & s);
231 
232  //------------------------------------------------------------------------
234  //------------------------------------------------------------------------
235  static int BZWrite(BZFILE *bzf, const BZ2Writable & val)
236  {
237  return(val.BZWrite(bzf));
238  }
239 
240  //------------------------------------------------------------------------
242  //------------------------------------------------------------------------
243  static int BZRead(BZFILE *bzf, BZ2Readable & val)
244  {
245  return(val.BZRead(bzf));
246  }
247 
248  //------------------------------------------------------------------------
251  //------------------------------------------------------------------------
252  template <typename _firstT, typename _secondT>
253  static int BZRead(BZFILE *bzf, std::pair<_firstT, _secondT> & p)
254  {
255  int rc = -1;
256  if (bzf) {
257  int bytesRead = BZRead(bzf, p.first);
258  if (bytesRead > 0) {
259  rc = bytesRead;
260  bytesRead = BZRead(bzf, p.second);
261  if (bytesRead > 0)
262  rc += bytesRead;
263  else
264  rc = -1;
265  }
266  }
267  return(rc);
268  }
269 
270  //------------------------------------------------------------------------
273  //------------------------------------------------------------------------
274  template <typename _firstT, typename _secondT>
275  static int BZWrite(BZFILE *bzf, const std::pair<_firstT,_secondT> & p)
276  {
277  int rc = -1;
278  if (bzf) {
279  int bytesWritten = BZWrite(bzf, p.first);
280  if (bytesWritten > 0) {
281  rc = bytesWritten;
282  bytesWritten = BZWrite(bzf, p.second);
283  if (bytesWritten > 0) {
284  rc += bytesWritten;
285  }
286  else {
287  rc = -1;
288  }
289  }
290  }
291  return(rc);
292  }
293 
294  //------------------------------------------------------------------------
297  //------------------------------------------------------------------------
298  template <typename _keyT, typename _valueT,
299  typename _Compare, typename _Alloc>
300  static int BZRead(BZFILE *bzf, std::map<_keyT, _valueT, _Compare, _Alloc> & m)
301  {
302  return(PairAssocContBZRead<std::map<_keyT, _valueT, _Compare, _Alloc> >(bzf, m));
303  }
304 
305  //------------------------------------------------------------------------
308  //------------------------------------------------------------------------
309  template<typename _keyT, typename _valueT,
310  typename _Compare, typename _Alloc>
311  static int
312  BZWrite(BZFILE *bzf, const std::map<_keyT,_valueT,_Compare,_Alloc> & m)
313  {
314  return(ContainerBZWrite<std::map<_keyT,_valueT,_Compare,_Alloc> >(bzf, m));
315  }
316 
317  //------------------------------------------------------------------------
320  //------------------------------------------------------------------------
321  template <typename _keyT, typename _valueT,
322  typename _Compare, typename _Alloc>
323  static int
324  BZRead(BZFILE *bzf, std::multimap<_keyT, _valueT, _Compare, _Alloc> & m)
325  {
326  return(PairAssocContBZRead<std::multimap<_keyT,_valueT,_Compare,_Alloc> >(bzf, m));
327  }
328 
329  //------------------------------------------------------------------------
332  //------------------------------------------------------------------------
333  template <typename _keyT, typename _valueT,
334  typename _Compare, typename _Alloc>
335  static int
336  BZWrite(BZFILE *bzf, const std::multimap<_keyT,_valueT, _Compare, _Alloc> & m)
337  {
338  return(ContainerBZWrite<std::multimap<_keyT,_valueT,_Compare,_Alloc> >(bzf, m));
339  }
340 
341  //------------------------------------------------------------------------
344  //------------------------------------------------------------------------
345  template <typename _valueT, typename _Alloc>
346  static int BZRead(BZFILE *bzf, std::vector<_valueT, _Alloc> & v)
347  {
348  return(ContainerBZRead<std::vector<_valueT, _Alloc> >(bzf, v));
349  }
350 
351  //------------------------------------------------------------------------
354  //------------------------------------------------------------------------
355  template <typename _valueT, typename _Alloc>
356  static int BZWrite(BZFILE *bzf, const std::vector<_valueT, _Alloc> & v)
357  {
358  return(ContainerBZWrite<std::vector<_valueT, _Alloc> >(bzf, v));
359  }
360 
361  //------------------------------------------------------------------------
364  //------------------------------------------------------------------------
365  template <typename _valueT, typename _Alloc>
366  static int BZRead(BZFILE *bzf, std::deque<_valueT, _Alloc> & d)
367  {
368  return(ContainerBZRead<std::deque<_valueT, _Alloc> >(bzf, d));
369  }
370 
371  //------------------------------------------------------------------------
374  //------------------------------------------------------------------------
375  template <typename _valueT, typename _Alloc>
376  static int BZWrite(BZFILE *bzf, const std::deque<_valueT, _Alloc> & d)
377  {
378  return(ContainerBZWrite<std::deque<_valueT, _Alloc> >(bzf, d));
379  }
380 
381  //------------------------------------------------------------------------
384  //------------------------------------------------------------------------
385  template <typename _valueT, typename _Alloc>
386  static int BZRead(BZFILE *bzf, std::list<_valueT, _Alloc> & l)
387  {
388  return(ContainerBZRead<std::list<_valueT, _Alloc> >(bzf, l));
389  }
390 
391  //------------------------------------------------------------------------
394  //------------------------------------------------------------------------
395  template <typename _valueT, typename _Alloc>
396  static int BZWrite(BZFILE *bzf, const std::list<_valueT, _Alloc> & l)
397  {
398  return(ContainerBZWrite<std::list<_valueT, _Alloc> >(bzf, l));
399  }
400 
401  //------------------------------------------------------------------------
404  //------------------------------------------------------------------------
405  template <typename _valueT, typename _Compare, typename _Alloc>
406  static int BZRead(BZFILE *bzf, std::set<_valueT, _Compare, _Alloc> & l)
407  {
408  return(ContainerBZRead<std::set<_valueT, _Compare, _Alloc> >(bzf, l));
409  }
410 
411  //------------------------------------------------------------------------
414  //------------------------------------------------------------------------
415  template <typename _valueT, typename _Compare, typename _Alloc>
416  static int BZWrite(BZFILE *bzf, const std::set<_valueT, _Compare, _Alloc> & l)
417  {
418  return(ContainerBZWrite<std::set<_valueT, _Compare, _Alloc> >(bzf, l));
419  }
420 
421  //------------------------------------------------------------------------
424  //------------------------------------------------------------------------
425  template <typename _valueT, typename _Compare, typename _Alloc>
426  static int BZRead(BZFILE *bzf, std::multiset<_valueT, _Compare, _Alloc> & l)
427  {
428  return(ContainerBZRead<std::multiset<_valueT, _Compare, _Alloc> >(bzf, l));
429  }
430 
431  //------------------------------------------------------------------------
434  //------------------------------------------------------------------------
435  template <typename _valueT, typename _Compare, typename _Alloc>
436  static int
437  BZWrite(BZFILE *bzf, const std::multiset<_valueT, _Compare, _Alloc> & l)
438  {
439  return(ContainerBZWrite<std::multiset<_valueT, _Compare, _Alloc> >(bzf, l));
440  }
441 
442  //========================================================================
443  // gcc-4.3.x has variadic template support.
444  //========================================================================
445 
446  //------------------------------------------------------------------------
448  //------------------------------------------------------------------------
449  template <typename T, typename... Args>
450  static int BZWrite(BZFILE *bzf, const std::tuple<T, Args...> & t)
451  {
452  return(BZWriteTuple<std::tuple<T, Args...> >(bzf, t));
453  }
454 
455  //------------------------------------------------------------------------
457  //------------------------------------------------------------------------
458  template <typename T, typename... Args>
459  static int BZRead(BZFILE *bzf, std::tuple<T, Args...> & t)
460  {
461  return(BZReadTuple<std::tuple<T, Args...> >(bzf, t));
462  }
463 
464  //------------------------------------------------------------------------
466  //------------------------------------------------------------------------
467  template <typename T>
468  static int BZWriteTuple(BZFILE *bzf, const T & t)
469  {
470  return(TupleBZ2IOHelper<T,std::tuple_size<T>::value-1>::Write(bzf, t));
471  }
472 
473  //------------------------------------------------------------------------
475  //------------------------------------------------------------------------
476  template <typename T>
477  static int BZReadTuple(BZFILE *bzf, T & t)
478  {
479  return(TupleBZ2IOHelper<T,std::tuple_size<T>::value-1>::Read(bzf, t));
480  }
481 
482  //------------------------------------------------------------------------
485  //------------------------------------------------------------------------
486  template<typename _keyT, typename _valueT, typename _Hash,
487  typename _Pred, typename _Alloc>
488  static int
489  BZRead(BZFILE *bzf,
490  std::unordered_map<_keyT,_valueT,_Hash,_Pred,_Alloc> & hm)
491  {
492  return(PairAssocContBZRead<std::unordered_map<_keyT,_valueT,_Hash,_Pred,_Alloc> >(bzf, hm));
493  }
494 
495  //------------------------------------------------------------------------
498  //------------------------------------------------------------------------
499  template<typename _keyT, typename _valueT, typename _Hash,
500  typename _Pred, typename _Alloc>
501  static int
502  BZWrite(BZFILE *bzf,
503  const std::unordered_map<_keyT,_valueT,_Hash,_Pred,_Alloc> & hm)
504  {
505  return(ContainerBZWrite<std::unordered_map<_keyT,_valueT,_Hash,_Pred,_Alloc> >(bzf, hm));
506  }
507 
508  //------------------------------------------------------------------------
511  //------------------------------------------------------------------------
512  template<typename _valueT, typename _Hash,
513  typename _Pred, typename _Alloc>
514  static int
515  BZRead(BZFILE *bzf,
516  std::unordered_set<_valueT,_Hash,_Pred,_Alloc> & hm)
517  {
518  return(ContainerBZRead<std::unordered_set<_valueT,_Hash,_Pred,_Alloc> >(bzf, hm));
519  }
520 
521  //------------------------------------------------------------------------
524  //------------------------------------------------------------------------
525  template<typename _valueT, typename _Hash,
526  typename _Pred, typename _Alloc>
527  static int
528  BZWrite(BZFILE *bzf,
529  const std::unordered_set<_valueT,_Hash,_Pred,_Alloc> & hm)
530  {
531  return(ContainerBZWrite<std::unordered_set<_valueT,_Hash,_Pred,_Alloc> >(bzf, hm));
532  }
533 
534  //------------------------------------------------------------------------
537  //------------------------------------------------------------------------
538  template<typename _keyT, typename _valueT, typename _Hash,
539  typename _Pred, typename _Alloc>
540  static int
541  BZRead(BZFILE *bzf,
542  std::unordered_multimap<_keyT,_valueT,_Hash,_Pred,_Alloc> & hm)
543  {
544  return(PairAssocContBZRead<std::unordered_multimap<_keyT,_valueT,_Hash,_Pred,_Alloc> >(bzf, hm));
545  }
546 
547  //------------------------------------------------------------------------
550  //------------------------------------------------------------------------
551  template<typename _keyT, typename _valueT, typename _Hash,
552  typename _Pred, typename _Alloc>
553  static int
554  BZWrite(BZFILE *bzf,
555  const std::unordered_multimap<_keyT,_valueT,_Hash,_Pred,_Alloc> & hm)
556  {
557  return(ContainerBZWrite<std::unordered_multimap<_keyT,_valueT,_Hash,_Pred,_Alloc> >(bzf, hm));
558  }
559 
560  //------------------------------------------------------------------------
563  //------------------------------------------------------------------------
564  template<typename _valueT, typename _Hash,
565  typename _Pred, typename _Alloc>
566  static int
567  BZRead(BZFILE *bzf,
568  std::unordered_multiset<_valueT,_Hash,_Pred,_Alloc> & hm)
569  {
570  return(ContainerBZRead<std::unordered_multiset<_valueT,_Hash,_Pred,_Alloc> >(bzf, hm));
571  }
572 
573  //------------------------------------------------------------------------
576  //------------------------------------------------------------------------
577  template<typename _valueT, typename _Hash,
578  typename _Pred, typename _Alloc>
579  static int
580  BZWrite(BZFILE *bzf,
581  const std::unordered_multiset<_valueT,_Hash,_Pred,_Alloc> & hm)
582  {
583  return(ContainerBZWrite<std::unordered_multiset<_valueT,_Hash,_Pred,_Alloc> >(bzf, hm));
584  }
585 
586  private:
587  //------------------------------------------------------------------------
589  //------------------------------------------------------------------------
590  template <typename _inputIteratorT>
591  static int BZWrite(BZFILE *bzf, _inputIteratorT f, _inputIteratorT l)
592  {
593  int rc = 0;
594  if (bzf) {
595  for ( ; f != l; ++f) {
596  int bytesWritten = BZWrite(bzf, *f);
597  if (bytesWritten > 0) {
598  rc += bytesWritten;
599  }
600  else {
601  rc = -1;
602  break;
603  }
604  }
605  }
606  return(rc);
607  }
608 
609  //------------------------------------------------------------------------
613  //------------------------------------------------------------------------
614  template <typename _containerT>
615  static int ContainerBZRead(BZFILE *bzf, _containerT & c)
616  {
617  if (! c.empty())
618  c.clear();
619  int rc = -1;
620  if (bzf) {
621  uint32_t numEntries;
622  int bytesRead = BZRead(bzf, numEntries);
623  if (bytesRead == sizeof(numEntries)) {
624  rc = bytesRead;
625  for (uint32_t i = 0; i < numEntries; ++i) {
626  typename _containerT::value_type val;
627  bytesRead = BZRead(bzf, val);
628  if (bytesRead > 0) {
629  rc += bytesRead;
630  c.insert(c.end(), val);
631  }
632  else {
633  rc = -1;
634  break;
635  }
636  }
637  }
638  }
639  return(rc);
640  }
641 
642  //------------------------------------------------------------------------
646  //------------------------------------------------------------------------
647  template <typename _containerT>
648  static int ContainerBZWrite(BZFILE *bzf, const _containerT & c)
649  {
650  int rc = -1;
651  if (bzf) {
652  uint32_t numEntries = c.size();
653  uint32_t bytesWritten = BZWrite(bzf, numEntries);
654  if (bytesWritten == sizeof(numEntries)) {
655  rc = bytesWritten;
656  if (numEntries) {
657  bytesWritten =
658  BZWrite<typename _containerT::const_iterator>(bzf,
659  c.begin(),
660  c.end());
661  if (bytesWritten > 0)
662  rc += bytesWritten;
663  else
664  rc = -1;
665  }
666  }
667  }
668  return(rc);
669  }
670 
671  //------------------------------------------------------------------------
675  //------------------------------------------------------------------------
676  template <typename _containerT>
677  static int PairAssocContBZRead(BZFILE *bzf, _containerT & m)
678  {
679  int rc = -1;
680  if (! m.empty())
681  m.clear();
682  if (bzf) {
683  uint32_t numEntries;
684  int bytesRead = BZRead(bzf, numEntries);
685  if (bytesRead == sizeof(numEntries)) {
686  rc = bytesRead;
687  for (uint32_t i = 0; i < numEntries; ++i) {
688  typename _containerT::key_type key;
689  bytesRead = BZRead(bzf, key);
690  if (bytesRead > 0) {
691  rc += bytesRead;
692  typename _containerT::mapped_type val;
693  bytesRead = BZRead(bzf, val);
694  if (bytesRead > 0) {
695  rc += bytesRead;
696  m.insert(typename _containerT::value_type(key, val));
697  }
698  else {
699  rc = -1;
700  break;
701  }
702  }
703  else {
704  rc = -1;
705  break;
706  }
707  }
708  }
709  }
710  return(rc);
711  }
712 
713  //------------------------------------------------------------------------
716  //------------------------------------------------------------------------
717  template <typename T, size_t elt>
718  class TupleBZ2IOHelper;
719 
720  //------------------------------------------------------------------------
722  //------------------------------------------------------------------------
723  template <typename T>
724  class TupleBZ2IOHelper<T, 0>
725  {
726  public:
727  //----------------------------------------------------------------------
729  //----------------------------------------------------------------------
730  static int Write(BZFILE *bzf, const T & t)
731  {
732  return(BZ2IO::BZWrite(bzf, std::get<0>(t)));
733  }
734 
735  //----------------------------------------------------------------------
737  //----------------------------------------------------------------------
738  static int Read(BZFILE *bzf, T & t)
739  {
740  return(BZ2IO::BZRead(bzf, std::get<0>(t)));
741  }
742  };
743 
744  //------------------------------------------------------------------------
746  //------------------------------------------------------------------------
747  template <typename T, size_t elt>
748  class TupleBZ2IOHelper
749  {
750  public:
751  //----------------------------------------------------------------------
753  //----------------------------------------------------------------------
754  static int Write(BZFILE *bzf, const T & t)
755  {
756  int rc = TupleBZ2IOHelper<T,elt-1>::Write(bzf, t);
757  if (rc > 0) {
758  int rcr = BZ2IO::BZWrite(bzf, std::get<elt>(t));
759  if (rcr > 0) {
760  rc += rcr;
761  }
762  else {
763  rc = -1;
764  }
765  }
766  return(rc);
767  }
768 
769  //----------------------------------------------------------------------
771  //----------------------------------------------------------------------
772  static int Read(BZFILE *bzf, T & t)
773  {
774  int rc = TupleBZ2IOHelper<T,elt-1>::Read(bzf, t);
775  if (rc > 0) {
776  int rcr = BZ2IO::BZRead(bzf, std::get<elt>(t));
777  if (rcr > 0) {
778  rc += rcr;
779  }
780  else {
781  rc = -1;
782  }
783  }
784  return(rc);
785  }
786 
787  };
788 
789  };
790 
791 } // namespace Dwm
792 
793 #endif // _DWMBZ2IO_HH_
794 
795 //---------------------------- emacs settings -----------------------------
796 // Local Variables:
797 // mode: C++
798 // tab-width: 2
799 // indent-tabs-mode: nil
800 // c-basic-offset: 2
801 // End:
802 //-------------------------------------------------------------------------
static int BZWrite(BZFILE *bzf, const std::pair< _firstT, _secondT > &p)
Writes a pair<_firstT,_secondT> to a BZFILE pointer.
Definition: DwmBZ2IO.hh:275
static int BZRead(BZFILE *bzf, std::list< _valueT, _Alloc > &l)
Reads a list<_valueT> from a BZFILE pointer.
Definition: DwmBZ2IO.hh:386
static int BZWrite(BZFILE *bzf, const std::unordered_set< _valueT, _Hash, _Pred, _Alloc > &hm)
Writes an unordered_set to a BZFILE pointer.
Definition: DwmBZ2IO.hh:528
virtual int BZWrite(BZFILE *bzf) const =0
Write to a BZFILE pointer.
static int BZRead(BZFILE *bzf, std::deque< _valueT, _Alloc > &d)
Reads a deque<_valueT> from a BZFILE pointer.
Definition: DwmBZ2IO.hh:366
static int BZRead(BZFILE *bzf, std::map< _keyT, _valueT, _Compare, _Alloc > &m)
Reads a map<_keyT,_valueT> from a BZFILE pointer.
Definition: DwmBZ2IO.hh:300
static int BZRead(BZFILE *bzf, std::pair< _firstT, _secondT > &p)
Reads a pair<_firstT,_secondT> from a BZFILE pointer.
Definition: DwmBZ2IO.hh:253
Dwm::BZ2Readable pure virtual class definition.
static int BZRead(BZFILE *bzf, std::unordered_set< _valueT, _Hash, _Pred, _Alloc > &hm)
Reads an unordered_set from a BZFILE pointer.
Definition: DwmBZ2IO.hh:515
static int BZWrite(BZFILE *bzf, const std::unordered_multimap< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm)
Writes an unordered_multimap to a BZFILE pointer.
Definition: DwmBZ2IO.hh:554
static int BZWrite(BZFILE *bzf, const std::map< _keyT, _valueT, _Compare, _Alloc > &m)
Writes a map<_keyT,_valueT> to a BZFILE pointer.
Definition: DwmBZ2IO.hh:312
static int BZReadTuple(BZFILE *bzf, T &t)
T must be a tuple, n is the number of elements.
Definition: DwmBZ2IO.hh:477
static int BZWrite(BZFILE *bzf, const std::deque< _valueT, _Alloc > &d)
Writes a deque<_valueT> to a BZFILE pointer.
Definition: DwmBZ2IO.hh:376
static int BZWrite(BZFILE *bzf, const std::unordered_multiset< _valueT, _Hash, _Pred, _Alloc > &hm)
Writes an unordered_multiset to a BZFILE pointer.
Definition: DwmBZ2IO.hh:580
This class is a pure virtual class, defining an interface for classes that can read their contents fr...
Definition: DwmBZ2Readable.hh:57
static int BZWrite(BZFILE *bzf, const BZ2Writable &val)
Wrapper function to write a BZ2Writable object to a BZFILE pointer.
Definition: DwmBZ2IO.hh:235
This class contains a collection of static functions for reading and writing simple types in network ...
Definition: DwmBZ2IO.hh:82
static int BZRead(BZFILE *bzf, std::unordered_multiset< _valueT, _Hash, _Pred, _Alloc > &hm)
Reads an unordered_multiset from a BZFILE pointer.
Definition: DwmBZ2IO.hh:567
static int BZRead(BZFILE *bzf, std::set< _valueT, _Compare, _Alloc > &l)
Reads a set<_valueT> from a BZFILE pointer.
Definition: DwmBZ2IO.hh:406
static int BZRead(BZFILE *bzf, std::vector< _valueT, _Alloc > &v)
Reads a vector<_valueT> from a BZFILE pointer.
Definition: DwmBZ2IO.hh:346
Dwm::BZ2Writable pure virtual class definition.
static int BZWrite(BZFILE *bzf, const std::unordered_map< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm)
Writes an unordered_map to a BZFILE pointer.
Definition: DwmBZ2IO.hh:502
static int BZRead(BZFILE *bzf, std::unordered_multimap< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm)
Reads an unordered_multimap from a BZFILE pointer.
Definition: DwmBZ2IO.hh:541
Definition: DwmBZ2IO.hh:67
static int BZWriteTuple(BZFILE *bzf, const T &t)
T must be a tuple, n is the number of elements.
Definition: DwmBZ2IO.hh:468
static int BZWrite(BZFILE *bzf, const std::multiset< _valueT, _Compare, _Alloc > &l)
Writes a multiset<_valueT> to a BZFILE pointer.
Definition: DwmBZ2IO.hh:437
static int BZRead(BZFILE *bzf, char &c)
Reads from bzf.
static int BZRead(BZFILE *bzf, BZ2Readable &val)
Wrapper function to read a BZ2Readable object from a BZFILE pointer.
Definition: DwmBZ2IO.hh:243
static int BZRead(BZFILE *bzf, std::unordered_map< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm)
Reads an unordered_map from a BZFILE pointer.
Definition: DwmBZ2IO.hh:489
static int BZWrite(BZFILE *bzf, const std::vector< _valueT, _Alloc > &v)
Writes a vector<_valueT> to a BZFILE pointer.
Definition: DwmBZ2IO.hh:356
static int BZWrite(BZFILE *bzf, char c)
Writes c to bzf.
This class is a pure virtual class, defining an interface for classes that can write their contents t...
Definition: DwmBZ2Writable.hh:57
static int BZRead(BZFILE *bzf, std::multiset< _valueT, _Compare, _Alloc > &l)
Reads a multiset<_valueT> from a BZFILE pointer.
Definition: DwmBZ2IO.hh:426
static int BZWrite(BZFILE *bzf, const std::multimap< _keyT, _valueT, _Compare, _Alloc > &m)
Writes a multimap<_keyT,_valueT> to a BZFILE pointer.
Definition: DwmBZ2IO.hh:336
virtual int BZRead(BZFILE *bzf)=0
Read from a BZFILE pointer.
static int BZWrite(BZFILE *bzf, const std::set< _valueT, _Compare, _Alloc > &l)
Writes a set<_valueT> to a BZFILE pointer.
Definition: DwmBZ2IO.hh:416
static int BZRead(BZFILE *bzf, std::multimap< _keyT, _valueT, _Compare, _Alloc > &m)
Reads a multimap<_keyT,_valueT> from a BZFILE pointer.
Definition: DwmBZ2IO.hh:324
static int BZWrite(BZFILE *bzf, const std::list< _valueT, _Alloc > &l)
Writes a list<_valueT> to a BZFILE pointer.
Definition: DwmBZ2IO.hh:396
A configure target for dealing with OS differences.