generic encapsulator
This commit is contained in:
@@ -11,10 +11,17 @@
|
||||
namespace sp {
|
||||
namespace option {
|
||||
|
||||
struct ZlibCompress {};
|
||||
struct ZlibCompress {
|
||||
bool m_Enabled = true;
|
||||
std::size_t m_CompressionThreshold = 64;
|
||||
};
|
||||
|
||||
} // namespace option
|
||||
} // namespace sp
|
||||
|
||||
#include <sp/io/IOInterface.h>
|
||||
|
||||
namespace sp {
|
||||
namespace zlib {
|
||||
|
||||
/**
|
||||
@@ -33,4 +40,15 @@ DataBuffer Compress(const DataBuffer& buffer, std::size_t a_CompressionThreshold
|
||||
DataBuffer Decompress(DataBuffer& buffer, std::uint64_t packetLength);
|
||||
|
||||
} // namespace zlib
|
||||
|
||||
namespace io {
|
||||
|
||||
template <>
|
||||
class MessageEncapsulator<option::ZlibCompress> {
|
||||
public:
|
||||
static DataBuffer Encapsulate(const DataBuffer& a_Data, const option::ZlibCompress& a_Option);
|
||||
static DataBuffer Decapsulate(DataBuffer& a_Data, std::size_t a_Length, const option::ZlibCompress& a_Option);
|
||||
};
|
||||
|
||||
} // namespace io
|
||||
} // namespace sp
|
||||
|
||||
Reference in New Issue
Block a user