CFEL - ASG Software Suite
2.5.0
CASS
|
A string serializer. More...
#include <serializer.hpp>
Public Member Functions | |
Serializer (int compressionlevel=Z_BEST_COMPRESSION) | |
constructor. More... | |
Serializer (const std::string &string) | |
constructor More... | |
~Serializer () | |
destructor. More... | |
const std::string | buffer () const |
retrieve a const reference to the compressed string. More... | |
![]() | |
SerializerBackend () | |
constructor More... | |
void | flush () |
flush the stream More... | |
std::ostream & | writeToStream (const char *data, std::streamsize n) |
write data to the stream More... | |
std::istream & | readFromStream (char *data, std::streamsize n) |
read data from the stream More... | |
template<typename Type > | |
void | add (const Type &value) |
add arbitrary value to the stream More... | |
template<typename Type > | |
Type | retrieve () |
read arbitrary value from stream More... | |
void | startChecksumGroupForRead () |
control checksum calculation for the next values added More... | |
bool | endChecksumGroupForRead () |
void | startChecksumGroupForWrite () |
control checksum for writing to stream More... | |
void | endChecksumGroupForWrite () |
Private Member Functions | |
std::string | compress (const std::string &str) const |
Compress a STL string using zlib with given compression level and return the binary data. More... | |
std::string | decompress (const std::string &str) const |
Decompress an STL string using zlib and return the inflated data. More... | |
Private Attributes | |
int | _compresslevel |
Additional Inherited Members | |
![]() | |
void | addToOutChecksum (const char *data, std::streamsize len) |
fletcher16 algorithm for 8 bit input More... | |
void | addToInChecksum (const char *data, std::streamsize len) |
fletcher16 algorithm for 8 bit input More... | |
![]() | |
std::iostream * | _stream |
the string to serialize the objects to (buffer) More... | |
uint16_t | r_sum1 |
sum 1 for reading More... | |
uint16_t | r_sum2 |
sum 2 for reading More... | |
uint16_t | w_sum1 |
sum 1 for writing More... | |
uint16_t | w_sum2 |
sum 2 for writing More... | |
bool | _checkSumGroupStartedForRead |
flag to enable getting parts to a checksum More... | |
bool | _checkSumGroupStartedForWrite |
flag to enable adding parts to a checksum More... | |
A string serializer.
class that will serialize / de serialize Serializable classes to a stringstream
The resulting buffer will be compressed and the string to be read from will be decompressed before reading from it
Definition at line 287 of file serializer.hpp.
|
inlineexplicit |
constructor.
will open the stream in binary writing mode
compressionlevel | the level for the z-lib compression. Default is best compression |
Definition at line 297 of file serializer.hpp.
References cass::SerializerBackend::_stream.
|
inline |
constructor
will open the provided string for reading in binary mode after it is decompressed
string | the compressed string that we want to read from |
Definition at line 310 of file serializer.hpp.
References cass::SerializerBackend::_stream, and decompress().
|
inline |
destructor.
deletes stream object
Definition at line 320 of file serializer.hpp.
References cass::SerializerBackend::_stream.
|
inline |
retrieve a const reference to the compressed string.
Definition at line 329 of file serializer.hpp.
References cass::SerializerBackend::_stream, and compress().
Referenced by jocassview::TCPClient::results().
|
inlineprivate |
Compress a STL string using zlib with given compression level and return the binary data.
Copyright 2007 Timo Bingmann tb@pa Distributed under the Boost Software License, Version 1.0. (See nthe ma.ne thttp://www.boost.org/LICENSE_1_0.txt)
str |
z_stream is zlib's control structure
set the z_stream's input
retrieve the compressed bytes blockwise
append the block to the output string
an error occurred that was not EOF
Definition at line 345 of file serializer.hpp.
References _compresslevel.
Referenced by buffer().
|
inlineprivate |
Decompress an STL string using zlib and return the inflated data.
Copyright 2007 Timo Bingmann tb@pa Distributed under the Boost Software License, Version 1.0. (See nthe ma.ne thttp://www.boost.org/LICENSE_1_0.txt)
str | the compressed string |
z_stream is zlib's control structure
get the decompressed bytes blockwise using repeated calls to inflate
an error occurred that was not EOF
Definition at line 409 of file serializer.hpp.
Referenced by Serializer().
|
private |
Definition at line 463 of file serializer.hpp.
Referenced by compress().