Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/proxy/src/lib/network/zip.h @ 9479

Last change on this file since 9479 was 9444, checked in by bensch, 18 years ago

some cleanup

File size: 897 bytes
Line 
1/*!
2 * @file zip.h
3 * @brief Definition of the Zip singleton Class
4 */
5
6#ifndef _ZIP_H
7#define _ZIP_H
8
9#include <zlib.h>
10#include <string>
11#include <vector>
12
13#include "netdefs.h"
14
15struct DictionaryEntry
16{
17  byte * dict;
18  int    dictLen;
19  uLong  adler;
20};
21
22//! A class for compressing/uncompressing packes.
23class Zip
24{
25  public:
26    virtual ~Zip(void);
27    /** @returns a Pointer to the only object of this Class */
28    inline static Zip* getInstance(void) { if (!singletonRef) singletonRef = new Zip();  return singletonRef; };
29
30    int loadDictionary( std::string name );
31    int zip( byte * from, int fromLength, byte * to, int maxLength, int dict = 0 );
32    int unZip( byte * from, int fromLength, byte * to, int maxLength );
33
34    int getDictCount(){ return dicts.size(); }
35
36  private:
37    Zip();
38    static Zip* singletonRef;
39
40    std::vector<DictionaryEntry> dicts;
41};
42
43#endif /* _ZIP_H */
Note: See TracBrowser for help on using the repository browser.