2017-01-20 08:36:52 -05:00
|
|
|
#pragma once
|
|
|
|
|
2016-01-09 09:30:13 -05:00
|
|
|
#define CHUNK 16384
|
2017-06-26 14:30:29 -04:00
|
|
|
#define DEFLATE_ZLIB false
|
|
|
|
#define DEFLATE_ZSTD true
|
2016-01-09 09:30:13 -05:00
|
|
|
|
2016-01-04 18:49:34 -05:00
|
|
|
namespace Utils
|
|
|
|
{
|
|
|
|
namespace Compression
|
|
|
|
{
|
2017-06-26 14:30:29 -04:00
|
|
|
class Deflate
|
2016-01-04 18:49:34 -05:00
|
|
|
{
|
|
|
|
public:
|
2017-06-26 14:30:29 -04:00
|
|
|
class ZLib
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static std::string Compress(std::string data);
|
|
|
|
static std::string Decompress(std::string data);
|
|
|
|
};
|
2017-06-26 13:01:52 -04:00
|
|
|
|
2017-06-26 14:30:29 -04:00
|
|
|
class ZStd
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static std::string Compress(std::string data);
|
|
|
|
static std::string Decompress(std::string data);
|
|
|
|
};
|
|
|
|
|
|
|
|
class Semaphore
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Semaphore(bool zstd);
|
|
|
|
~Semaphore();
|
|
|
|
|
|
|
|
private:
|
|
|
|
int state;
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
static std::mutex Mutex;
|
2017-06-26 13:01:52 -04:00
|
|
|
static std::string Compress(std::string data);
|
|
|
|
static std::string Decompress(std::string data);
|
|
|
|
};
|
2016-01-04 18:49:34 -05:00
|
|
|
};
|
|
|
|
}
|