Skip to content
Snippets Groups Projects
Commit fe03cdbd authored by Jonathan Hanks's avatar Jonathan Hanks
Browse files

cps_recv: cleanup

Removing commented debug code from the DeflateStream and added some comments.
parent ea4accbd
No related branches found
No related tags found
No related merge requests found
......@@ -25,28 +25,11 @@ namespace cps_plugins
void
publish( pub_sub::KeyType key, pub_sub::Message msg ) override
{
auto new_msg = deflate_( msg );
// auto check_msg = inflate_(new_msg);
publisher_.publish( key, new_msg );
// if (msg.length != check_msg.length)
// {
// throw std::runtime_error("Mismatch on
// length of compression/decompression");
// }
// auto si = reinterpret_cast<const
// char*>(msg.data()); auto sd =
// reinterpret_cast<const
// char*>(check_msg.data()); if (!std::equal(si,
// si+msg.length, sd))
// {
// throw std::runtime_error("Mismatch on body
// of compression/decompression");
// }
publisher_.publish( key, deflate_( msg ) );
}
private:
DeflateStream deflate_;
InflateStream inflate_;
pub_sub::Publisher publisher_;
};
......
......@@ -9,6 +9,10 @@ namespace cps_plugins
{
namespace detail
{
/*!
* @brief Simple wrapper to take a decompress a compressed
* pub_sub::Message
*/
class InflateStream
{
public:
......@@ -26,6 +30,12 @@ namespace cps_plugins
}
}
/*!
* @brief inflate/decompress a message
* @param input the compressed message
* @return an uncompressed copy of the message
* @note raises a runtime_error on error
*/
pub_sub::Message
operator( )( const pub_sub::Message& input )
{
......@@ -69,6 +79,9 @@ namespace cps_plugins
z_stream z_;
};
/*!
* @brief Simple wrapper to compress a pub_sub::Message
*/
class DeflateStream
{
public:
......@@ -91,6 +104,12 @@ namespace cps_plugins
deflateEnd( &z_ );
}
/*!
* @brief deflate/compress a message
* @param input the uncompressed message
* @return an compressed copy of the message
* @note raises a runtime_error on error
*/
pub_sub::Message
operator( )( const pub_sub::Message& input )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment