ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetRawEvent
InDetRawData
InDetRawData
ContainerRangeGuard.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#ifndef PHASEII_CONTAINERRANGEGUARD_H
5
#define PHASEII_CONTAINERRANGEGUARD_H
6
7
namespace
PhaseII
{
8
9
// test whether the given container collection allows to ask for a new container
10
template
<
typename
T_ContainerCollection>
11
concept
hasDynamicContainerList
=
requires
(T_ContainerCollection &
a
) {
a
.getNewContainerPtr(); };
12
13
// test whether the given container ptr has an associated container id.
14
template
<
typename
T_ContainerPtr>
15
concept
hasContainerId
=
requires
(T_ContainerPtr &
a
) {
a
.containerId(); };
16
31
template
<
typename
T_RangeType,
typename
T_ContainerPtr>
32
class
ContainerRangeGuard
{
33
public
:
34
ContainerRangeGuard
(T_ContainerPtr
ptr
) :
m_ptr
(
ptr
),
m_startIndex
(
m_ptr
->
size
()) {}
36
T_RangeType
range
()
const
{
37
if
constexpr
(
hasContainerId<T_ContainerPtr>
) {
38
return
T_RangeType::makeDataRange(
m_startIndex
,
m_ptr
->size(),
m_ptr
.containerId());
39
}
40
else
{
41
return
T_RangeType::makeDataRange(
m_startIndex
,
m_ptr
->size(),0u);
42
}
43
}
44
std::size_t
startIndex
()
const
{
45
return
m_startIndex
;
46
}
47
48
T_ContainerPtr &
ptr
() {
49
return
m_ptr
;
50
}
51
52
const
T_ContainerPtr &
ptr
()
const
{
53
return
m_ptr
;
54
}
55
57
bool
empty
()
const
{
58
return
m_ptr
->size() ==
m_startIndex
;
59
}
60
private
:
61
T_ContainerPtr
m_ptr
;
62
std::size_t
m_startIndex
;
63
};
64
}
65
66
#endif
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
size
size_t size() const
Number of registered mappings.
PhaseII::ContainerRangeGuard::m_ptr
T_ContainerPtr m_ptr
Definition
ContainerRangeGuard.h:61
PhaseII::ContainerRangeGuard::ptr
T_ContainerPtr & ptr()
return the pointer to the container which contains the element range of this range guard
Definition
ContainerRangeGuard.h:48
PhaseII::ContainerRangeGuard::ptr
const T_ContainerPtr & ptr() const
return the pointer to the container which contains the element range of this range guard (read only)
Definition
ContainerRangeGuard.h:52
PhaseII::ContainerRangeGuard::ContainerRangeGuard
ContainerRangeGuard(T_ContainerPtr ptr)
Definition
ContainerRangeGuard.h:34
PhaseII::ContainerRangeGuard::startIndex
std::size_t startIndex() const
Definition
ContainerRangeGuard.h:44
PhaseII::ContainerRangeGuard::range
T_RangeType range() const
create a range for the elements added to the container since the guard was created.
Definition
ContainerRangeGuard.h:36
PhaseII::ContainerRangeGuard::empty
bool empty() const
return true if no elements have been added to the container since the construction of this guard.
Definition
ContainerRangeGuard.h:57
PhaseII::ContainerRangeGuard::m_startIndex
std::size_t m_startIndex
Definition
ContainerRangeGuard.h:62
PhaseII::hasContainerId
Definition
ContainerRangeGuard.h:15
PhaseII::hasDynamicContainerList
Definition
ContainerRangeGuard.h:11
PhaseII
Definition
ContainerRangeGuard.h:7
Generated on
for ATLAS Offline Software by
1.17.0