ATLAS Offline Software
Loading...
Searching...
No Matches
DataProxy.icc
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*/
6
7/***************************************************************************
8 implementation of DataProxy_cast operator
9 -----------------------------------------
10 ATLAS Collaboration
11***************************************************************************/
12
13// $Id: DataProxy.icc,v 1.6 2008-07-14 22:16:25 calaf Exp $
14
15#include "AthenaKernel/DataBucketBase.h"
16#include "AthenaKernel/StorableConversions.h"
17#include "AthenaKernel/ClassID_traits.h"
18#ifndef NDEBUG
19# include "AthenaKernel/getMessageSvc.h"
20# include "GaudiKernel/MsgStream.h"
21#endif
22
23
24class DataObject;
25
26
27/// Retrieve data object key == string
28inline
29const SG::DataProxy::name_type& SG::DataProxy::name() const
30{
31 // No locking needed.
32 return m_tAddress.name();
33}
34
35
36/// Retrieve data object key == string
37/// duplicated for Gaudi folks does same as name()
38inline
39const SG::DataProxy::id_type& SG::DataProxy::identifier() const
40{
41 // No locking needed.
42 return m_tAddress.name();
43}
44
45
46/// Retrieve DataObject
47inline
48DataObject* SG::DataProxy::object ATLAS_NOT_CONST_THREAD_SAFE () const
49{
50 return m_dObject;
51}
52
53
54/// Retrieve IOpaqueAddress
55inline
56IOpaqueAddress* SG::DataProxy::address() const
57{
58 lock_t lock (m_mutex);
59 return m_tAddress.address();
60}
61
62
63/// set DataSvc (Gaudi-specific); do nothing for us
64inline
65IDataProviderSvc* SG::DataProxy::dataSvc() const
66{
67 return nullptr;
68}
69
70///< Get the primary (hashed) SG key.
71inline
72SG::sgkey_t SG::DataProxy::sgkey() const
73{
74 // No lock; underlying member is atomic.
75 return m_tAddress.sgkey();
76}
77
78
79/// Set the primary (hashed) SG key.
80inline
81void SG::DataProxy::setSGKey (sgkey_t sgkey)
82{
83 lock_t lock (m_mutex);
84 m_tAddress.setSGKey (sgkey);
85}
86
87
88///< Return the ID of the store containing this proxy.
89inline
90StoreID::type SG::DataProxy::storeID() const
91{
92 lock_t lock (m_mutex);
93 return m_tAddress.storeID();
94}
95
96
97///< check if it is a transient ID (primary or symLinked):
98inline
99bool SG::DataProxy::transientID (CLID id) const
100{
101 lock_t lock (m_mutex);
102 return m_tAddress.transientID (id);
103}
104
105
106///< return the list of transient IDs (primary or symLinked):
107inline
108SG::DataProxy::CLIDCont_t SG::DataProxy::transientID() const
109{
110 lock_t lock (m_mutex);
111 return m_tAddress.transientID();
112}
113
114
115/// Add a new transient ID
116inline
117void SG::DataProxy::setTransientID(CLID id)
118{
119 lock_t lock (m_mutex);
120 m_tAddress.setTransientID (id);
121}
122
123
124/// access set of proxy aliases
125/// Returns a COPY of the alias set.
126inline
127SG::DataProxy::AliasCont_t SG::DataProxy::alias() const
128{
129 lock_t lock (m_mutex);
130 return m_tAddress.alias();
131}
132
133
134/// Add a new proxy alias.
135inline
136void SG::DataProxy::setAlias(const std::string& key)
137{
138 lock_t lock (m_mutex);
139 m_tAddress.setAlias (key);
140}
141
142
143/// Test to see if a given string is in the alias set.
144inline
145bool SG::DataProxy::hasAlias(const std::string& key) const
146{
147 lock_t lock (m_mutex);
148 return m_tAddress.hasAlias (key);
149}
150
151
152/// remove alias from proxy
153inline
154bool SG::DataProxy::removeAlias(const std::string& key)
155{
156 lock_t lock (m_mutex);
157 return m_tAddress.removeAlias (key);
158}
159
160
161/// Return the address provider.
162inline
163IAddressProvider* SG::DataProxy::provider()
164{
165 lock_t lock (m_mutex);
166 return m_tAddress.provider();
167}
168
169
170/// Set the address provider.
171inline
172void SG::DataProxy::setProvider(IAddressProvider* provider,
173 StoreID::type storeID)
174{
175 lock_t lock (m_mutex);
176 m_tAddress.setProvider (provider, storeID);
177}
178
179
180/// Set the CLID / key.
181/// This will only succeed if the clid/key are currently clear.
182inline
183void SG::DataProxy::setID (CLID id, const std::string& key)
184{
185 lock_t lock (m_mutex);
186 m_tAddress.setID (id, key);
187}
188
189
190/// am I valid?
191inline
192bool SG::DataProxy::isValid() const
193{
194 return (isValidObject() || isValidAddress());
195}
196
197
198/// is the object valid?
199inline
200bool SG::DataProxy::isValidObject() const
201{
202 // FIXME: should we try to chase?
203 return (0!= m_dObject);
204}
205
206
207/// Access DataObject on-demand using conversion service
208///@throws runtime_error when converter fails
209inline
210DataObject* SG::DataProxy::accessData()
211{
212 // Inlined part: return m_dObject if it's valid.
213 // Otherwise, call the out-of-line part of the code.
214 if (0 != m_dObject) return m_dObject; // cached object
215 return accessDataOol();
216}
217
218
219inline
220SG::DataProxy::ErrNo SG::DataProxy::errNo() const
221{
222 lock_t lock (m_objMutex);
223 return m_errno;
224}
225
226
227/// Retrieve clid
228inline
229CLID SG::DataProxy::clID() const
230{
231 // No lock; underlying member is atomic.
232 return m_tAddress.clID();
233}
234
235
236/// Check if it is a const object
237inline
238bool SG::DataProxy::isConst() const
239{
240 // No lock; underlying member is atomic.
241 return m_const;
242}
243
244
245/// set the reset only flag: Clear Store will reset and not delete.
246inline
247void SG::DataProxy::resetOnly(const bool& flag)
248{
249 lock_t lock (m_mutex);
250 m_resetFlag = flag;
251}
252
253
254/// Check reset only:
255inline
256bool SG::DataProxy::isResetOnly() const
257{
258 lock_t lock (m_mutex);
259 return m_resetFlag;
260}
261
262
263/// Set the store of which we're a part.
264inline
265void SG::DataProxy::setStore (IProxyDict* store)
266{
267 m_store = store;
268}
269
270/// Return the store of which we're a part.
271inline
272IProxyDict* SG::DataProxy::store()
273{
274 return m_store;
275}
276
277
278/// Return the store of which we're a part.
279inline
280const IProxyDict* SG::DataProxy::store() const
281{
282 return m_store;
283}
284
285
286inline
287IConverter* SG::DataProxy::loader()
288{
289 lock_t lock (m_mutex);
290 return m_dataLoader;
291}
292
293
294