ATLAS Offline Software
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$
16 #ifndef ATHCONTAINERS_PACKEDPARAMETERS_H
17 #define ATHCONTAINERS_PACKEDPARAMETERS_H
18 
19 
21 #include <limits>
22 #include <stdint.h>
23 
24 
25 namespace SG {
26 
27 
66 {
67 public:
74 
75 
87 
88 
96  template <class T>
98 
99 
103  uint8_t nbits() const;
104 
105 
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 
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 {
267  FLAG_IS_SIGNED = (1<<0),
268  FLAG_IS_FLOAT = (1<<1),
269  FLAG_HAS_SCALE = (1<<2),
270  FLAG_ROUNDING = (1<<3),
271  };
272 
273 
274 private:
277 
281 
283  float m_scale;
284 
287 };
288 
289 
290 } // namespace SG
291 
292 
294 
295 
296 #endif // not ATHCONTAINERS_PACKEDPARAMETERS_H
297 
SG::PackedParameters::setOption
bool setOption(const AuxDataOption &option)
Set a packing option.
Definition: PackedParameters.cxx:222
SG::PackedParameters::PackedParameters
PackedParameters()
Default constructor.
Definition: PackedParameters.cxx:25
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
SG::PackedParameters::flags
uint8_t flags() const
Additional flags describing the packing.
SG::PackedParameters::m_flags
uint8_t m_flags
Additional flags.
Definition: PackedParameters.h:286
SG::PackedParameters::setNbits
bool setNbits(uint8_t nbits)
Set the number of bits to be used for each element.
Definition: PackedParameters.cxx:69
AuxDataOption.h
Hold information about an option setting request.
SG::PackedParameters::m_nmantissa
uint8_t m_nmantissa
The number of bits for the mantissa of floating-point representations.
Definition: PackedParameters.h:280
SG::PackedParameters::setFloat
bool setFloat(bool flag)
Set the floating-point flag.
Definition: PackedParameters.cxx:180
SG::PackedParameters::isSigned
bool isSigned() const
Are elements being written as signed numbers?
SG::PackedParameters::FLAG_HAS_SCALE
@ FLAG_HAS_SCALE
Definition: PackedParameters.h:269
SG::PackedParameters::nmantissa
uint8_t nmantissa() const
The number of bits used for the mantissa portion of a float-point representation, excluding a sign bi...
SG::PackedParameters::hasScale
bool hasScale() const
Should floats be rescaled before writing?
SG::PackedParameters::isFloat
bool isFloat() const
Are elements being written as floating-point numbers?
master.flag
bool flag
Definition: master.py:29
SG::PackedParameters::nbits
uint8_t nbits() const
The number of bits used to store each element.
SG::PackedParameters::PackedParameters
PackedParameters(T)
Initialize with default packing parameters for type T.
SG::PackedParameters::setNmantissa
bool setNmantissa(uint8_t nmantissa)
Set the number of mantissa bits used in the packed representation.
Definition: PackedParameters.cxx:95
PackedParameters.icc
SG::AuxDataOption
Hold information about an option setting request.
Definition: AuxDataOption.h:37
SG::PackedParameters::FLAG_IS_FLOAT
@ FLAG_IS_FLOAT
Definition: PackedParameters.h:268
SG::PackedParameters::FLAG_IS_SIGNED
@ FLAG_IS_SIGNED
Definition: PackedParameters.h:267
SG::PackedParameters::isValidOption
static bool isValidOption(const AuxDataOption &option)
Test to see if option is a recognized packing option.
Definition: PackedParameters.cxx:197
SG::PackedParameters::setScale
bool setScale(float scale)
Set the scale to use when packing floating-point data.
Definition: PackedParameters.cxx:116
SG::PackedParameters::m_nbits
uint8_t m_nbits
The number of bits to use for each element.
Definition: PackedParameters.h:276
SG::PackedParameters::rounding
bool rounding() const
Should floats be rounded during writing?
SG::PackedParameters::m_scale
float m_scale
If nonzero, divide floating-point numbers by this before writing.
Definition: PackedParameters.h:283
SG::PackedParameters::setRounding
bool setRounding(bool flag)
Set the rounding mode.
Definition: PackedParameters.cxx:161
SG::PackedParameters::scale
float scale() const
Return the scale for floating-point numbers.
SG::PackedParameters::FLAG_ROUNDING
@ FLAG_ROUNDING
Definition: PackedParameters.h:270
SG::PackedParameters
Describe how the contents of a PackedContainer are to be saved.
Definition: PackedParameters.h:66
SG::PackedParameters::setSigned
bool setSigned(bool flag)
Set the signedness flag for the packed representation.
Definition: PackedParameters.cxx:138