ATLAS Offline Software
|
Helper for packing/unpacking a PackedContainer
to/from a stream.
More...
#include <PackedConverter.h>
Public Member Functions | |
PackedConverter (const PackedParameters &parms) | |
Constructor. More... | |
template<class U , class ALLOC , class STREAM > | |
void | write (size_t nelt, const std::vector< U, ALLOC > &vec, STREAM &stream) |
Pack a vector to the stream. More... | |
template<class U , class ALLOC1 , class ALLOC2 , class STREAM > | |
void | write (size_t nelt, const std::vector< std::vector< U, ALLOC1 >, ALLOC2 > &vec, STREAM &stream) |
Pack a nested vector to the stream. More... | |
template<class U , class ALLOC , class STREAM > | |
void | read (size_t nelt, std::vector< U, ALLOC > &vec, STREAM &stream) |
Unpack a vector from the stream. More... | |
template<class U , class ALLOC1 , class ALLOC2 , class STREAM > | |
void | read (size_t nelt, std::vector< std::vector< U, ALLOC1 >, ALLOC2 > &vec, STREAM &stream) |
Unpack a nested vector from the stream. More... | |
Private Member Functions | |
template<template< class > class PACKER, class U , class ALLOC , class STREAM > | |
void | writeUnsigned (size_t nelt, const std::vector< U, ALLOC > &vec, STREAM &stream) |
Pack a vector of unsigned values to the stream. More... | |
template<template< class > class PACKER, class U , class ALLOC , class STREAM > | |
void | writeSigned (size_t nelt, const std::vector< U, ALLOC > &vec, STREAM &stream) |
Pack a vector of signed values to the stream. More... | |
template<template< class > class PACKER, class U , class ALLOC , class STREAM > | |
void | writeFloat (size_t nelt, const std::vector< U, ALLOC > &vec, STREAM &stream) |
Pack a vector of float values to the stream. More... | |
template<template< class > class UNPACKER, class U , class ALLOC , class STREAM > | |
void | readUnsigned (size_t nelt, std::vector< U, ALLOC > &vec, STREAM &stream) |
Unpack a vector of unsigned values from the stream. More... | |
template<template< class > class UNPACKER, class U , class ALLOC , class STREAM > | |
void | readSigned (size_t nelt, std::vector< U, ALLOC > &vec, STREAM &stream) |
Unpack a vector of signed values from the stream. More... | |
template<template< class > class UNPACKER, class U , class ALLOC , class STREAM > | |
void | readFloat (size_t nelt, std::vector< U, ALLOC > &vec, STREAM &stream) |
Unpack a vector of floating-point values from the stream. More... | |
Private Attributes | |
PackedParameters | m_parms |
The parameters to use for the packing. More... | |
CxxUtils::FloatPacker | m_packer |
Object to pack/unpack floating-point values. More... | |
Helper for packing/unpacking a PackedContainer
to/from a stream.
This object should be created with the packing parameters to use. After that, call the read or write methods. These are all templated methods taking a vector
as input; this should be the vector contained within the PackedContainer
. Additional overloads are supplied taking vector<vector
>. These read/write the element count, then call read/write for each element of the vector. This should allow for arbitrary vector nesting.
The methods are also templated on the input/output stream. This should support operator<< and operator>> for a uint32_t; a ROOT TBuffer
will satisfy this.
Definition at line 43 of file PackedConverter.h.
SG::PackedConverter::PackedConverter | ( | const PackedParameters & | parms | ) |
Constructor.
parms | The parameters describing the packed data. |
Definition at line 24 of file PackedConverter.cxx.
void SG::PackedConverter::read | ( | size_t | nelt, |
std::vector< std::vector< U, ALLOC1 >, ALLOC2 > & | vec, | ||
STREAM & | stream | ||
) |
Unpack a nested vector from the stream.
nelt | Number of elements to unpack. |
vec | Vector to receive the unpacked elements. |
stream | Source stream. |
void SG::PackedConverter::read | ( | size_t | nelt, |
std::vector< U, ALLOC > & | vec, | ||
STREAM & | stream | ||
) |
Unpack a vector from the stream.
nelt | Number of elements to unpack. |
vec | Vector to receive the unpacked elements. |
stream | Source stream. |
|
private |
Unpack a vector of floating-point values from the stream.
nelt | Number of elements to unpack. |
vec | Vector to receive the unpacked elements. |
stream | Source stream. |
|
private |
Unpack a vector of signed values from the stream.
nelt | Number of elements to unpack. |
vec | Vector to receive the unpacked elements. |
stream | Source stream. |
|
private |
Unpack a vector of unsigned values from the stream.
nelt | Number of elements to unpack. |
vec | Vector to receive the unpacked elements. |
stream | Source stream. |
void SG::PackedConverter::write | ( | size_t | nelt, |
const std::vector< std::vector< U, ALLOC1 >, ALLOC2 > & | vec, | ||
STREAM & | stream | ||
) |
Pack a nested vector to the stream.
nelt | Number of elements to pack. |
vec | Vector of elements to pack. |
stream | Destination stream. |
void SG::PackedConverter::write | ( | size_t | nelt, |
const std::vector< U, ALLOC > & | vec, | ||
STREAM & | stream | ||
) |
Pack a vector to the stream.
nelt | Number of elements to pack. |
vec | Vector of elements to pack. |
stream | Destination stream. |
|
private |
Pack a vector of float values to the stream.
nelt | Number of elements to pack. |
vec | Vector of elements to pack. |
stream | Destination stream. |
|
private |
Pack a vector of signed values to the stream.
nelt | Number of elements to pack. |
vec | Vector of elements to pack. |
stream | Destination stream. |
|
private |
Pack a vector of unsigned values to the stream.
nelt | Number of elements to pack. |
vec | Vector of elements to pack. |
stream | Destination stream. |
|
private |
Object to pack/unpack floating-point values.
Definition at line 178 of file PackedConverter.h.
|
private |
The parameters to use for the packing.
Definition at line 175 of file PackedConverter.h.