ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthContainers
AthContainers
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
*/
15
16
17
#ifndef ATHCONTAINERS_PACKEDLINKIMPL_H
18
#define ATHCONTAINERS_PACKEDLINKIMPL_H
19
20
21
#ifndef XAOD_STANDALONE
22
#include "
AthLinks/tools/ElementLinkTraits.h
"
23
#endif
24
#include "
CxxUtils/ones.h
"
25
#include <concepts>
26
#include <cstdint>
27
#include <cassert>
28
29
30
namespace
SG
{
31
32
46
struct
PackedLinkBase
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
59
PackedLinkBase
();
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
:
105
uint32_t
m_packed
;
106
};
107
108
114
template
<
class
STORABLE>
115
#ifndef XAOD_STANDALONE
116
// To be usable as a packed link, the index must be integral.
117
requires
(std::integral<typename SG::ElementLinkTraits<STORABLE>::IndexingPolicy::index_type>)
118
#endif
119
struct
PackedLink
120
: public
PackedLinkBase
121
{
122
public
:
123
using
PackedLinkBase::PackedLinkBase
;
124
};
125
126
127
}
// namespace SG
128
129
130
#include "
AthContainers/PackedLinkImpl.icc
"
131
132
133
#endif
// not ATHCONTAINERS_PACKEDLINKIMPL_H
ElementLinkTraits.h
Determine dependent types for ElementLink classes.
PackedLinkImpl.icc
CxxUtils::ones
constexpr T ones(unsigned int n)
Return a bit mask with the lower n bits set.
Definition
ones.h:25
SG
Forward declaration.
Definition
CaloCellPacker_400_500.h:32
index
Definition
index.py:1
ones.h
Construct a bit mask.
SG::PackedLinkBase::PackedLinkBase
PackedLinkBase()
Default constructor.
SG::PackedLinkBase::operator==
bool operator==(const PackedLinkBase &other) const
Comparison.
SG::PackedLinkBase::INDEX_MAX
static constexpr uint32_t INDEX_MAX
Definition
PackedLinkImpl.h:52
SG::PackedLinkBase::collection
unsigned int collection() const
Unpack the collection index from the link.
SG::PackedLinkBase::index
unsigned int index() const
Unpack the element index from the link.
SG::PackedLinkBase::INDEX_NBITS
static constexpr unsigned INDEX_NBITS
Definition
PackedLinkImpl.h:50
SG::PackedLinkBase::PackedLinkBase
PackedLinkBase(unsigned int collection, unsigned int index)
Constructor.
SG::PackedLinkBase::setIndex
void setIndex(unsigned int index)
Set the element index;.
SG::PackedLinkBase::m_packed
uint32_t m_packed
The packed form of the link.
Definition
PackedLinkImpl.h:105
SG::PackedLinkBase::COLLECTION_MAX
static constexpr uint32_t COLLECTION_MAX
Definition
PackedLinkImpl.h:51
SG::PackedLinkBase::COLLECTION_NBITS
static constexpr unsigned COLLECTION_NBITS
Definition
PackedLinkImpl.h:49
SG::PackedLinkBase::NBITS
static constexpr unsigned NBITS
Definition
PackedLinkImpl.h:48
SG::PackedLinkBase::setCollection
void setCollection(unsigned int collection)
Set the collection index;.
SG::PackedLink
A packed version of ElementLink.
Definition
PackedLinkImpl.h:121
SG::PackedLink::PackedLinkBase
PackedLinkBase()
Default constructor.
Generated on
for ATLAS Offline Software by
1.17.0