ATLAS Offline Software
Loading...
Searching...
No Matches
PackedConverter.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2/*
3 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4*/
11
12
13#ifndef ATHCONTAINERS_PACKEDCONVERTER_H
14#define ATHCONTAINERS_PACKEDCONVERTER_H
15
16
19#include "CxxUtils/BitPacker.h"
21#include <vector>
22#include <stdint.h>
23
24
25namespace SG {
26
27
44{
45public:
50 PackedConverter (const PackedParameters& parms);
51
52
59 template <class U, class ALLOC, class STREAM>
60 void write (size_t nelt,
61 const std::vector<U, ALLOC>& vec,
62 STREAM& stream);
63
64
71 template <class U, class ALLOC1, class ALLOC2, class STREAM>
72 void write (size_t nelt,
73 const std::vector<std::vector<U, ALLOC1>, ALLOC2>& vec,
74 STREAM& stream);
75
76
83 template <class U, class ALLOC, class STREAM>
84 void read (size_t nelt,
85 std::vector<U, ALLOC>& vec,
86 STREAM& stream);
87
88
95 template <class U, class ALLOC1, class ALLOC2, class STREAM>
96 void read (size_t nelt,
97 std::vector<std::vector<U, ALLOC1>, ALLOC2>& vec,
98 STREAM& stream);
99
100
101private:
108 template <template<class> class PACKER, class U, class ALLOC, class STREAM>
109 void writeUnsigned (size_t nelt,
110 const std::vector<U, ALLOC>& vec,
111 STREAM& stream);
112
113
120 template <template<class> class PACKER, class U, class ALLOC, class STREAM>
121 void writeSigned (size_t nelt,
122 const std::vector<U, ALLOC>& vec,
123 STREAM& stream);
124
125
132 template <template<class> class PACKER, class U, class ALLOC, class STREAM>
133 void writeFloat (size_t nelt,
134 const std::vector<U, ALLOC>& vec,
135 STREAM& stream);
136
137
144 template <template<class> class UNPACKER, class U, class ALLOC, class STREAM>
145 void readUnsigned (size_t nelt,
146 std::vector<U, ALLOC>& vec,
147 STREAM& stream);
148
149
156 template <template<class> class UNPACKER, class U, class ALLOC, class STREAM>
157 void readSigned (size_t nelt,
158 std::vector<U, ALLOC>& vec,
159 STREAM& stream);
160
161
162
169 template <template<class> class UNPACKER, class U, class ALLOC, class STREAM>
170 void readFloat (size_t nelt,
171 std::vector<U, ALLOC>& vec,
172 STREAM& stream);
173
176
179};
180
181
182} // namespace SG
183
184
186
187
188#endif // not ATHCONTAINERS_PACKEDCONVERTER_H
Helper to pack a set of values bitwise into a stream.
Helper to unpack a set of values bitwise from a stream.
std::vector< size_t > vec
Pack/unpack floating-point data from/to a given number of bits.
Describe how the contents of a PackedContainer are to be saved.
Pack/unpack floating-point data from/to a given number of bits.
Definition FloatPacker.h:58
void writeUnsigned(size_t nelt, const std::vector< U, ALLOC > &vec, STREAM &stream)
Pack a vector of unsigned values to the stream.
void write(size_t nelt, const std::vector< U, ALLOC > &vec, STREAM &stream)
Pack a vector to the stream.
void read(size_t nelt, std::vector< U, ALLOC > &vec, STREAM &stream)
Unpack a vector from the stream.
void read(size_t nelt, std::vector< std::vector< U, ALLOC1 >, ALLOC2 > &vec, STREAM &stream)
Unpack a nested vector from the stream.
void readUnsigned(size_t nelt, std::vector< U, ALLOC > &vec, STREAM &stream)
Unpack a vector of unsigned values from the stream.
void writeFloat(size_t nelt, const std::vector< U, ALLOC > &vec, STREAM &stream)
Pack a vector of float values to the stream.
PackedConverter(const PackedParameters &parms)
Constructor.
void write(size_t nelt, const std::vector< std::vector< U, ALLOC1 >, ALLOC2 > &vec, STREAM &stream)
Pack a nested vector to the stream.
CxxUtils::FloatPacker m_packer
Object to pack/unpack floating-point values.
void readSigned(size_t nelt, std::vector< U, ALLOC > &vec, STREAM &stream)
Unpack a vector of signed values from the stream.
void writeSigned(size_t nelt, const std::vector< U, ALLOC > &vec, STREAM &stream)
Pack a vector of signed values to the stream.
void readFloat(size_t nelt, std::vector< U, ALLOC > &vec, STREAM &stream)
Unpack a vector of floating-point values from the stream.
PackedParameters m_parms
The parameters to use for the packing.
Describe how the contents of a PackedContainer are to be saved.
Forward declaration.