libDwm-0.6.0
Dwm::GZIO Class Reference

This class contains a collection of static functions for reading and writing simple types in network byte order (MSB first) from/to gzip files. More...

#include <DwmGZIO.hh>

Static Public Member Functions

static int Write (gzFile gzf, char c)
 Writes c to gzf. More...
 
static int Write (gzFile gzf, uint8_t c)
 Writes c to gzf. More...
 
static int Write (gzFile gzf, int16_t val)
 Writes val to gzf, in network byte order (MSB first). More...
 
static int Write (gzFile gzf, uint16_t val)
 Writes val to gzf, in network byte order (MSB first). More...
 
static int Write (gzFile gzf, int32_t val)
 Writes val to gzf, in network byte order (MSB first). More...
 
static int Write (gzFile gzf, uint32_t val)
 Writes val to gzf, in network byte order (MSB first). More...
 
static int Write (gzFile gzf, const int64_t &val)
 Writes val to gzf, in network byte order (MSB first). More...
 
static int Write (gzFile gzf, const uint64_t &val)
 Writes val to gzf, in network byte order (MSB first). More...
 
static int Write (gzFile gzf, float val)
 Writes val tp gzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985). More...
 
static int Write (gzFile gzf, const double &val)
 Writes val tp gzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985). More...
 
static int Write (gzFile gzf, const std::string &s)
 Writes s to gzf. More...
 
static int Read (gzFile gzf, char &c)
 Reads from gzf. More...
 
static int Read (gzFile gzf, uint8_t &c)
 Reads from gzf. More...
 
static int Read (gzFile gzf, int16_t &val)
 Reads val from gzf, in network byte order (MSB first). More...
 
static int Read (gzFile gzf, uint16_t &val)
 Reads val from gzf, in network byte order (MSB first). More...
 
static int Read (gzFile gzf, int32_t &val)
 Reads val from gzf, in network byte order (MSB first). More...
 
static int Read (gzFile gzf, uint32_t &val)
 Reads val from gzf, in network byte order (MSB first). More...
 
static int Read (gzFile gzf, int64_t &val)
 Reads val from gzf, in network byte order (MSB first). More...
 
static int Read (gzFile gzf, uint64_t &val)
 Reads val from gzf, in network byte order (MSB first). More...
 
static int Read (gzFile gzf, float &val)
 Reads val from gzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985). More...
 
static int Read (gzFile gzf, double &val)
 Reads val from gzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985). More...
 
static int Read (gzFile gzf, std::string &s)
 Reads s from gzf. More...
 
static int Write (gzFile gzf, const GZWritable &val)
 Wrapper function to write a GZWritable object to a gzFile.
 
static int Read (gzFile gzf, GZReadable &val)
 Wrapper function to read a GZReadable object from a gzFile.
 
template<typename _firstT , typename _secondT >
static int Read (gzFile gzf, std::pair< _firstT, _secondT > &p)
 Reads a pair<_firstT,_secondT> from a gzFile. More...
 
template<typename _firstT , typename _secondT >
static int Write (gzFile gzf, const std::pair< _firstT, _secondT > &p)
 Writes a pair<_firstT,_secondT> to a gzFile. More...
 
template<typename _keyT , typename _valueT , typename _Compare , typename _Alloc >
static int Read (gzFile gzf, std::map< _keyT, _valueT, _Compare, _Alloc > &m)
 Reads a map<_keyT,_valueT> from a gzFile. More...
 
template<typename _keyT , typename _valueT , typename _Compare , typename _Alloc >
static int Write (gzFile gzf, const std::map< _keyT, _valueT, _Compare, _Alloc > &m)
 Writes a map<_keyT,_valueT> to a gzFile. More...
 
template<typename _keyT , typename _valueT , typename _Compare , typename _Alloc >
static int Read (gzFile gzf, std::multimap< _keyT, _valueT, _Compare, _Alloc > &m)
 Reads a multimap<_keyT,_valueT> from a gzFile. More...
 
template<typename _keyT , typename _valueT , typename _Compare , typename _Alloc >
static int Write (gzFile gzf, const std::multimap< _keyT, _valueT, _Compare, _Alloc > &m)
 Writes a multimap<_keyT,_valueT> to a gzFile. More...
 
template<typename _valueT , typename _Alloc >
static int Read (gzFile gzf, std::vector< _valueT, _Alloc > &v)
 Reads a vector<_valueT> from a gzFile. More...
 
template<typename _valueT , typename _Alloc >
static int Write (gzFile gzf, const std::vector< _valueT, _Alloc > &v)
 Writes a vector<_valueT> to a gzFile. More...
 
template<typename _valueT , typename _Alloc >
static int Read (gzFile gzf, std::deque< _valueT, _Alloc > &d)
 Reads a deque<_valueT> from a gzFile. More...
 
template<typename _valueT , typename _Alloc >
static int Write (gzFile gzf, const std::deque< _valueT, _Alloc > &d)
 Writes a deque<_valueT> to a gzFile. More...
 
template<typename _valueT , typename _Alloc >
static int Read (gzFile gzf, std::list< _valueT, _Alloc > &l)
 Reads a list<_valueT> from a gzFile. More...
 
template<typename _valueT , typename _Alloc >
static int Write (gzFile gzf, const std::list< _valueT, _Alloc > &l)
 Writes a list<_valueT> to a gzFile. More...
 
template<typename _valueT , typename _Compare , typename _Alloc >
static int Read (gzFile gzf, std::set< _valueT, _Compare, _Alloc > &l)
 Reads a set<_valueT> from a gzFile. More...
 
template<typename _valueT , typename _Compare , typename _Alloc >
static int Write (gzFile gzf, const std::set< _valueT, _Compare, _Alloc > &l)
 Writes a set<_valueT> to a gzFile. More...
 
template<typename _valueT , typename _Compare , typename _Alloc >
static int Read (gzFile gzf, std::multiset< _valueT, _Compare, _Alloc > &l)
 Reads a multiset<_valueT> from a gzFile. More...
 
template<typename _valueT , typename _Compare , typename _Alloc >
static int Write (gzFile gzf, const std::multiset< _valueT, _Compare, _Alloc > &l)
 Writes a multiset<_valueT> to a gzFile. More...
 
template<typename T , typename... Args>
static int Write (gzFile gzf, const std::tuple< T, Args... > &t)
 
template<typename T , typename... Args>
static int Read (gzFile gzf, std::tuple< T, Args... > &t)
 
template<typename T >
static int WriteTuple (gzFile gzf, const T &t)
 T must be a tuple, n is the number of elements.
 
template<typename T >
static int ReadTuple (gzFile gzf, T &t)
 T must be a tuple, n is the number of elements.
 
template<typename _keyT , typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Read (gzFile gzf, std::unordered_map< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm)
 Reads an unordered_map from a gzFile. More...
 
template<typename _keyT , typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Write (gzFile gzf, const std::unordered_map< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm)
 Writes an unordered_map to a gzFile. More...
 
template<typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Read (gzFile gzf, std::unordered_set< _valueT, _Hash, _Pred, _Alloc > &hm)
 Reads an unordered_set from a gzFile. More...
 
template<typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Write (gzFile gzf, const std::unordered_set< _valueT, _Hash, _Pred, _Alloc > &hm)
 Writes an unordered_set to a gzFile. More...
 
template<typename _keyT , typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Read (gzFile gzf, std::unordered_multimap< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm)
 Reads an unordered_multimap from a gzFile. More...
 
template<typename _keyT , typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Write (gzFile gzf, const std::unordered_multimap< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm)
 Writes an unordered_multimap to a gzFile. More...
 
template<typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Read (gzFile gzf, std::unordered_multiset< _valueT, _Hash, _Pred, _Alloc > &hm)
 Reads an unordered_multiset from a gzFile. More...
 
template<typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Write (gzFile gzf, const std::unordered_multiset< _valueT, _Hash, _Pred, _Alloc > &hm)
 Writes an unordered_multiset to a gzFile. More...
 

Detailed Description

This class contains a collection of static functions for reading and writing simple types in network byte order (MSB first) from/to gzip files.

It also contains functions to read and write strings from/to gzip files. It also contains function templates to read and write STL deques, lists, vectors, maps, multimaps, sets, multisets, hash_maps and hash_sets from/to gzip files. We use our member functions to handle reading and writing simple types in these containers, and function templates to handle reading and writing other class types. In the latter case, the class must implement the GZReadable and GZWritable interfaces, since our function templates simply call out to them.

Member Function Documentation

◆ Read() [1/23]

static int Dwm::GZIO::Read ( gzFile  gzf,
char &  c 
)
static

Reads from gzf.

Returns the number of bytes read (1) on success, less on failure.

◆ Read() [2/23]

static int Dwm::GZIO::Read ( gzFile  gzf,
uint8_t &  c 
)
static

Reads from gzf.

Returns the number of bytes read (1) on success, less on failure.

◆ Read() [3/23]

static int Dwm::GZIO::Read ( gzFile  gzf,
int16_t &  val 
)
static

Reads val from gzf, in network byte order (MSB first).

Returns number of bytes read (2) on success, less on failure.

◆ Read() [4/23]

static int Dwm::GZIO::Read ( gzFile  gzf,
uint16_t &  val 
)
static

Reads val from gzf, in network byte order (MSB first).

Returns number of bytes read (2) on success, less on failure.

◆ Read() [5/23]

static int Dwm::GZIO::Read ( gzFile  gzf,
int32_t &  val 
)
static

Reads val from gzf, in network byte order (MSB first).

Returns number of bytes read (4) on success, less on failure.

◆ Read() [6/23]

static int Dwm::GZIO::Read ( gzFile  gzf,
uint32_t &  val 
)
static

Reads val from gzf, in network byte order (MSB first).

Returns number of bytes read (4) on success, less on failure.

◆ Read() [7/23]

static int Dwm::GZIO::Read ( gzFile  gzf,
int64_t &  val 
)
static

Reads val from gzf, in network byte order (MSB first).

Returns number of bytes read (8) on success, less on failure.

◆ Read() [8/23]

static int Dwm::GZIO::Read ( gzFile  gzf,
uint64_t &  val 
)
static

Reads val from gzf, in network byte order (MSB first).

Returns number of bytes read (8) on success, less on failure.

◆ Read() [9/23]

static int Dwm::GZIO::Read ( gzFile  gzf,
float &  val 
)
static

Reads val from gzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985).

Returns number of bytes read (4) on success, less on failure.

◆ Read() [10/23]

static int Dwm::GZIO::Read ( gzFile  gzf,
double &  val 
)
static

Reads val from gzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985).

Returns number of bytes read (8) on success, less on failure.

◆ Read() [11/23]

static int Dwm::GZIO::Read ( gzFile  gzf,
std::string &  s 
)
static

Reads s from gzf.

Returns the number of bytes read on success, -1 on failure. Since we write strings with a 32-bit unsigned length value preceding the actual string, and always have a terminating NULL, this always reads at least 5 bytes on success.

◆ Read() [12/23]

template<typename _firstT , typename _secondT >
static int Dwm::GZIO::Read ( gzFile  gzf,
std::pair< _firstT, _secondT > &  p 
)
inlinestatic

Reads a pair<_firstT,_secondT> from a gzFile.

Returns the number of bytes read on success, -1 on failure.

Here is the call graph for this function:

◆ Read() [13/23]

template<typename _keyT , typename _valueT , typename _Compare , typename _Alloc >
static int Dwm::GZIO::Read ( gzFile  gzf,
std::map< _keyT, _valueT, _Compare, _Alloc > &  m 
)
inlinestatic

Reads a map<_keyT,_valueT> from a gzFile.

Returns the number of bytes read on success, -1 on failure.

◆ Read() [14/23]

template<typename _keyT , typename _valueT , typename _Compare , typename _Alloc >
static int Dwm::GZIO::Read ( gzFile  gzf,
std::multimap< _keyT, _valueT, _Compare, _Alloc > &  m 
)
inlinestatic

Reads a multimap<_keyT,_valueT> from a gzFile.

Returns the number of bytes read on success, -1 on failure.

◆ Read() [15/23]

template<typename _valueT , typename _Alloc >
static int Dwm::GZIO::Read ( gzFile  gzf,
std::vector< _valueT, _Alloc > &  v 
)
inlinestatic

Reads a vector<_valueT> from a gzFile.

Returns the number of bytes read on success, -1 on failure.

◆ Read() [16/23]

template<typename _valueT , typename _Alloc >
static int Dwm::GZIO::Read ( gzFile  gzf,
std::deque< _valueT, _Alloc > &  d 
)
inlinestatic

Reads a deque<_valueT> from a gzFile.

Returns the number of bytes read on success, -1 on failure.

◆ Read() [17/23]

template<typename _valueT , typename _Alloc >
static int Dwm::GZIO::Read ( gzFile  gzf,
std::list< _valueT, _Alloc > &  l 
)
inlinestatic

Reads a list<_valueT> from a gzFile.

Returns the number of bytes read on success, -1 on failure.

◆ Read() [18/23]

template<typename _valueT , typename _Compare , typename _Alloc >
static int Dwm::GZIO::Read ( gzFile  gzf,
std::set< _valueT, _Compare, _Alloc > &  l 
)
inlinestatic

Reads a set<_valueT> from a gzFile.

Returns the number of bytes read on success, -1 on failure.

◆ Read() [19/23]

template<typename _valueT , typename _Compare , typename _Alloc >
static int Dwm::GZIO::Read ( gzFile  gzf,
std::multiset< _valueT, _Compare, _Alloc > &  l 
)
inlinestatic

Reads a multiset<_valueT> from a gzFile.

Returns the number of bytes read on success, -1 on failure.

◆ Read() [20/23]

template<typename _keyT , typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Dwm::GZIO::Read ( gzFile  gzf,
std::unordered_map< _keyT, _valueT, _Hash, _Pred, _Alloc > &  hm 
)
inlinestatic

Reads an unordered_map from a gzFile.

Returns the number of bytes read on success, -1 on failure.

◆ Read() [21/23]

template<typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Dwm::GZIO::Read ( gzFile  gzf,
std::unordered_set< _valueT, _Hash, _Pred, _Alloc > &  hm 
)
inlinestatic

Reads an unordered_set from a gzFile.

Returns the number of bytes read on success, -1 on failure.

◆ Read() [22/23]

template<typename _keyT , typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Dwm::GZIO::Read ( gzFile  gzf,
std::unordered_multimap< _keyT, _valueT, _Hash, _Pred, _Alloc > &  hm 
)
inlinestatic

Reads an unordered_multimap from a gzFile.

Returns the number of bytes read on success, -1 on failure.

◆ Read() [23/23]

template<typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Dwm::GZIO::Read ( gzFile  gzf,
std::unordered_multiset< _valueT, _Hash, _Pred, _Alloc > &  hm 
)
inlinestatic

Reads an unordered_multiset from a gzFile.

Returns the number of bytes read on success, -1 on failure.

◆ Write() [1/23]

static int Dwm::GZIO::Write ( gzFile  gzf,
char  c 
)
static

Writes c to gzf.

Returns the number of bytes written on success, -1 on failure.

◆ Write() [2/23]

static int Dwm::GZIO::Write ( gzFile  gzf,
uint8_t  c 
)
static

Writes c to gzf.

Returns the number of bytes written (1) on success, less on failure.

◆ Write() [3/23]

static int Dwm::GZIO::Write ( gzFile  gzf,
int16_t  val 
)
static

Writes val to gzf, in network byte order (MSB first).

Returns the number of bytes written (2) on success, less on failure.

◆ Write() [4/23]

static int Dwm::GZIO::Write ( gzFile  gzf,
uint16_t  val 
)
static

Writes val to gzf, in network byte order (MSB first).

Returns the number of bytes written (2) on success, less on failure.

◆ Write() [5/23]

static int Dwm::GZIO::Write ( gzFile  gzf,
int32_t  val 
)
static

Writes val to gzf, in network byte order (MSB first).

Returns the number of bytes written (4) on success, less on failure.

◆ Write() [6/23]

static int Dwm::GZIO::Write ( gzFile  gzf,
uint32_t  val 
)
static

Writes val to gzf, in network byte order (MSB first).

Returns the number of bytes written (4) on success, less on failure.

◆ Write() [7/23]

static int Dwm::GZIO::Write ( gzFile  gzf,
const int64_t &  val 
)
static

Writes val to gzf, in network byte order (MSB first).

Returns the number of bytes written (8) on success, less on failure.

◆ Write() [8/23]

static int Dwm::GZIO::Write ( gzFile  gzf,
const uint64_t &  val 
)
static

Writes val to gzf, in network byte order (MSB first).

Returns the number of bytes written (8) on success, less on failure.

◆ Write() [9/23]

static int Dwm::GZIO::Write ( gzFile  gzf,
float  val 
)
static

Writes val tp gzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985).

Returns the number of bytes written (4) on success, less on failure.

◆ Write() [10/23]

static int Dwm::GZIO::Write ( gzFile  gzf,
const double &  val 
)
static

Writes val tp gzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985).

Returns the number of bytes written (8) on success, less on failure.

◆ Write() [11/23]

static int Dwm::GZIO::Write ( gzFile  gzf,
const std::string &  s 
)
static

Writes s to gzf.

Returns the number of bytes written on success, -1 on failure. Note that a 32-bit value is written first, holding the length of the string. The terminating NULL is also written. Hence, on success this will always return a value of 5 or greater.

◆ Write() [12/23]

template<typename _firstT , typename _secondT >
static int Dwm::GZIO::Write ( gzFile  gzf,
const std::pair< _firstT, _secondT > &  p 
)
inlinestatic

Writes a pair<_firstT,_secondT> to a gzFile.

Returns the number of bytes written on success, -1 on failure.

Here is the call graph for this function:

◆ Write() [13/23]

template<typename _keyT , typename _valueT , typename _Compare , typename _Alloc >
static int Dwm::GZIO::Write ( gzFile  gzf,
const std::map< _keyT, _valueT, _Compare, _Alloc > &  m 
)
inlinestatic

Writes a map<_keyT,_valueT> to a gzFile.

Returns the number of bytes written on success, -1 on failure.

◆ Write() [14/23]

template<typename _keyT , typename _valueT , typename _Compare , typename _Alloc >
static int Dwm::GZIO::Write ( gzFile  gzf,
const std::multimap< _keyT, _valueT, _Compare, _Alloc > &  m 
)
inlinestatic

Writes a multimap<_keyT,_valueT> to a gzFile.

Returns the number of bytes written on success, -1 on failure.

◆ Write() [15/23]

template<typename _valueT , typename _Alloc >
static int Dwm::GZIO::Write ( gzFile  gzf,
const std::vector< _valueT, _Alloc > &  v 
)
inlinestatic

Writes a vector<_valueT> to a gzFile.

Returns the number of bytes written on success, -1 on failure.

◆ Write() [16/23]

template<typename _valueT , typename _Alloc >
static int Dwm::GZIO::Write ( gzFile  gzf,
const std::deque< _valueT, _Alloc > &  d 
)
inlinestatic

Writes a deque<_valueT> to a gzFile.

Returns the number of bytes written on success, -1 on failure.

◆ Write() [17/23]

template<typename _valueT , typename _Alloc >
static int Dwm::GZIO::Write ( gzFile  gzf,
const std::list< _valueT, _Alloc > &  l 
)
inlinestatic

Writes a list<_valueT> to a gzFile.

Returns the number of bytes written on success, -1 on failure.

◆ Write() [18/23]

template<typename _valueT , typename _Compare , typename _Alloc >
static int Dwm::GZIO::Write ( gzFile  gzf,
const std::set< _valueT, _Compare, _Alloc > &  l 
)
inlinestatic

Writes a set<_valueT> to a gzFile.

Returns the number of bytes written on success, -1 on failure.

◆ Write() [19/23]

template<typename _valueT , typename _Compare , typename _Alloc >
static int Dwm::GZIO::Write ( gzFile  gzf,
const std::multiset< _valueT, _Compare, _Alloc > &  l 
)
inlinestatic

Writes a multiset<_valueT> to a gzFile.

Returns the number of bytes written on success, -1 on failure.

Here is the call graph for this function:

◆ Write() [20/23]

template<typename _keyT , typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Dwm::GZIO::Write ( gzFile  gzf,
const std::unordered_map< _keyT, _valueT, _Hash, _Pred, _Alloc > &  hm 
)
inlinestatic

Writes an unordered_map to a gzFile.

Returns the number of bytes written on success, -1 on failure.

◆ Write() [21/23]

template<typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Dwm::GZIO::Write ( gzFile  gzf,
const std::unordered_set< _valueT, _Hash, _Pred, _Alloc > &  hm 
)
inlinestatic

Writes an unordered_set to a gzFile.

Returns the number of bytes written on success, -1 on failure.

◆ Write() [22/23]

template<typename _keyT , typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Dwm::GZIO::Write ( gzFile  gzf,
const std::unordered_multimap< _keyT, _valueT, _Hash, _Pred, _Alloc > &  hm 
)
inlinestatic

Writes an unordered_multimap to a gzFile.

Returns the number of bytes written on success, -1 on failure.

◆ Write() [23/23]

template<typename _valueT , typename _Hash , typename _Pred , typename _Alloc >
static int Dwm::GZIO::Write ( gzFile  gzf,
const std::unordered_multiset< _valueT, _Hash, _Pred, _Alloc > &  hm 
)
inlinestatic

Writes an unordered_multiset to a gzFile.

Returns the number of bytes written on success, -1 on failure.

Here is the call graph for this function:

The documentation for this class was generated from the following file: