ATLAS Offline Software
Loading...
Searching...
No Matches
AthLinks/DataLinkBase.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 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4*/
11
12
13#ifndef ATHLINKS_DATALINKBASE_H
14#define ATHLINKS_DATALINKBASE_H
15
16
18#include "AthLinks/exceptions.h"
19
20
21class EventContext;
22
23
24namespace SG {
25class DataProxy;
26template <class INDEXING_POLICY> class GenericElementLinkBase;
27}
28class IProxyDict;
29
30
39{
40public:
43
46
49
52
53
57 bool isDefault() const;
58
59
65 const ID_type& dataID() const;
66
67
73 sgkey_t key() const;
74
75
79 void clear();
80
81
93 SG::DataProxy* proxy (bool nothrow = false) const;
94
95
100
101
102
113 bool toTransient (IProxyDict* sg = 0);
114
115
124 bool toTransient (const EventContext& ctx);
125
126
139 bool toTransient (const ID_type& dataID, CLID link_clid, IProxyDict* sg = 0);
140
141
152 bool toTransient (const ID_type& dataID, CLID link_clid,
153 const EventContext& ctx);
154
155
172
173
189
190
194 bool operator== (const DataLinkBase& other) const;
195
196
200 bool operator!= (const DataLinkBase& other) const;
201
202
203
204protected:
205 // To get m_proxy from the ctors taking a DataLink+index.
206 friend class ElementLinkBase;
207 template <class INDEXING_POLICY> friend class SG::GenericElementLinkBase;
208
210 friend class DataLinkBase_test;
211
212
217
218
230
231
240 DataLinkBase (const ID_type& dataID, CLID link_clid, IProxyDict* sg);
241
242
254
255
263
264
279 CLID clid_in,
280 IProxyDict* sg);
281
282
295 CLID clid,
296 IProxyDict* sg);
297
298
312 CLID clid,
313 IProxyDict* sg);
314
315
327 void* storableBase (castfn_t* castfn, const CLID& clid, bool isConst) const;
328
329
330
337 void throwInvalidLink() const;
338
339
340
341private:
344
347};
348
349
351
352
353#endif // not ATHLINKS_DATALINKBASE_H
Manage DataProxy reference in ElementLink/DataLink.
uint32_t CLID
The Class ID type.
bool operator==(const DataLinkBase &other) const
Compare for equality.
void toIdentifiedObject(sgkey_t key, CLID clid, IProxyDict *sg)
Set the link to an object given by a hashed key.
void toIdentifiedObject(const ID_type &dataID, CLID clid, IProxyDict *sg)
Set the link to an object given by a string key.
bool toPersistent()
Prepare this link for writing.
void throwInvalidLink() const
Throw a ExcInvalidLink exception for this link.
friend class ElementLinkBase
bool toTransient(const ID_type &dataID, CLID link_clid, IProxyDict *sg=0)
Finish initialization like the link as just been read from root, but with a specified key.
DataLinkBase(const_pointer_t obj, CLID link_clid, IProxyDict *sg)
Constructor from pointer to object.
SG::DataProxyHolder::sgkey_t sgkey_t
Type of hashed keys.
SG::DataProxyHolder::const_pointer_t const_pointer_t
bool isDefault() const
Test to see if we're in the default state.
SG::DataProxyHolder::castfn_t castfn_t
Function casting from a SG::DataProxy to a pointer.
friend class DataLinkBase_test
For component testing.
DataLinkBase(const ID_type &dataID, CLID link_clid, IProxyDict *sg)
Constructor from a string key.
SG::DataProxy * proxy(bool nothrow=false) const
Return the DataProxy for this link.
void clear()
Clear the link (make it null).
bool toTransient(const EventContext &ctx)
Finish initialization after link has been read.
DataLinkBase()
Default constructor.
bool toPersistentNoRemap()
Prepare this link for writing.
sgkey_t m_persKey
The hashed key for this link.
DataLinkBase(sgkey_t key, CLID link_clid, IProxyDict *sg)
Constructor from a hashed key.
const ID_type & dataID() const
Return the SG key that we reference, as a string.
IProxyDict * source() const
Return the data source for this reference.
void * storableBase(castfn_t *castfn, const CLID &clid, bool isConst) const
Return a pointer to the currently-referenced object.
bool operator!=(const DataLinkBase &other) const
Compare for inequality.
DataLinkBase(sgkey_t key, const SG::DataProxyHolder &holder)
Constructor from a hashed key and a proxy holder object.
bool toTransient(IProxyDict *sg=0)
Finish initialization after link has been read.
sgkey_t key() const
Return the SG key that we reference, as a hash.
SG::DataProxyHolder::ID_type ID_type
Type of string keys.
bool toTransient(const ID_type &dataID, CLID link_clid, const EventContext &ctx)
Finish initialization like the link as just been read from root, but with a specified key.
SG::DataProxyHolder::pointer_t pointer_t
void toStorableObject(const_pointer_t obj, CLID clid_in, IProxyDict *sg)
Set the link to an object given by a pointer.
SG::DataProxyHolder m_proxy
SG proxy for this link.
Manage DataProxy reference in ElementLink/DataLink.
SG::sgkey_t sgkey_t
Type of hashed keys.
void * castfn_t(SG::DataProxy *)
Function casting from a SG::DataProxy to a pointer.
void * pointer_t
Generic pointer type.
std::string ID_type
Type of string keys.
const void * const_pointer_t
Generic base class for ElementLinks.
Forward declaration.