#pragma once /** * \file Compression.h * \brief File containing compress utilities */ #include #include namespace sp { namespace option { struct ZlibCompress { bool m_Enabled = true; std::size_t m_CompressionThreshold = 64; }; } // namespace option } // namespace sp #include namespace sp { namespace zlib { /** * \brief Compress some data * \param buffer the data to compress * \return the compressed data */ DataBuffer Compress(const DataBuffer& buffer, std::size_t a_CompressionThreshold = 64); /** * \brief Uncompress some data * \param buffer the data to uncompress * \param packetLength lenght of data * \return the uncompressed data */ DataBuffer Decompress(DataBuffer& buffer, std::uint64_t packetLength); } // namespace zlib namespace io { template <> class MessageEncapsulator { public: static DataBuffer Encapsulate(const DataBuffer& a_Data, const option::ZlibCompress& a_Option); static DataBuffer Decapsulate(DataBuffer& a_Data, const option::ZlibCompress& a_Option); }; } // namespace io } // namespace sp