ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsDataPreparation
src
details
RDOCollectionAdapter.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 ACTSTRK_RDOCOLLECTIONADAPTER_H
5
#define ACTSTRK_RDOCOLLECTIONADAPTER_H
6
7
namespace
ActsTrk
{
8
// helper class to adapt different RDO collections to have the same interface
9
// forward declaration needs dedicated implementation
10
template
<
typename
T_RDOContainer>
11
class
RDOCollectionAdapter
{
12
const
T_RDOContainer::base_value_type *
m_RDOs
;
13
public
:
14
RDOCollectionAdapter
(
const
typename
T_RDOContainer::base_value_type *RDOs)
15
:
m_RDOs
(RDOs)
16
{}
17
RDOCollectionAdapter
(
const
typename
T_RDOContainer::base_value_type &RDOs)
18
:
m_RDOs
(&RDOs)
19
{}
20
// test whether this object can be dereferenced to return the representation of a single module.
21
bool
isValid
()
const
{
22
return
m_RDOs
!=
nullptr
;
23
}
24
operator
bool()
const
{
return
isValid
();}
25
// dereferencing will return a representation of one module.
26
const
typename
T_RDOContainer::base_value_type &
operator*
()
const
{
27
assert(
m_RDOs
);
28
return
*
m_RDOs
;
29
}
30
// return a pointer to the representation of one module.
31
const
typename
T_RDOContainer::base_value_type *
operator->
()
const
{
32
assert(
m_RDOs
);
33
return
m_RDOs
;
34
}
35
// check whether the RDO collection represented by this object is empty.
36
// @TODO or rather implement operator-> ? That would give this adapter a more consistent interface
37
// since it rather represents a pointer to an object than an object.
38
bool
empty
()
const
{
39
assert(
m_RDOs
);
40
return
m_RDOs
->empty();
41
}
42
// result represents the module of the given id_hash when dereferenced.
43
// @note must only be dereferenced if isValid is true.
44
static
std::optional<RDOCollectionAdapter>
make
(
const
T_RDOContainer &rdo_container,
const
IdentifierHash
&id_hash) {
45
const
typename
T_RDOContainer::base_value_type *RDOs = rdo_container.indexFindPtr(id_hash);
46
if
(RDOs) {
return
RDOCollectionAdapter
(*RDOs); }
47
else
{
return
std::optional<RDOCollectionAdapter>{}; }
48
}
49
// result represents an iterable range where each element represents one module
50
static
const
T_RDOContainer &
range
(
const
T_RDOContainer &rdo_container) {
51
return
rdo_container;
52
}
53
};
54
55
}
56
#endif
ActsTrk::RDOCollectionAdapter::RDOCollectionAdapter
RDOCollectionAdapter(const typename T_RDOContainer::base_value_type *RDOs)
Definition
RDOCollectionAdapter.h:14
ActsTrk::RDOCollectionAdapter::m_RDOs
const T_RDOContainer::base_value_type * m_RDOs
Definition
RDOCollectionAdapter.h:12
ActsTrk::RDOCollectionAdapter::operator->
const T_RDOContainer::base_value_type * operator->() const
Definition
RDOCollectionAdapter.h:31
ActsTrk::RDOCollectionAdapter::range
static const T_RDOContainer & range(const T_RDOContainer &rdo_container)
Definition
RDOCollectionAdapter.h:50
ActsTrk::RDOCollectionAdapter::operator*
const T_RDOContainer::base_value_type & operator*() const
Definition
RDOCollectionAdapter.h:26
ActsTrk::RDOCollectionAdapter::RDOCollectionAdapter
RDOCollectionAdapter(const typename T_RDOContainer::base_value_type &RDOs)
Definition
RDOCollectionAdapter.h:17
ActsTrk::RDOCollectionAdapter::isValid
bool isValid() const
Definition
RDOCollectionAdapter.h:21
ActsTrk::RDOCollectionAdapter::make
static std::optional< RDOCollectionAdapter > make(const T_RDOContainer &rdo_container, const IdentifierHash &id_hash)
Definition
RDOCollectionAdapter.h:44
ActsTrk::RDOCollectionAdapter::empty
bool empty() const
Definition
RDOCollectionAdapter.h:38
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition
MdtCalibInput.h:31
Generated on
for ATLAS Offline Software by
1.17.0