ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
SGTools
src
TransientAddress.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
SGTools/TransientAddress.h
"
6
#include "
SGTools/DataProxy.h
"
7
#include "
AthenaKernel/IAddressProvider.h
"
8
#include "
AthenaKernel/IProxyDict.h
"
9
#include "GaudiKernel/IOpaqueAddress.h"
10
11
#include <assert.h>
12
13
using
SG::TransientAddress
;
14
15
const
std::string
TransientAddress::s_emptyString
;
16
17
// Default Constructor:
18
TransientAddress::TransientAddress
()
19
:
TransientAddress
(CLID_NULL,
""
, nullptr, true, false)
20
{
21
}
22
23
// Constructor with CLID and string key:
24
// (typically used through a StoreGate::record()
25
TransientAddress::TransientAddress
(
CLID
id
,
const
std::string& key)
26
:
TransientAddress
(id, key, nullptr, true, false)
27
{
28
if
(
id
!= CLID_NULL)
29
m_transientID
.push_back(
id
);
30
}
31
32
// Constructor with CLID, string key and IOpaqueAddress:
33
// (typically used by a ProxyProvider)
34
TransientAddress::TransientAddress
(
CLID
id
,
const
std::string& key,
35
CxxUtils::RefCountedPtr<IOpaqueAddress>
addr,
36
bool
clearAddress
)
37
:
TransientAddress
(id, key,
std
::move(addr),
clearAddress
, true)
38
{
39
if
(
id
!= CLID_NULL)
40
m_transientID
.push_back(
id
);
41
}
42
43
44
// Constructor giving full list of symlinked IDs
45
// --- used from DataHeaderElement::getAddress().
46
TransientAddress::TransientAddress
(
CLID
id
,
const
std::string& key,
47
CxxUtils::RefCountedPtr<IOpaqueAddress>
addr,
48
const
std::vector<CLID>& clids)
49
:
TransientAddress
(id, key,
std
::move(addr), true, true)
50
{
51
m_transientID
.reserve (clids.size() + 1);
52
m_transientID
= clids;
53
if
(
id
!= CLID_NULL) {
54
m_transientID
.push_back (
id
);
55
std::ranges::sort (
m_transientID
);
56
}
57
}
58
59
60
// Note: this is a private ctor, only used from other ctors.
61
// It does not initialize m_transientID.
62
TransientAddress::TransientAddress
(
CLID
id
,
const
std::string& key,
63
CxxUtils::RefCountedPtr<IOpaqueAddress>
addr,
64
bool
clearAddress
,
65
bool
consultProvider
)
66
:
m_clid
(id),
67
m_sgkey
(0),
68
m_storeID
(
StoreID
::UNKNOWN),
69
m_clearAddress
(
clearAddress
),
70
m_consultProvider
(
consultProvider
),
71
m_address
(
std
::move(addr)),
72
m_pAddressProvider
(nullptr)
73
{
74
if
(!key.empty()) {
75
m_name.store (key);
76
}
77
}
78
79
80
TransientAddress::TransientAddress
(
const
TransientAddress
& other)
81
:
m_clid
(static_cast<
CLID
>(other.
m_clid
)),
82
m_sgkey
(static_cast<
sgkey_t
>(other.
m_sgkey
)),
83
m_storeID
(other.
m_storeID
),
84
m_clearAddress
(other.
m_clearAddress
),
85
m_consultProvider
(other.
m_consultProvider
),
86
m_address
(other.
m_address
),
87
m_pAddressProvider
(other.
m_pAddressProvider
),
88
m_name
(other.
m_name
),
89
m_transientID
(other.
m_transientID
),
90
m_transientAlias
(other.
m_transientAlias
)
91
{
92
}
93
94
95
TransientAddress::TransientAddress
(
TransientAddress
&& other)
96
:
m_clid
(static_cast<
CLID
>(other.
m_clid
)),
97
m_sgkey
(static_cast<
sgkey_t
>(other.
m_sgkey
)),
98
m_storeID
(other.
m_storeID
),
99
m_clearAddress
(other.
m_clearAddress
),
100
m_consultProvider
(other.
m_consultProvider
),
101
m_address
(
std
::move (other.
m_address
)),
102
m_pAddressProvider
(other.
m_pAddressProvider
),
103
m_name
(
std
::move (other.
m_name
)),
104
m_transientID
(
std
::move (other.
m_transientID
)),
105
m_transientAlias
(
std
::move (other.
m_transientAlias
))
106
{
107
}
108
109
110
// Destructor
111
TransientAddress::~TransientAddress
()
112
{
113
}
114
115
116
TransientAddress
&
TransientAddress::operator=
(
const
TransientAddress
& other)
117
{
118
if
(
this
!= &other) {
119
m_clid
=
static_cast<
CLID
>
(other.m_clid);
120
m_name
= other.m_name;
121
m_transientID
= other.m_transientID;
122
m_transientAlias
= other.m_transientAlias;
123
m_clearAddress
= other.m_clearAddress;
124
m_consultProvider
= other.m_consultProvider;
125
m_pAddressProvider
= other.m_pAddressProvider;
126
m_storeID
= other.m_storeID;
127
m_sgkey
=
static_cast<
sgkey_t
>
(other.m_sgkey);
128
m_address
= other.m_address;
129
}
130
return
*
this
;
131
}
132
133
134
TransientAddress
&
TransientAddress::operator=
(
TransientAddress
&& other)
135
{
136
if
(
this
!= &other) {
137
m_clid
=
static_cast<
CLID
>
(other.m_clid);
138
m_name
= std::move (other.m_name);
139
m_transientID
= std::move (other.m_transientID);
140
m_transientAlias
= std::move (other.m_transientAlias);
141
m_clearAddress
= other.m_clearAddress;
142
m_consultProvider
= other.m_consultProvider;
143
m_pAddressProvider
= other.m_pAddressProvider;
144
m_storeID
= other.m_storeID;
145
m_sgkey
=
static_cast<
sgkey_t
>
(other.m_sgkey);
146
m_address
= std::move (other.m_address);
147
}
148
return
*
this
;
149
}
150
151
153
void
TransientAddress::setTransientID
(
CLID
id
)
154
{
155
if
(
m_transientID
.empty()) {
156
m_transientID
.push_back (
id
);
157
}
158
else
if
(!
transientID
(
id
)) {
159
m_transientID
.push_back (
id
);
160
std::sort
(
m_transientID
.begin(),
m_transientID
.end());
161
}
162
}
163
164
172
void
TransientAddress::setID
(
CLID
id
,
const
std::string& key)
173
{
174
assert (
m_clid
== CLID_NULL && !
m_name
.isValid() &&
m_transientID
.empty() &&
175
m_transientAlias
.empty());
176
m_clid
= id;
177
m_name
.set (key);
178
if
(
id
!= CLID_NULL)
179
m_transientID
.push_back(
id
);
180
}
181
182
// Reset the TransientAddress
183
void
TransientAddress::reset
()
184
{
185
if
(
m_clearAddress
)
m_address
.reset();
186
}
187
189
void
TransientAddress::setAddress
(
CxxUtils::RefCountedPtr<IOpaqueAddress>
pAddress)
190
{
191
m_address
= std::move(pAddress);
192
}
193
194
bool
TransientAddress::isValid
(
const
EventContext* ctx,
195
bool
forceUpdate
/*= false*/
)
196
{
197
if
(!forceUpdate && 0 != address())
return
true
;
198
199
if
(ctx &&
m_consultProvider
&& 0 !=
provider
()) {
200
if
((
provider
()->updateAddress(
storeID
(),
this
, *ctx)).isSuccess())
201
return
true
;
202
}
203
return
false
;
204
}
IProxyDict.h
DataProxy.h
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
IAddressProvider.h
if
if(pathvar)
Definition
SealSharedLib.cxx:168
TransientAddress.h
CxxUtils::RefCountedPtr
Simple smart pointer for Gaudi-style refcounted objects.
Definition
RefCountedPtr.h:39
SG::TransientAddress
Definition
TransientAddress.h:34
SG::TransientAddress::sgkey_t
IStringPool::sgkey_t sgkey_t
Default Constructor.
Definition
TransientAddress.h:43
SG::TransientAddress::reset
void reset()
Retrieve IOpaqueAddress.
Definition
TransientAddress.cxx:183
SG::TransientAddress::TransientAddress
TransientAddress()
Construct from clid and string key:
Definition
TransientAddress.cxx:18
SG::TransientAddress::m_pAddressProvider
IAddressProvider * m_pAddressProvider
string key of this object
Definition
TransientAddress.h:180
SG::TransientAddress::storeID
StoreID::type storeID() const
Definition
TransientAddress.h:331
SG::TransientAddress::clearAddress
void clearAddress(const bool &flag)
Return the clearAddress flag.
Definition
TransientAddress.h:305
SG::TransientAddress::m_sgkey
std::atomic< sgkey_t > m_sgkey
Store type, needed by updateAddress.
Definition
TransientAddress.h:165
SG::TransientAddress::isValid
bool isValid(const EventContext *ctx, bool forceUpdate=false)
cache the pointer to the Address provider which can update this transient address
Definition
TransientAddress.cxx:194
SG::TransientAddress::setTransientID
void setTransientID(CLID id)
get transient CLID's
Definition
TransientAddress.cxx:153
SG::TransientAddress::transientID
bool transientID(CLID id) const
set transient CLID's
Definition
TransientAddress.h:242
SG::TransientAddress::~TransientAddress
~TransientAddress()
Definition
TransientAddress.cxx:111
SG::TransientAddress::m_name
CxxUtils::CachedValue< std::string > m_name
all transient clids. They come from symlinks
Definition
TransientAddress.h:183
SG::TransientAddress::m_consultProvider
bool m_consultProvider
IOpaqueAddress:
Definition
TransientAddress.h:174
SG::TransientAddress::setAddress
void setAddress(CxxUtils::RefCountedPtr< IOpaqueAddress > pAddress)
Retrieve primary clid.
Definition
TransientAddress.cxx:189
SG::TransientAddress::provider
IAddressProvider * provider()
Definition
TransientAddress.h:326
SG::TransientAddress::m_transientID
TransientClidSet m_transientID
all alias names for a DataObject. They come from setAlias
Definition
TransientAddress.h:186
SG::TransientAddress::operator=
TransientAddress & operator=(const TransientAddress &)
Definition
TransientAddress.cxx:116
SG::TransientAddress::m_storeID
StoreID::type m_storeID
Controls if IOpaqueAddress should be deleted:
Definition
TransientAddress.h:168
SG::TransientAddress::m_address
CxxUtils::RefCountedPtr< IOpaqueAddress > m_address
AddressProvider.
Definition
TransientAddress.h:177
SG::TransientAddress::m_clearAddress
bool m_clearAddress
Control whether the Address Provider must be consulted.
Definition
TransientAddress.h:171
SG::TransientAddress::consultProvider
void consultProvider(const bool &flag)
Check the validity of the Transient Address.
Definition
TransientAddress.h:318
SG::TransientAddress::setID
void setID(CLID id, const std::string &key)
Set the CLID / key.
Definition
TransientAddress.cxx:172
SG::TransientAddress::m_transientAlias
TransientAliasSet m_transientAlias
Definition
TransientAddress.h:189
SG::TransientAddress::m_clid
std::atomic< CLID > m_clid
< clid of the concrete class (persistent clid)
Definition
TransientAddress.h:162
StoreID
defines an enum used by address providers to decide what kind of StoreGateSvc they are providing addr...
Definition
StoreID.h:18
TransientAddress::TransientAddress
TransientAddress()
Construct from clid and string key:
Definition
TransientAddress.cxx:18
TransientAddress::s_emptyString
static const std::string s_emptyString
Definition
TransientAddress.h:191
std
STL namespace.
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition
DVL_algorithms.h:554
Generated on
for ATLAS Offline Software by
1.17.0