SG::PackedConverter Class Reference

Helper for packing/unpacking a PackedContainer to/from a stream. More...

#include <PackedConverter.h>

List of all members.

Public Member Functions

 PackedConverter (const PackedParameters &parms)
 Constructor.
template<class U , class STREAM >
void write (size_t nelt, const std::vector< U > &vec, STREAM &stream)
 Pack a vector to the stream.
template<class U , class STREAM >
void write (size_t nelt, const std::vector< std::vector< U > > &vec, STREAM &stream)
 Pack a nested vector to the stream.
template<class U , class STREAM >
void read (size_t nelt, std::vector< U > &vec, STREAM &stream)
 Unpack a vector from the stream.
template<class U , class STREAM >
void read (size_t nelt, std::vector< std::vector< U > > &vec, STREAM &stream)
 Unpack a nested vector from the stream.

Detailed Description

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<U> as input; this should be the vector contained within the PackedContainer. Additional overloads are supplied taking vector<vector<U> >. 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.


Constructor & Destructor Documentation

SG::PackedConverter::PackedConverter ( const PackedParameters parms  ) 

Constructor.

Parameters:
parms The parameters describing the packed data.

Member Function Documentation

template<class U , class STREAM >
void SG::PackedConverter::read ( size_t  nelt,
std::vector< std::vector< U > > &  vec,
STREAM &  stream 
) [inline]

Unpack a nested vector from the stream.

Parameters:
nelt Number of elements to unpack.
vec Vector to receive the unpacked elements.
stream Source stream.
template<class U , class STREAM >
void SG::PackedConverter::read ( size_t  nelt,
std::vector< U > &  vec,
STREAM &  stream 
) [inline]

Unpack a vector from the stream.

Parameters:
nelt Number of elements to unpack.
vec Vector to receive the unpacked elements.
stream Source stream.
template<class U , class STREAM >
void SG::PackedConverter::write ( size_t  nelt,
const std::vector< std::vector< U > > &  vec,
STREAM &  stream 
) [inline]

Pack a nested vector to the stream.

Parameters:
nelt Number of elements to pack.
vec Vector of elements to pack.
stream Destination stream.
template<class U , class STREAM >
void SG::PackedConverter::write ( size_t  nelt,
const std::vector< U > &  vec,
STREAM &  stream 
) [inline]

Pack a vector to the stream.

Parameters:
nelt Number of elements to pack.
vec Vector of elements to pack.
stream Destination stream.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 1 Dec 2017 for RootCore Packages by  doxygen 1.6.1