ATLAS Offline Software
Loading...
Searching...
No Matches
PackedParameters.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/*
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5*/
6
7// $Id$
14
15
16#ifndef ATHCONTAINERS_PACKEDPARAMETERS_H
17#define ATHCONTAINERS_PACKEDPARAMETERS_H
18
19
21#include <limits>
22#include <stdint.h>
23
24
25namespace SG {
26
27
66{
67public:
74
75
86 PackedParameters (uint8_t nbits, uint8_t flags);
87
88
96 template <class T>
98
99
103 uint8_t nbits() const;
104
105
114 uint8_t nmantissa() const;
115
116
122 uint8_t flags() const;
123
124
131 float scale() const;
132
133
137 bool isSigned() const;
138
139
143 bool isFloat() const;
144
145
149 bool hasScale() const;
150
151
155 bool rounding() const;
156
157
170 bool setNbits (uint8_t nbits);
171
172
186 bool setNmantissa (uint8_t nmantissa);
187
188
200 bool setScale (float scale);
201
202
214 bool setSigned (bool flag);
215
216
225 bool setRounding (bool flag);
226
227
237 bool setFloat (bool flag);
238
239
247 static bool isValidOption (const AuxDataOption& option);
248
249
260 bool setOption (const AuxDataOption& option);
261
262
266 enum {
271 };
272
273
274private:
276 uint8_t m_nbits;
277
280 uint8_t m_nmantissa;
281
283 float m_scale;
284
286 uint8_t m_flags;
287};
288
289
290} // namespace SG
291
292
294
295
296#endif // not ATHCONTAINERS_PACKEDPARAMETERS_H
297
Hold information about an option setting request.
Hold information about an option setting request.
static bool isValidOption(const AuxDataOption &option)
Test to see if option is a recognized packing option.
uint8_t m_flags
Additional flags.
bool hasScale() const
Should floats be rescaled before writing?
bool setRounding(bool flag)
Set the rounding mode.
bool setNbits(uint8_t nbits)
Set the number of bits to be used for each element.
bool isSigned() const
Are elements being written as signed numbers?
bool setOption(const AuxDataOption &option)
Set a packing option.
bool setFloat(bool flag)
Set the floating-point flag.
PackedParameters(T)
Initialize with default packing parameters for type T.
bool isFloat() const
Are elements being written as floating-point numbers?
bool setNmantissa(uint8_t nmantissa)
Set the number of mantissa bits used in the packed representation.
uint8_t nbits() const
The number of bits used to store each element.
uint8_t m_nmantissa
The number of bits for the mantissa of floating-point representations.
bool setScale(float scale)
Set the scale to use when packing floating-point data.
bool rounding() const
Should floats be rounded during writing?
float m_scale
If nonzero, divide floating-point numbers by this before writing.
uint8_t nmantissa() const
The number of bits used for the mantissa portion of a float-point representation, excluding a sign bi...
bool setSigned(bool flag)
Set the signedness flag for the packed representation.
float scale() const
Return the scale for floating-point numbers.
PackedParameters()
Default constructor.
uint8_t m_nbits
The number of bits to use for each element.
uint8_t flags() const
Additional flags describing the packing.
Forward declaration.