|
ATLAS Offline Software
|
Go to the documentation of this file.
15 #include "TClassStreamer.h"
16 #include "TMemberStreamer.h"
72 template <
class T,
class ALLOC>
74 :
public TClassStreamer
88 virtual void operator()(TBuffer &
b,
void *objp)
override;
94 virtual TClassStreamer*
Generate()
const override;
106 template <
class T,
class ALLOC>
118 template <
class T,
class ALLOC>
125 Version_t R__v =
b.ReadVersion(&R__s, &R__c);
127 Error (
"PackedContainerStreamer",
128 "Bad version %d for object of type %s (expected 1)",
129 R__v, m_className.c_str());
138 cnv.
read (nelt, *cont,
b);
140 b.CheckByteCount(R__s, R__c, m_className.c_str());
143 UInt_t R__c =
b.Length();
144 b.SetBufferOffset (R__c +
sizeof(UInt_t));
152 cnv.
write (cont->size(), *cont,
b);
154 b.SetByteCount(R__c, kTRUE);
162 template <
class T,
class ALLOC>
169 template <
class T,
class ALLOC>
176 #define STREAMER1(TYPE, ALLOC) \
177 namespace ROOT { TGenericClassInfo* GenerateInitInstance(const SG::PackedContainer<TYPE, ALLOC>*);} \
179 template <> struct InstallPackedContainerStreamer<TYPE, ALLOC> { \
180 InstallPackedContainerStreamer() { \
181 ROOT::GenerateInitInstance((SG::PackedContainer<TYPE, ALLOC>*)nullptr)->AdoptStreamer (new PackedContainerStreamer<TYPE, ALLOC>) ; \
183 InstallPackedContainerStreamer<TYPE, ALLOC> _R__UNIQUE_(streamerInstance); \
184 } class swallowSemicolon
186 #define STREAMER(TYPE) STREAMER1(TYPE, std::allocator<TYPE>)
208 STREAMER(std::vector<std::vector<unsigned char> >);
210 STREAMER(std::vector<std::vector<unsigned short> >);
Container to hold aux data to be stored in a packed form.
void writePackedParameters(TBuffer &b, const SG::PackedParameters &parms)
Write a set of packed parameters to a buffer.
uint8_t flags() const
Additional flags describing the packing.
PackedContainerStreamer()
Constructor.
uint8_t nmantissa() const
The number of bits used for the mantissa portion of a float-point representation, excluding a sign bi...
Streamer for reading/writing SG::PackedContainer instances.
virtual TClassStreamer * Generate() const override
Clone operation, required for MT.
bool hasScale() const
Should floats be rescaled before writing?
bool isFloat() const
Are elements being written as floating-point numbers?
Helper for packing/unpacking a PackedContainer to/from a stream.
An interface for getting the name of a class as a string.
void setParms(const PackedParameters &parms)
Set the packing parameters.
uint8_t nbits() const
The number of bits used to store each element.
bool setNmantissa(uint8_t nmantissa)
Set the number of mantissa bits used in the packed representation.
virtual void operator()(TBuffer &b, void *objp) override
Run the streamer.
const PackedParameters & parms() const
Return the packing parameters for this container.
void write(size_t nelt, const std::vector< U, ALLOC > &vec, STREAM &stream)
Pack a vector to the stream.
bool setScale(float scale)
Set the scale to use when packing floating-point data.
Container to hold aux data to be stored in a packed form.
SG::PackedParameters readPackedParameters(TBuffer &b)
Read a set of packed parameters from a buffer.
std::string m_className
Name of the class we read/write (for error messages).
void read(size_t nelt, std::vector< U, ALLOC > &vec, STREAM &stream)
Unpack a vector from the stream.
float scale() const
Return the scale for floating-point numbers.
Describe how the contents of a PackedContainer are to be saved.
Helper for packing/unpacking a PackedContainer to/from a stream.