/*! * @file zip.h * @brief Definition of the Zip singleton Class */ #ifndef _ZIP_H #define _ZIP_H #include #include #include #include "netdefs.h" struct DictionaryEntry { byte * dict; int dictLen; uLong adler; }; //! A class for compressing/uncompressing packes. class Zip { public: virtual ~Zip(void); /** @returns a Pointer to the only object of this Class */ inline static Zip* getInstance(void) { if (!singletonRef) singletonRef = new Zip(); return singletonRef; }; bool loadDictionary( std::string name ); int zip( byte * from, int fromLength, byte * to, int maxLength, int dict = 0 ); int unZip( byte * from, int fromLength, byte * to, int maxLength ); int getDictCount(){ return dicts.size(); } private: Zip(); static Zip* singletonRef; std::vector dicts; }; #endif /* _PROTO_SINGLETON_H */