ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthContainers
AthContainers
ViewVectorBase.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-2025 CERN for the benefit of the ATLAS collaboration
5
*/
12
13
14
#ifndef ATHCONTAINERS_VIEWVECTORBASE_H
15
#define ATHCONTAINERS_VIEWVECTORBASE_H
16
17
18
#include "
AthContainers/dataVectorAsELV.h
"
19
#include "
AthContainers/tools/CurrentEventStore.h
"
20
#include "AthLinks/ElementLinkBase.h"
21
#include "
SGCore/sgkey_t.h
"
22
#include <vector>
23
#include <cstdint>
24
25
26
class
ViewVectorBaseTest;
27
28
29
namespace
SG
{
30
31
37
class
ViewVectorBase
38
{
39
public
:
41
virtual
~ViewVectorBase
() =
default
;
42
43
47
virtual
void
toPersistent
() = 0;
48
49
53
virtual
void
toTransient
() = 0;
54
55
59
void
clearPersistent
();
60
61
69
void
setClearOnPersistent
();
70
71
72
protected
:
79
template
<
class
DV>
80
void
doToPersistent1
(DV& v,
const
std::true_type&);
81
82
90
template
<
class
DV>
91
void
doToPersistent1
(DV&,
const
std::false_type&);
92
93
100
template
<
class
DV>
101
void
doToPersistent
(DV& v);
102
103
110
template
<
class
DV>
111
void
doToTransient2
(DV& v,
const
std::true_type&);
112
113
120
template
<
class
DV>
121
void
doToTransient2
(DV&,
const
std::false_type&) {}
122
123
130
template
<
class
DV>
131
void
doToTransient1
(DV& v,
const
std::true_type&)
132
{
133
doToTransient2
(v, std::is_same<DV, typename DV::base_data_vector>());
134
}
135
136
146
template
<
class
DV>
147
void
doToTransient1
(DV&,
const
std::false_type&) {}
148
149
156
template
<
class
DV>
157
void
doToTransient
(DV& v)
158
{
159
#ifdef XAOD_STANDALONE
160
doToTransient1
(v, std::true_type());
161
#else
162
doToTransient1
(v,
typename
ClassID_traits<DV>::has_classID_tag
());
163
#endif
164
}
165
166
167
private
:
168
// For unit testing.
169
friend
class ::ViewVectorBaseTest;
170
172
std::vector<sgkey_t>
m_persKey
;
173
std::vector<unsigned int>
m_persIndex
;
174
176
bool
m_clearOnPersistent
=
false
;
177
};
178
179
180
}
// namespace SG
181
182
183
#include "
AthContainers/ViewVectorBase.icc
"
184
185
186
#endif
// not ATHCONTAINERS_VIEWVECTORBASE_H
CurrentEventStore.h
Wrapper for CurrentEventStore, to do the correct thing for both Athena and standalone builds.
ViewVectorBase.icc
SG::ViewVectorBase
Hold the persistent representation for a ViewVector.
Definition
ViewVectorBase.h:38
SG::ViewVectorBase::doToPersistent
void doToPersistent(DV &v)
Convert to persistent form.
SG::ViewVectorBase::doToTransient1
void doToTransient1(DV &, const std::false_type &)
Convert to transient form.
Definition
ViewVectorBase.h:147
SG::ViewVectorBase::doToPersistent1
void doToPersistent1(DV &v, const std::true_type &)
Convert to persistent form.
SG::ViewVectorBase::clearPersistent
void clearPersistent()
Clear the persistent data.
SG::ViewVectorBase::doToTransient1
void doToTransient1(DV &v, const std::true_type &)
Convert to persistent form.
Definition
ViewVectorBase.h:131
SG::ViewVectorBase::toPersistent
virtual void toPersistent()=0
Convert the vector to persistent form.
SG::ViewVectorBase::doToTransient2
void doToTransient2(DV &v, const std::true_type &)
Convert to transient form.
SG::ViewVectorBase::m_persIndex
std::vector< unsigned int > m_persIndex
Definition
ViewVectorBase.h:173
SG::ViewVectorBase::doToTransient2
void doToTransient2(DV &, const std::false_type &)
Convert to transient form.
Definition
ViewVectorBase.h:121
SG::ViewVectorBase::~ViewVectorBase
virtual ~ViewVectorBase()=default
Destructor.
SG::ViewVectorBase::toTransient
virtual void toTransient()=0
Convert the vector to transient form.
SG::ViewVectorBase::setClearOnPersistent
void setClearOnPersistent()
Set a flag to declare that the vector should be cleared on the next call to toPersistent().
SG::ViewVectorBase::doToTransient
void doToTransient(DV &v)
Convert to persistent form.
Definition
ViewVectorBase.h:157
SG::ViewVectorBase::m_clearOnPersistent
bool m_clearOnPersistent
If true, the vector should be cleared when doPersistent is called.
Definition
ViewVectorBase.h:176
SG::ViewVectorBase::doToPersistent1
void doToPersistent1(DV &, const std::false_type &)
Convert to persistent form.
SG::ViewVectorBase::m_persKey
std::vector< sgkey_t > m_persKey
The persistent form. (sgkey, index).
Definition
ViewVectorBase.h:172
dataVectorAsELV.h
Helper to make a vector<EL> from a DataVector.
SG
Forward declaration.
Definition
CaloCellPacker_400_500.h:32
sgkey_t.h
ClassID_traits::has_classID_tag
std::false_type has_classID_tag
Definition
Control/AthenaKernel/AthenaKernel/ClassID_traits.h:41
Generated on
for ATLAS Offline Software by
1.17.0