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-2026 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 "AthLinks/ElementLinkBase.h"
20
#include "
SGCore/sgkey_t.h
"
21
#include <vector>
22
#include <cstdint>
23
24
25
class
ViewVectorBaseTest;
26
27
28
namespace
SG
{
29
30
36
class
ViewVectorBase
37
{
38
public
:
40
virtual
~ViewVectorBase
() =
default
;
41
42
46
virtual
void
toPersistent
() = 0;
47
48
52
virtual
void
toTransient
() = 0;
53
54
58
void
clearPersistent
();
59
60
68
void
setClearOnPersistent
();
69
70
71
protected
:
78
template
<
class
DV>
79
void
doToPersistent1
(DV& v,
const
std::true_type&);
80
81
89
template
<
class
DV>
90
void
doToPersistent1
(DV&,
const
std::false_type&);
91
92
99
template
<
class
DV>
100
void
doToPersistent
(DV& v);
101
102
109
template
<
class
DV>
110
void
doToTransient2
(DV& v,
const
std::true_type&);
111
112
119
template
<
class
DV>
120
void
doToTransient2
(DV&,
const
std::false_type&) {}
121
122
129
template
<
class
DV>
130
void
doToTransient1
(DV& v,
const
std::true_type&)
131
{
132
doToTransient2
(v, std::is_same<DV, typename DV::base_data_vector>());
133
}
134
135
145
template
<
class
DV>
146
void
doToTransient1
(DV&,
const
std::false_type&) {}
147
148
155
template
<
class
DV>
156
void
doToTransient
(DV& v)
157
{
158
#ifdef XAOD_STANDALONE
159
doToTransient1
(v, std::true_type());
160
#else
161
doToTransient1
(v,
typename
ClassID_traits<DV>::has_classID_tag
());
162
#endif
163
}
164
165
166
private
:
167
// For unit testing.
168
friend
class ::ViewVectorBaseTest;
169
171
std::vector<sgkey_t>
m_persKey
;
172
std::vector<unsigned int>
m_persIndex
;
173
175
bool
m_clearOnPersistent
=
false
;
176
};
177
178
179
}
// namespace SG
180
181
182
#include "
AthContainers/ViewVectorBase.icc
"
183
184
185
#endif
// not ATHCONTAINERS_VIEWVECTORBASE_H
ViewVectorBase.icc
SG::ViewVectorBase
Hold the persistent representation for a ViewVector.
Definition
ViewVectorBase.h:37
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:146
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:130
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:172
SG::ViewVectorBase::doToTransient2
void doToTransient2(DV &, const std::false_type &)
Convert to transient form.
Definition
ViewVectorBase.h:120
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:156
SG::ViewVectorBase::m_clearOnPersistent
bool m_clearOnPersistent
If true, the vector should be cleared when doPersistent is called.
Definition
ViewVectorBase.h:175
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:171
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