ATLAS Offline Software
PackedLinkImpl.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-2024 CERN for the benefit of the ATLAS collaboration.
4  */
17 #ifndef ATHCONTAINERS_PACKEDLINKIMPL_H
18 #define ATHCONTAINERS_PACKEDLINKIMPL_H
19 
20 
21 #ifndef XAOD_STANDALONE
23 #endif
24 #include "CxxUtils/ones.h"
25 #include <concepts>
26 #include <cstdint>
27 #include <cassert>
28 
29 
30 namespace SG {
31 
32 
47 {
48  static constexpr unsigned NBITS = 32;
49  static constexpr unsigned COLLECTION_NBITS = 8;
50  static constexpr unsigned INDEX_NBITS = NBITS - COLLECTION_NBITS;
51  static constexpr uint32_t COLLECTION_MAX = CxxUtils::ones<uint32_t> (COLLECTION_NBITS);
52  static constexpr uint32_t INDEX_MAX = CxxUtils::ones<uint32_t> (INDEX_NBITS);
53 
60 
61 
67  PackedLinkBase (unsigned int collection, unsigned int index);
68 
69 
74  bool operator== (const PackedLinkBase& other) const;
75 
76 
80  unsigned int collection() const;
81 
82 
86  unsigned int index() const;
87 
88 
93  void setCollection (unsigned int collection);
94 
95 
100  void setIndex (unsigned int index);
101 
102 
103 private:
106 };
107 
108 
114 template <class STORABLE>
115 #ifndef XAOD_STANDALONE
116 // To be usable as a packed link, the index must be integral.
118 #endif
119 struct PackedLink
120  : public PackedLinkBase
121 {
122 public:
124 };
125 
126 
127 } // namespace SG
128 
129 
131 
132 
133 #endif // not ATHCONTAINERS_PACKEDLINKIMPL_H
SG::PackedLinkBase::COLLECTION_MAX
static constexpr uint32_t COLLECTION_MAX
Definition: PackedLinkImpl.h:51
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
integral
double integral(TH1 *h)
Definition: computils.cxx:57
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
index
Definition: index.py:1
ElementLinkTraits.h
Determine dependent types for ElementLink classes.
SG::PackedLinkBase::setCollection
void setCollection(unsigned int collection)
Set the collection index;.
SG::PackedLinkBase::INDEX_NBITS
static constexpr unsigned INDEX_NBITS
Definition: PackedLinkImpl.h:50
SG::PackedLinkBase::m_packed
uint32_t m_packed
The packed form of the link.
Definition: PackedLinkImpl.h:105
SG::ElementLinkTraits
ElementLinkTraits class to specialize.
Definition: ElementLinkTraits.h:193
SG::PackedLinkBase::INDEX_MAX
static constexpr uint32_t INDEX_MAX
Definition: PackedLinkImpl.h:52
ones.h
Construct a bit mask.
SG::PackedLinkBase::NBITS
static constexpr unsigned NBITS
Definition: PackedLinkImpl.h:48
PackedLinkImpl.icc
SG::PackedLinkBase::PackedLinkBase
PackedLinkBase(unsigned int collection, unsigned int index)
Constructor.
SG::PackedLinkBase::operator==
bool operator==(const PackedLinkBase &other) const
Comparison.
SG::PackedLinkBase::setIndex
void setIndex(unsigned int index)
Set the element index;.
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
SG::PackedLinkBase
A packed version of ElementLink.
Definition: PackedLinkImpl.h:47
SG::PackedLinkBase::index
unsigned int index() const
Unpack the element index from the link.
SG::PackedLinkBase::PackedLinkBase
PackedLinkBase()
Default constructor.
SG::PackedLinkBase::COLLECTION_NBITS
static constexpr unsigned COLLECTION_NBITS
Definition: PackedLinkImpl.h:49
SG::PackedLinkBase::collection
unsigned int collection() const
Unpack the collection index from the link.