ATLAS Offline Software
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 */
13 #ifndef ATHLINKS_DATALINKBASE_H
14 #define ATHLINKS_DATALINKBASE_H
15 
16 
18 #include "AthLinks/exceptions.h"
19 
20 
21 class EventContext;
22 
23 
24 namespace SG {
25 class DataProxy;
26 template <class INDEXING_POLICY> class GenericElementLinkBase;
27 }
28 class IProxyDict;
29 
30 
39 {
40 public:
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 
99  IProxyDict* source() const;
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 
171  bool toPersistent();
172 
173 
189 
190 
194  bool operator== (const DataLinkBase& other) const;
195 
196 
200  bool operator!= (const DataLinkBase& other) const;
201 
202 
203 
204 protected:
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 
341 private:
344 
347 };
348 
349 
350 #include "AthLinks/DataLinkBase.icc"
351 
352 
353 #endif // not ATHLINKS_DATALINKBASE_H
DataLinkBase::const_pointer_t
SG::DataProxyHolder::const_pointer_t const_pointer_t
Definition: AthLinks/DataLinkBase.h:48
DataLinkBase::m_proxy
SG::DataProxyHolder m_proxy
SG proxy for this link.
Definition: AthLinks/DataLinkBase.h:346
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
DataLinkBase::toPersistentNoRemap
bool toPersistentNoRemap()
Prepare this link for writing.
DataLinkBase::clear
void clear()
Clear the link (make it null).
Definition: DataLinkBase.cxx:36
DataLinkBase::DataLinkBase
DataLinkBase()
Default constructor.
DataLinkBase::toTransient
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.
DataProxyHolder.h
Manage DataProxy reference in ElementLink/DataLink.
DataLinkBase::proxy
SG::DataProxy * proxy(bool nothrow=false) const
Return the DataProxy for this link.
DataLinkBase::dataID
const ID_type & dataID() const
Return the SG key that we reference, as a string.
DataLinkBase::toTransient
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.
DataLinkBase::m_persKey
sgkey_t m_persKey
The hashed key for this link.
Definition: AthLinks/DataLinkBase.h:343
IProxyDict
A proxy dictionary.
Definition: AthenaKernel/AthenaKernel/IProxyDict.h:47
SG::DataProxyHolder::sgkey_t
SG::sgkey_t sgkey_t
Type of hashed keys.
Definition: DataProxyHolder.h:64
ElementLinkBase
Base class for ElementLinks to vectors of pointers.
Definition: AthLinks/ElementLinkBase.h:59
SG::GenericElementLinkBase
Generic base class for ElementLinks.
Definition: AthLinks/DataLinkBase.h:26
DataLinkBase::castfn_t
SG::DataProxyHolder::castfn_t castfn_t
Function casting from a SG::DataProxy to a pointer.
Definition: AthLinks/DataLinkBase.h:51
SG::DataProxyHolder
Manage DataProxy reference in ElementLink/DataLink.
Definition: DataProxyHolder.h:61
SG::DataProxyHolder::ID_type
std::string ID_type
Type of string keys.
Definition: DataProxyHolder.h:67
DataProxy
DataProxy provides the registry services for StoreGate.
Definition: DataProxy.h:32
DataLinkBase::key
sgkey_t key() const
Return the SG key that we reference, as a hash.
DataLinkBase::DataLinkBase
DataLinkBase(sgkey_t key, const SG::DataProxyHolder &holder)
Constructor from a hashed key and a proxy holder object.
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
DataLinkBase::DataLinkBase
DataLinkBase(sgkey_t key, CLID link_clid, IProxyDict *sg)
Constructor from a hashed key.
DataLinkBase::toStorableObject
void toStorableObject(const_pointer_t obj, CLID clid_in, IProxyDict *sg)
Set the link to an object given by a pointer.
DataLinkBase::isDefault
bool isDefault() const
Test to see if we're in the default state.
Definition: DataLinkBase.cxx:31
DataLinkBase::DataLinkBase
DataLinkBase(const ID_type &dataID, CLID link_clid, IProxyDict *sg)
Constructor from a string key.
SG::DataProxyHolder::castfn_t
void * castfn_t(SG::DataProxy *)
Function casting from a SG::DataProxy to a pointer.
Definition: DataProxyHolder.h:74
DataLinkBase::throwInvalidLink
void throwInvalidLink() const
Throw a ExcInvalidLink exception for this link.
DataLinkBase::DataLinkBase
DataLinkBase(const_pointer_t obj, CLID link_clid, IProxyDict *sg)
Constructor from pointer to object.
DataLinkBase::storableBase
void * storableBase(castfn_t *castfn, const CLID &clid, bool isConst) const
Return a pointer to the currently-referenced object.
DataLinkBase.icc
DataLinkBase::pointer_t
SG::DataProxyHolder::pointer_t pointer_t
Definition: AthLinks/DataLinkBase.h:47
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
DataLinkBase::sgkey_t
SG::DataProxyHolder::sgkey_t sgkey_t
Type of hashed keys.
Definition: AthLinks/DataLinkBase.h:42
DataLinkBase::ID_type
SG::DataProxyHolder::ID_type ID_type
Type of string keys.
Definition: AthLinks/DataLinkBase.h:45
SG::DataProxyHolder::const_pointer_t
const void * const_pointer_t
Definition: DataProxyHolder.h:71
DataLinkBase::DataLinkBase_test
friend class DataLinkBase_test
For component testing.
Definition: AthLinks/DataLinkBase.h:210
DataLinkBase::toTransient
bool toTransient(IProxyDict *sg=0)
Finish initialization after link has been read.
DataLinkBase::source
IProxyDict * source() const
Return the data source for this reference.
DataLinkBase::operator==
bool operator==(const DataLinkBase &other) const
Compare for equality.
DataLinkBase::operator!=
bool operator!=(const DataLinkBase &other) const
Compare for inequality.
python.PyAthena.obj
obj
Definition: PyAthena.py:132
SG::DataProxy
Definition: DataProxy.h:45
SG::DataProxyHolder::pointer_t
void * pointer_t
Generic pointer type.
Definition: DataProxyHolder.h:70
DataLinkBase::toPersistent
bool toPersistent()
Prepare this link for writing.
DataLinkBase::toIdentifiedObject
void toIdentifiedObject(const ID_type &dataID, CLID clid, IProxyDict *sg)
Set the link to an object given by a string key.
DataLinkBase
Type-independent part of DataLink; holds the persistent state.
Definition: AthLinks/DataLinkBase.h:39
DataLinkBase::toTransient
bool toTransient(const EventContext &ctx)
Finish initialization after link has been read.
DataLinkBase::toIdentifiedObject
void toIdentifiedObject(sgkey_t key, CLID clid, IProxyDict *sg)
Set the link to an object given by a hashed key.