CFEL - ASG Software Suite
2.5.0
CASS
|
A serializer. More...
#include <serializer.hpp>
Public Member Functions | |
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 () |
Protected Member Functions | |
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... | |
Protected Attributes | |
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 serializer.
base class that will serialize / de serialize Serializable classes to an iostream This is an interface that should not be instantiated (can be made pure virtual once virtual methods are introduced).
Definition at line 45 of file serializer.hpp.
|
inline |
constructor
Definition at line 49 of file serializer.hpp.
|
inline |
add arbitrary value to the stream
Type | the type of the value |
value | the value to add |
Definition at line 158 of file serializer.hpp.
References writeToStream().
Referenced by endChecksumGroupForWrite(), cass::operator<<(), jocassview::IdList::serialize(), cass::CASSEvent::serialize(), cass::ACQIRISTDC::Channel::serialize(), cass::IdList::serialize(), cass::ACQIRIS::Instrument::serialize(), cass::ACQIRIS::Channel::serialize(), cass::MachineData::Device::serialize(), cass::pixeldetector::Detector::serialize(), cass::ACQIRISTDC::Instrument::serialize(), cass::ACQIRIS::Device::serialize(), cass::pixeldetector::Device::serialize(), cass::ACQIRISTDC::Device::serialize(), and cass::Serializable::writeVersion().
|
inlineprotected |
fletcher16 algorithm for 8 bit input
data | the data to add to the fletcher algorithm |
len | the size of the data to be added to the fletcher algorithm |
Definition at line 205 of file serializer.hpp.
References r_sum1, and r_sum2.
Referenced by readFromStream().
|
inlineprotected |
fletcher16 algorithm for 8 bit input
data | the data to add to the fletcher algorithm |
len | the size of the data to be added to the fletcher algorithm |
Definition at line 184 of file serializer.hpp.
References w_sum1, and w_sum2.
Referenced by writeToStream().
|
inline |
finalize checksum:
Definition at line 112 of file serializer.hpp.
References _checkSumGroupStartedForRead, r_sum1, and r_sum2.
Referenced by cass::IdList::deserialize(), and jocassview::IdList::deserialize().
|
inline |
finalize checksum:
Definition at line 141 of file serializer.hpp.
References _checkSumGroupStartedForWrite, add(), w_sum1, and w_sum2.
Referenced by jocassview::IdList::serialize(), and cass::IdList::serialize().
|
inline |
|
inline |
read data from the stream
data | the data to write |
n | size of the data |
Definition at line 83 of file serializer.hpp.
References _checkSumGroupStartedForRead, _stream, and addToInChecksum().
Referenced by retrieve().
|
inline |
read arbitrary value from stream
Type | the type of the value |
Definition at line 169 of file serializer.hpp.
References readFromStream(), and value.
Referenced by cass::Serializable::checkVersion(), cass::IdList::deserialize(), cass::CASSEvent::deserialize(), jocassview::IdList::deserialize(), cass::ACQIRISTDC::Channel::deserialize(), cass::ACQIRIS::Instrument::deserialize(), cass::ACQIRIS::Channel::deserialize(), cass::MachineData::Device::deserialize(), cass::pixeldetector::Detector::deserialize(), cass::ACQIRISTDC::Instrument::deserialize(), cass::ACQIRIS::Device::deserialize(), cass::pixeldetector::Device::deserialize(), cass::ACQIRISTDC::Device::deserialize(), and cass::operator>>().
|
inline |
control checksum calculation for the next values added
usage: add...; add...; startChecksumGroupforRead(); add...; add...; if (!endChecksumGroupForRead()) error();
Definition at line 106 of file serializer.hpp.
References _checkSumGroupStartedForRead, r_sum1, and r_sum2.
Referenced by cass::IdList::deserialize(), and jocassview::IdList::deserialize().
|
inline |
control checksum for writing to stream
usage: retrieve...; retrieve...; startChecksumGroupforWrite(); retrieve...; retrieve...; endChecksumGroupForWrite();
Definition at line 135 of file serializer.hpp.
References _checkSumGroupStartedForWrite, w_sum1, and w_sum2.
Referenced by jocassview::IdList::serialize(), and cass::IdList::serialize().
|
inline |
write data to the stream
data | the data to write |
n | size of the data |
Definition at line 71 of file serializer.hpp.
References _checkSumGroupStartedForWrite, _stream, and addToOutChecksum().
Referenced by add().
|
protected |
flag to enable getting parts to a checksum
Definition at line 236 of file serializer.hpp.
Referenced by endChecksumGroupForRead(), readFromStream(), and startChecksumGroupForRead().
|
protected |
flag to enable adding parts to a checksum
Definition at line 239 of file serializer.hpp.
Referenced by endChecksumGroupForWrite(), startChecksumGroupForWrite(), and writeToStream().
|
protected |
the string to serialize the objects to (buffer)
Definition at line 221 of file serializer.hpp.
Referenced by cass::Serializer::buffer(), cass::SerializerWriteFile::close(), cass::SerializerReadFile::close(), flush(), readFromStream(), cass::Serializer::Serializer(), cass::SerializerReadFile::SerializerReadFile(), cass::SerializerWriteFile::SerializerWriteFile(), writeToStream(), cass::Serializer::~Serializer(), cass::SerializerReadFile::~SerializerReadFile(), and cass::SerializerWriteFile::~SerializerWriteFile().
|
protected |
sum 1 for reading
Definition at line 224 of file serializer.hpp.
Referenced by addToInChecksum(), endChecksumGroupForRead(), and startChecksumGroupForRead().
|
protected |
sum 2 for reading
Definition at line 227 of file serializer.hpp.
Referenced by addToInChecksum(), endChecksumGroupForRead(), and startChecksumGroupForRead().
|
protected |
sum 1 for writing
Definition at line 230 of file serializer.hpp.
Referenced by addToOutChecksum(), endChecksumGroupForWrite(), and startChecksumGroupForWrite().
|
protected |
sum 2 for writing
Definition at line 233 of file serializer.hpp.
Referenced by addToOutChecksum(), endChecksumGroupForWrite(), and startChecksumGroupForWrite().