ATLAS Offline Software
|
Utility class (not a tool or so) to serialize strings into stream of 32bit integers. More...
#include <StringSerializer.h>
Public Member Functions | |
void | serialize (const std::vector< std::string > &strings, std::vector< uint32_t > &storage) |
Serializes vector of strings into vector of integers. More... | |
void | serialize (const std::string &str, std::vector< uint32_t > &storage) |
std::size_t | deserialize (std::vector< uint32_t >::const_iterator first, std::vector< uint32_t >::const_iterator last, std::vector< std::string > &strings) |
Deserialize vector into strings. More... | |
std::size_t | deserialize (const std::vector< uint32_t > &storage, std::vector< std::string > &strings) |
Same as above but with vector instead of iterators. More... | |
std::vector< std::string > | deserialize (const std::vector< uint32_t > &storage) |
Same as above but return string by value (useful when invoked from Python) More... | |
std::size_t | deserialize (std::vector< uint32_t >::const_iterator first, std::vector< uint32_t >::const_iterator last, std::string &str) |
Deserialize one single string. More... | |
std::size_t | deserialize (const std::vector< uint32_t > &storage, std::string &str) |
Deserialize one single string More... | |
unsigned int | inquireSize (const std::vector< uint32_t > &storage) |
Return number of strings serialized into 'storage'. More... | |
Private Member Functions | |
unsigned int | getPadding (unsigned int sizeToReserve) |
Get number of padding bytes needed to align with uint32_t. More... | |
Private Attributes | |
std::ostringstream | m_ostream |
sstream used in serialization More... | |
std::istringstream | m_istream |
sstream used in de-serialization More... | |
Static Private Attributes | |
static const char *const | s_delimiter = "\n" |
default delimeter which is put between strings from the input vector while serialization happens More... | |
Utility class (not a tool or so) to serialize strings into stream of 32bit integers.
Definition at line 19 of file TrigDataAccess/TrigSerializeResult/TrigSerializeResult/StringSerializer.h.
|
inline |
Same as above but return string by value (useful when invoked from Python)
Definition at line 54 of file TrigDataAccess/TrigSerializeResult/TrigSerializeResult/StringSerializer.h.
|
inline |
Deserialize one single string
Definition at line 66 of file TrigDataAccess/TrigSerializeResult/TrigSerializeResult/StringSerializer.h.
|
inline |
Same as above but with vector instead of iterators.
Definition at line 49 of file TrigDataAccess/TrigSerializeResult/TrigSerializeResult/StringSerializer.h.
std::size_t StringSerializer::deserialize | ( | std::vector< uint32_t >::const_iterator | first, |
std::vector< uint32_t >::const_iterator | last, | ||
std::string & | str | ||
) |
Deserialize one single string.
Definition at line 107 of file TrigDataAccess/TrigSerializeResult/src/StringSerializer.cxx.
std::size_t StringSerializer::deserialize | ( | std::vector< uint32_t >::const_iterator | first, |
std::vector< uint32_t >::const_iterator | last, | ||
std::vector< std::string > & | strings | ||
) |
Deserialize vector into strings.
first | Beginning of 'byte-stream' |
last | End of 'byte-stream', i.e. vector::end() |
strings | Vector of strings to hold result |
Definition at line 62 of file TrigDataAccess/TrigSerializeResult/src/StringSerializer.cxx.
|
inlineprivate |
Get number of padding bytes needed to align with uint32_t.
Definition at line 80 of file TrigDataAccess/TrigSerializeResult/TrigSerializeResult/StringSerializer.h.
unsigned int StringSerializer::inquireSize | ( | const std::vector< uint32_t > & | storage | ) |
Return number of strings serialized into 'storage'.
Definition at line 119 of file TrigDataAccess/TrigSerializeResult/src/StringSerializer.cxx.
void StringSerializer::serialize | ( | const std::string & | str, |
std::vector< uint32_t > & | storage | ||
) |
void StringSerializer::serialize | ( | const std::vector< std::string > & | strings, |
std::vector< uint32_t > & | storage | ||
) |
Serializes vector of strings into vector of integers.
The number of strings (size of input vector) is put first into the stream. In case the strings is an empty vector the 0 is put into the storage.
strings | |
storage | is place where serizlized from of stings is appended to |
Definition at line 10 of file TrigDataAccess/TrigSerializeResult/src/StringSerializer.cxx.
|
private |
sstream used in de-serialization
Definition at line 85 of file TrigDataAccess/TrigSerializeResult/TrigSerializeResult/StringSerializer.h.
|
private |
sstream used in serialization
Definition at line 84 of file TrigDataAccess/TrigSerializeResult/TrigSerializeResult/StringSerializer.h.
default delimeter which is put between strings from the input vector while serialization happens
Definition at line 86 of file TrigDataAccess/TrigSerializeResult/TrigSerializeResult/StringSerializer.h.