ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
DataLink< STORABLE > Class Template Reference

Object reference supporting deferred reading from StoreGate. More...

#include <DataLink.h>

Inheritance diagram for DataLink< STORABLE >:
Collaboration diagram for DataLink< STORABLE >:

Public Types

typedef STORABLE value_type
 Names for the referenced type and derivatives. More...
 
typedef STORABLE * pointer
 
typedef const STORABLE * const_pointer
 
typedef STORABLE & reference
 
typedef const STORABLE & const_reference
 
typedef DataLinkBase::ID_type ID_type
 A string SG key. More...
 
typedef DataLinkBase::sgkey_t sgkey_t
 A hashed SG key. More...
 
typedef DataLink< STORABLE > self
 Convenience declaration of this structure's type. More...
 
typedef SG::DataProxyHolder::pointer_t pointer_t
 
typedef SG::DataProxyHolder::const_pointer_t const_pointer_t
 
typedef SG::DataProxyHolder::castfn_t castfn_t
 Function casting from a SG::DataProxy to a pointer. More...
 
Type definitions taken from the StoreGate-based implementation
typedef std::string ID_type
 Type of the "regular" identifiers in the event. More...
 
typedef uint32_t sgkey_t
 Integer identifier for the object in the event. More...
 
typedef STORABLE value_type
 Type of the object being handled. More...
 
typedef STORABLE * __attribute__((deprecated)) pointer
 Pointer type for the object being handled. More...
 
typedef const STORABLE * const_pointer
 Constant pointer type for the object being handled. More...
 
typedef STORABLE & __attribute__((deprecated)) reference
 Reference type for the object being handled. More...
 
typedef const STORABLE & const_reference
 Constant reference type for the object being handled. More...
 

Public Member Functions

xAOD::TVirtualEventsource () const
 Get the data source for the reference. More...
 
bool toPersistent ()
 Prepare the object to be written out. More...
 
bool isDefault () const
 Test to see if we're in the default state. More...
 
bool isDefault () const
 Test if the link is in the default state. More...
 
void clear ()
 Clear the link (make it null). More...
 
void clear ()
 Clear the link (make it null) More...
 
SG::DataProxyproxy (bool nothrow=false) const
 Return the DataProxy for this link. More...
 
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. More...
 
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. More...
 
bool toPersistentNoRemap ()
 Prepare this link for writing. More...
 
bool operator== (const DataLinkBase &other) const
 Compare for equality. More...
 
bool operator!= (const DataLinkBase &other) const
 Compare for inequality. More...
 
uint32_t persKey () const
 Get the key/identifier of the referenced container. More...
 
void setPersKey (uint32_t key)
 Set the key/identifier of the referenced container. More...
 
Constructors.
 DataLink ()
 Default constructor — gives the equivalent of a NULL pointer. More...
 
 DataLink (const_reference data, IProxyDict *sg=0)
 Constructor — link to a STORABLE using a transient ref to it. More...
 
 DataLink (const_reference data, const EventContext &ctx)
 Constructor — link to a STORABLE using a transient ref to it. More...
 
 DataLink (const_pointer pdata, IProxyDict *sg=0)
 Constructor — link to a STORABLE using a transient pointer to it. More...
 
 DataLink (const_pointer pdata, const EventContext &ctx)
 Constructor — link to a STORABLE using a transient pointer to it. More...
 
 DataLink (const ID_type &dataID, IProxyDict *sg=0)
 Constructor — link to a STORABLE using a string ID. More...
 
 DataLink (const ID_type &dataID, const EventContext &ctx)
 Constructor — link to a STORABLE using a string ID. More...
 
 DataLink (sgkey_t key, IProxyDict *sg=0)
 Constructor — link to a STORABLE using a hashed ID. More...
 
 DataLink (sgkey_t key, const EventContext &ctx)
 Constructor — link to a STORABLE using a hashed ID. More...
 
 DataLink (sgkey_t key, const SG::DataProxyHolder &holder)
 Constructor from a hashed key and a proxy holder object. More...
 
Setters.
void toStorableObject (const_reference data, IProxyDict *sg=0)
 Set the link to an object given by a reference. More...
 
void toStorableObject (const_reference data, const EventContext &ctx)
 Set the link to an object given by a reference. More...
 
void toIdentifiedObject (const ID_type &dataID, IProxyDict *sg=0)
 Set the link to an object given by a string key. More...
 
void toIdentifiedObject (const ID_type &dataID, const EventContext &ctx)
 Set the link to an object given by a string key. More...
 
void toIdentifiedObject (sgkey_t key, IProxyDict *sg=0)
 Set the link to an object given by a hashed key. More...
 
void toIdentifiedObject (sgkey_t key, const EventContext &ctx)
 Set the link to an object given by a hashed key. More...
 
void toDefaultObject (IProxyDict *sg=0)
 Set the link to the default object of this type. More...
 
void toDefaultObject (const EventContext &ctx)
 Set the link to the default object of this type. More...
 
bool toTransient (IProxyDict *sg=0)
 Finish initialization after link has been read. More...
 
bool toTransient (const EventContext &ctx)
 Finish initialization after link has been read. More...
 
bool toTransient (const ID_type &dataID, IProxyDict *sg=0)
 Finish initialization like the link as just been read from root, but with a specified key. More...
 
bool toTransient (const ID_type &dataID, const EventContext &ctx)
 Finish initialization like the link as just been read from root, but with a specified key. More...
 
Constructors
 DataLink ()
 Default constructor, creating a null pointer basically. More...
 
 DataLink (xAOD::TVirtualEvent *event)
 Constructor taking an alternative TVirtualEvent object to use. More...
 
 DataLink (const_reference data, xAOD::TVirtualEvent *event=0)
 Constructor receiving a reference to the target object. More...
 
 DataLink (const_pointer data, xAOD::TVirtualEvent *event=0)
 Constructor receiving a pointer to the target object. More...
 
 DataLink (const ID_type &id, xAOD::TVirtualEvent *event=0)
 Constructor receiving a user-readable ID for the target object. More...
 
 DataLink (sgkey_t key, xAOD::TVirtualEvent *event=0)
 Constructor receiving a hashed ID for the target object. More...
 
template<typename T >
 DataLink (const DataLink< T > &parent)
 Copy constructor. More...
 
Setter functions
void toStorableObject (const_reference data)
 Set the link to a data object that's already in the event. More...
 
void toDefaultObject ()
 Set the link to the default object of this type in the event. More...
 
void toIdentifiedObject (const ID_type &id)
 Set the link using a user readable ID for the target object. More...
 
void toIdentifiedObject (sgkey_t key)
 Set the link using a hashed ID for the target object. More...
 
Accessor functions
const_reference operator* () const
 Get a reference to the target object. May throw an exception. More...
 
const_pointer operator-> () const
 Get a pointer to the target object. More...
 
 operator const_pointer () const
 Automatic conversion operator. More...
 
const_pointer cptr () const
 Get a constant pointer to the referenced object. More...
 
bool isValid () const
 Check if the object can be found. More...
 
 operator bool () const
 Convenience validity check operator. More...
 
bool operator! () const
 Another convenience validity checker. More...
 
const ID_typedataID () const
 Get the key that we reference, as a string. More...
 
sgkey_t key () const
 Get the key that we reference, as a hash. More...
 

Static Public Member Functions

static const CLIDclassID ()
 Return the CLID for the class that we reference. More...
 

Public Attributes

ROOT_SELECTION_NS::MemberAttributes< kTransient > m_object
 Declare m_object as transient. More...
 
ROOT_SELECTION_NS::MemberAttributes< kTransient > m_event
 Declare m_event as transient. More...
 

Protected Member Functions

void toStorableObject (const_pointer_t obj, CLID clid_in, IProxyDict *sg)
 Set the link to an object given by a pointer. More...
 
void toIdentifiedObject (const ID_type &dataID, CLID clid, IProxyDict *sg)
 Set the link to an object given by a string key. More...
 
void toIdentifiedObject (sgkey_t key, CLID clid, IProxyDict *sg)
 Set the link to an object given by a hashed key. More...
 
void * storableBase (castfn_t *castfn, const CLID &clid, bool isConst) const
 Return a pointer to the currently-referenced object. More...
 
void throwInvalidLink () const
 Throw a ExcInvalidLink exception for this link. More...
 

Protected Attributes

uint32_t m_persKey
 Key/identifier of the referenced object. More...
 
bool m_isDirectIO
 A transient variable signalling when direct I/O is happening. More...
 

Private Types

typedef ROOT_SELECTION_NS::DataLink< STORABLE >::self DictSel
 Needed to take the Reflex/Cling specifications into account. More...
 

Private Member Functions

virtual bool toTransient ()
 Reset the object's internal cache. More...
 
void findIdentifier ()
 Find the identifier of the object being pointed to. More...
 

Private Attributes

const_pointer m_object
 Cached pointer to the object. More...
 
xAOD::TVirtualEventm_event
 Pointer to the event object. More...
 
sgkey_t m_persKey
 The hashed key for this link. More...
 
SG::DataProxyHolder m_proxy
 SG proxy for this link. More...
 

Accessors.

const_pointer getDataPtr () const
 Return a pointer to the currently-referenced object. More...
 
pointer getDataNonConstPtr ()
 Return a pointer to the currently-referenced object. More...
 
const_reference operator* () const
 Dereference the link. More...
 
const_pointer operator-> () const
 Dereference the link. More...
 
 operator const_pointer () const
 Dereference the link. More...
 
const_pointer cptr () const
 Dereference the link. More...
 
bool isValid () const
 Test to see if the link is dereferencable. More...
 
bool operator! () const
 True if the link is not dereferencable. More...
 
const void * storable () const
 Return a (void) pointer to the currently-referenced object. More...
 
void * storableNonConst ()
 Return a (void) pointer to the currently-referenced object. More...
 

Detailed Description

template<class STORABLE>
class DataLink< STORABLE >

Object reference supporting deferred reading from StoreGate.

This is a kind of smart pointer that can reference objects in StoreGate by key. This allows deferred-reading semantics, and also allows references to objects that may be in a different physical data file (‘back-navigation’).

For example:

DataLink<MyClass> link ("mykey");
...
// Look up the object `mykey' of class MyClass in StoreGate.
const MyClass* obj = *link;

You can also initialize a link directly with a pointer:

MyClass* obj = ...;

However, if the object has not been recorded in the event store, the possible operations on the link will be limited. (In particular, such a link cannot be made persistent.)

A DataLink can exist in one of three states:

Internally, a link stores a hashed version of the SG key + CLID; this is the part that's persistent. (In the case of a link referencing an object not in SG, this field is 0.) There is also a transient pointer to either the proxy or the object itself (if the object is not in SG). This latter pointer is factored out as DataProxyHolder in order to share implementation with ElementLink. Further, everything which does not depend on the STORABLE template parameter, including all the object state, is factored out into the non-templated base class DataLinkBase.

If the link is being saved directly with ROOT, then toPersistent should be called prior to writing. This will ensure that the hashed StoreGate key is set correctly (and will raise an exception if the link is referencing an object not in SG). This will also handle any remapping of the link. When a link is read directly from ROOT, toTransient should be called to set the proxy pointer. This would normally be done via a ROOT read rule.

A link references objects in a particular event store. When a link is constructed, a global default store is used (see SGTools/CurrentEventStore.h). If a link is subsequently modified, it stays associated with the same store, unless the link was null or was referencing an object directly by pointer, in which case the global default is again used. Alternatively, the event store may be passed explicitly using the optional sg parameter.

Definition at line 93 of file AthLinks/DataLink.h.

Member Typedef Documentation

◆ __attribute__ [1/2]

template<class STORABLE >
typedef STORABLE* DataLink< STORABLE >::__attribute__((deprecated)) pointer

Pointer type for the object being handled.

Definition at line 53 of file A/AthLinks/DataLink.h.

◆ __attribute__ [2/2]

template<class STORABLE >
typedef STORABLE& DataLink< STORABLE >::__attribute__((deprecated)) reference

Reference type for the object being handled.

Definition at line 57 of file A/AthLinks/DataLink.h.

◆ castfn_t

typedef SG::DataProxyHolder::castfn_t DataLinkBase::castfn_t
inherited

Function casting from a SG::DataProxy to a pointer.

Definition at line 49 of file AthLinks/DataLinkBase.h.

◆ const_pointer [1/2]

template<class STORABLE >
typedef const STORABLE* DataLink< STORABLE >::const_pointer

Constant pointer type for the object being handled.

Definition at line 55 of file A/AthLinks/DataLink.h.

◆ const_pointer [2/2]

template<class STORABLE >
typedef const STORABLE* DataLink< STORABLE >::const_pointer

Definition at line 100 of file AthLinks/DataLink.h.

◆ const_pointer_t

Definition at line 46 of file AthLinks/DataLinkBase.h.

◆ const_reference [1/2]

template<class STORABLE >
typedef const STORABLE& DataLink< STORABLE >::const_reference

Constant reference type for the object being handled.

Definition at line 59 of file A/AthLinks/DataLink.h.

◆ const_reference [2/2]

template<class STORABLE >
typedef const STORABLE& DataLink< STORABLE >::const_reference

Definition at line 102 of file AthLinks/DataLink.h.

◆ DictSel

template<class STORABLE >
typedef ROOT_SELECTION_NS::DataLink< STORABLE >::self DataLink< STORABLE >::DictSel
private

Needed to take the Reflex/Cling specifications into account.

Definition at line 153 of file A/AthLinks/DataLink.h.

◆ ID_type [1/2]

template<class STORABLE >
typedef std::string DataLink< STORABLE >::ID_type

Type of the "regular" identifiers in the event.

Definition at line 46 of file A/AthLinks/DataLink.h.

◆ ID_type [2/2]

template<class STORABLE >
typedef DataLinkBase::ID_type DataLink< STORABLE >::ID_type

A string SG key.

Definition at line 105 of file AthLinks/DataLink.h.

◆ pointer

template<class STORABLE >
typedef STORABLE* DataLink< STORABLE >::pointer

Definition at line 99 of file AthLinks/DataLink.h.

◆ pointer_t

Definition at line 45 of file AthLinks/DataLinkBase.h.

◆ reference

template<class STORABLE >
typedef STORABLE& DataLink< STORABLE >::reference

Definition at line 101 of file AthLinks/DataLink.h.

◆ self

template<class STORABLE >
typedef DataLink< STORABLE > DataLink< STORABLE >::self

Convenience declaration of this structure's type.

Definition at line 168 of file A/AthLinks/DataLink.h.

◆ sgkey_t [1/2]

template<class STORABLE >
typedef uint32_t DataLink< STORABLE >::sgkey_t

Integer identifier for the object in the event.

Definition at line 48 of file A/AthLinks/DataLink.h.

◆ sgkey_t [2/2]

template<class STORABLE >
typedef DataLinkBase::sgkey_t DataLink< STORABLE >::sgkey_t

A hashed SG key.

Definition at line 108 of file AthLinks/DataLink.h.

◆ value_type [1/2]

template<class STORABLE >
typedef STORABLE DataLink< STORABLE >::value_type

Type of the object being handled.

Definition at line 51 of file A/AthLinks/DataLink.h.

◆ value_type [2/2]

template<class STORABLE >
typedef STORABLE DataLink< STORABLE >::value_type

Names for the referenced type and derivatives.

Definition at line 98 of file AthLinks/DataLink.h.

Constructor & Destructor Documentation

◆ DataLink() [1/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( )

Default constructor — gives the equivalent of a NULL pointer.

◆ DataLink() [2/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( const_reference  data,
IProxyDict sg = 0 
)

Constructor — link to a STORABLE using a transient ref to it.

Parameters
dataThe object to which to link.
sgAssociated store; if 0, use the global default.

◆ DataLink() [3/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( const_reference  data,
const EventContext &  ctx 
)

Constructor — link to a STORABLE using a transient ref to it.

Parameters
dataThe object to which to link.
ctxEvent context for this link.

◆ DataLink() [4/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( const_pointer  pdata,
IProxyDict sg = 0 
)

Constructor — link to a STORABLE using a transient pointer to it.

Parameters
dataThe object to which to link.
sgAssociated store; if 0, use the global default.

◆ DataLink() [5/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( const_pointer  pdata,
const EventContext &  ctx 
)

Constructor — link to a STORABLE using a transient pointer to it.

Parameters
dataThe object to which to link.
ctxEvent context for this link.

◆ DataLink() [6/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( const ID_type dataID,
IProxyDict sg = 0 
)

Constructor — link to a STORABLE using a string ID.

Parameters
dataIDKey of the object.
sgAssociated store; if 0, use the global default.

◆ DataLink() [7/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( const ID_type dataID,
const EventContext &  ctx 
)

Constructor — link to a STORABLE using a string ID.

Parameters
dataIDKey of the object.
ctxEvent context for this link.

◆ DataLink() [8/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( sgkey_t  key,
IProxyDict sg = 0 
)

Constructor — link to a STORABLE using a hashed ID.

Parameters
keyHashed key of the object.
sgAssociated store; if 0, use the global default.

May throw ExcCLIDMismatch.

◆ DataLink() [9/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( sgkey_t  key,
const EventContext &  ctx 
)

Constructor — link to a STORABLE using a hashed ID.

Parameters
keyHashed key of the object.
ctxEvent context for this link.

May throw ExcCLIDMismatch.

◆ DataLink() [10/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( sgkey_t  key,
const SG::DataProxyHolder holder 
)

Constructor from a hashed key and a proxy holder object.

Used internally for EL -> DL conversion.

Parameters
keyHashed key of the object.
holderInternal holder object for the proxy.

◆ DataLink() [11/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( )

Default constructor, creating a null pointer basically.

◆ DataLink() [12/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( xAOD::TVirtualEvent event)

Constructor taking an alternative TVirtualEvent object to use.

◆ DataLink() [13/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( const_reference  data,
xAOD::TVirtualEvent event = 0 
)

Constructor receiving a reference to the target object.

◆ DataLink() [14/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( const_pointer  data,
xAOD::TVirtualEvent event = 0 
)

Constructor receiving a pointer to the target object.

◆ DataLink() [15/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( const ID_type id,
xAOD::TVirtualEvent event = 0 
)

Constructor receiving a user-readable ID for the target object.

◆ DataLink() [16/17]

template<class STORABLE >
DataLink< STORABLE >::DataLink ( sgkey_t  key,
xAOD::TVirtualEvent event = 0 
)

Constructor receiving a hashed ID for the target object.

◆ DataLink() [17/17]

template<class STORABLE >
template<typename T >
DataLink< STORABLE >::DataLink ( const DataLink< T > &  parent)

Copy constructor.

Member Function Documentation

◆ classID()

template<class STORABLE >
static const CLID& DataLink< STORABLE >::classID ( )
static

Return the CLID for the class that we reference.

◆ clear() [1/2]

void DataLinkBase::clear ( )
inherited

Clear the link (make it null)

◆ clear() [2/2]

void DataLinkBase::clear ( )
inherited

Clear the link (make it null).

Definition at line 36 of file DataLinkBase.cxx.

36  {
37 
38  m_persKey = 0;
39  return;
40 }

◆ cptr() [1/2]

template<class STORABLE >
const_pointer DataLink< STORABLE >::cptr ( ) const

Get a constant pointer to the referenced object.

◆ cptr() [2/2]

template<class STORABLE >
const_pointer DataLink< STORABLE >::cptr ( ) const

Dereference the link.

◆ dataID()

template<class STORABLE >
const ID_type& DataLink< STORABLE >::dataID ( ) const

Get the key that we reference, as a string.

◆ findIdentifier()

template<class STORABLE >
void DataLink< STORABLE >::findIdentifier ( )
private

Find the identifier of the object being pointed to.

◆ getDataNonConstPtr()

template<class STORABLE >
pointer DataLink< STORABLE >::getDataNonConstPtr ( )

Return a pointer to the currently-referenced object.

Returns
A pointer to an object of the type given by clid, or null on a failure (or if the reference is null).

◆ getDataPtr()

template<class STORABLE >
const_pointer DataLink< STORABLE >::getDataPtr ( ) const

Return a pointer to the currently-referenced object.

Returns
A pointer to an object of the type given by clid, or null on a failure (or if the reference is null).

◆ isDefault() [1/2]

bool DataLinkBase::isDefault ( ) const
inherited

Test if the link is in the default state.

◆ isDefault() [2/2]

bool DataLinkBase::isDefault ( ) const
inherited

Test to see if we're in the default state.

Definition at line 31 of file DataLinkBase.cxx.

31  {
32 
33  return ( m_persKey == 0 );
34 }

◆ isValid() [1/2]

template<class STORABLE >
bool DataLink< STORABLE >::isValid ( ) const

Check if the object can be found.

◆ isValid() [2/2]

template<class STORABLE >
bool DataLink< STORABLE >::isValid ( ) const

Test to see if the link is dereferencable.

◆ key()

template<class STORABLE >
sgkey_t DataLink< STORABLE >::key ( ) const
inline

Get the key that we reference, as a hash.

Definition at line 131 of file A/AthLinks/DataLink.h.

131 { return persKey(); }

◆ operator bool()

template<class STORABLE >
DataLink< STORABLE >::operator bool ( ) const
inline

Convenience validity check operator.

Definition at line 124 of file A/AthLinks/DataLink.h.

124 { return isValid(); }

◆ operator const_pointer() [1/2]

template<class STORABLE >
DataLink< STORABLE >::operator const_pointer ( ) const
inline

Automatic conversion operator.

Definition at line 115 of file A/AthLinks/DataLink.h.

115 { return cptr(); }

◆ operator const_pointer() [2/2]

template<class STORABLE >
DataLink< STORABLE >::operator const_pointer ( ) const

Dereference the link.

◆ operator!() [1/2]

template<class STORABLE >
bool DataLink< STORABLE >::operator! ( ) const
inline

Another convenience validity checker.

Definition at line 126 of file A/AthLinks/DataLink.h.

126 { return !isValid(); }

◆ operator!() [2/2]

template<class STORABLE >
bool DataLink< STORABLE >::operator! ( ) const

True if the link is not dereferencable.

◆ operator!=()

bool DataLinkBase::operator!= ( const DataLinkBase other) const
inherited

Compare for inequality.

◆ operator*() [1/2]

template<class STORABLE >
const_reference DataLink< STORABLE >::operator* ( ) const

Get a reference to the target object. May throw an exception.

◆ operator*() [2/2]

template<class STORABLE >
const_reference DataLink< STORABLE >::operator* ( ) const

Dereference the link.

◆ operator->() [1/2]

template<class STORABLE >
const_pointer DataLink< STORABLE >::operator-> ( ) const
inline

Get a pointer to the target object.

Definition at line 112 of file A/AthLinks/DataLink.h.

112 { return cptr(); }

◆ operator->() [2/2]

template<class STORABLE >
const_pointer DataLink< STORABLE >::operator-> ( ) const

Dereference the link.

◆ operator==()

bool DataLinkBase::operator== ( const DataLinkBase other) const
inherited

Compare for equality.

◆ persKey()

uint32_t DataLinkBase::persKey ( ) const
inherited

Get the key/identifier of the referenced container.

Definition at line 13 of file DataLinkBase.cxx.

13  {
14 
15  return m_persKey;
16 }

◆ proxy()

SG::DataProxy* DataLinkBase::proxy ( bool  nothrow = false) const
inherited

Return the DataProxy for this link.

Parameters
nothrowIf true, return 0 on failure instead of throwing an exception.

If this is a null link, we return 0. If we're directly referencing an object that's not in StoreGate, either return 0 or throw ExcPointerNotInSG, depending on nothrow. Otherwise, return the proxy for the object we're referencing.

◆ setPersKey()

void DataLinkBase::setPersKey ( uint32_t  key)
inherited

Set the key/identifier of the referenced container.

Definition at line 18 of file DataLinkBase.cxx.

18  {
19 
20  // Check if we're actually changing anything:
21  if( m_persKey == key ) return;
22  // Store the new key:
23  m_persKey = key;
24 
25  // Reset the internal cache:
26  toTransient();
27 
28  return;
29 }

◆ source()

template<class STORABLE >
xAOD::TVirtualEvent* DataLink< STORABLE >::source ( ) const
inline

Get the data source for the reference.

Definition at line 136 of file A/AthLinks/DataLink.h.

136 { return m_event; }

◆ storable()

template<class STORABLE >
const void* DataLink< STORABLE >::storable ( ) const
private

Return a (void) pointer to the currently-referenced object.

Returns
A pointer to an object of the type given by clid, or null on a failure (or if the reference is null).

◆ storableBase()

void* DataLinkBase::storableBase ( castfn_t castfn,
const CLID clid,
bool  isConst 
) const
protectedinherited

Return a pointer to the currently-referenced object.

Parameters
castfnFunction to do the cast from data proxy to object. If 0, use a dynamic cast.
clidThe CLID of the desired object. This is used to determine how the returned pointer is to be converted.
isConstTrue if the returned object will be treated as const.
Returns
A pointer to an object of the type given by clid, or null on a failure (or if the reference is null).

◆ storableNonConst()

template<class STORABLE >
void* DataLink< STORABLE >::storableNonConst ( )
private

Return a (void) pointer to the currently-referenced object.

Returns
A pointer to an object of the type given by clid, or null on a failure (or if the reference is null).

◆ throwInvalidLink()

void DataLinkBase::throwInvalidLink ( ) const
protectedinherited

Throw a ExcInvalidLink exception for this link.

Parameters
sgkeyThe hashed key for this link.

This will fill in parameters for the exception message from the proxy.

◆ toDefaultObject() [1/3]

template<class STORABLE >
void DataLink< STORABLE >::toDefaultObject ( )

Set the link to the default object of this type in the event.

◆ toDefaultObject() [2/3]

template<class STORABLE >
void DataLink< STORABLE >::toDefaultObject ( const EventContext &  ctx)

Set the link to the default object of this type.

Parameters
ctxEvent context for this link.

Note that this is not the same as clearing the link (use clear for that). This produces a link that will resolve to any object in SG of the given type, provided that there is only one of them. (An attempt to dereference an ambiguous default link will give an error.)

◆ toDefaultObject() [3/3]

template<class STORABLE >
void DataLink< STORABLE >::toDefaultObject ( IProxyDict sg = 0)

Set the link to the default object of this type.

Parameters
sgAssociated store.

If sg is 0, then we take the store from whatever the link's currently set to. If the link has no current store, then we take the global default.

Note that this is not the same as clearing the link (use clear for that). This produces a link that will resolve to any object in SG of the given type, provided that there is only one of them. (An attempt to dereference an ambiguous default link will give an error.)

◆ toIdentifiedObject() [1/8]

void DataLinkBase::toIdentifiedObject ( const ID_type dataID,
CLID  clid,
IProxyDict sg 
)
protectedinherited

Set the link to an object given by a string key.

Parameters
dataIDKey of the object.
link_clidCLID of the link being set.
sgAssociated store.
Returns
The SG key for this object.

If sg is 0, then we take the store from whatever the link's currently set to. If the link has no current store, then we take the global default.

◆ toIdentifiedObject() [2/8]

template<class STORABLE >
void DataLink< STORABLE >::toIdentifiedObject ( const ID_type dataID,
const EventContext &  ctx 
)

Set the link to an object given by a string key.

Parameters
dataIDKey of the object.
ctxEvent context for this link.

◆ toIdentifiedObject() [3/8]

template<class STORABLE >
void DataLink< STORABLE >::toIdentifiedObject ( const ID_type dataID,
IProxyDict sg = 0 
)

Set the link to an object given by a string key.

Parameters
dataIDKey of the object.
sgAssociated store.

If sg is 0, then we take the store from whatever the link's currently set to. If the link has no current store, then we take the global default.

◆ toIdentifiedObject() [4/8]

template<class STORABLE >
void DataLink< STORABLE >::toIdentifiedObject ( const ID_type id)

Set the link using a user readable ID for the target object.

◆ toIdentifiedObject() [5/8]

template<class STORABLE >
void DataLink< STORABLE >::toIdentifiedObject ( sgkey_t  key)

Set the link using a hashed ID for the target object.

◆ toIdentifiedObject() [6/8]

void DataLinkBase::toIdentifiedObject ( sgkey_t  key,
CLID  clid,
IProxyDict sg 
)
protectedinherited

Set the link to an object given by a hashed key.

Parameters
keyHashed key of the object.
link_clidCLID of the link being set.
sgAssociated store.

If sg is 0, then we take the store from whatever the link's currently set to. If the link has no current store, then we take the global default.

May throw ExcCLIDMismatch.

◆ toIdentifiedObject() [7/8]

template<class STORABLE >
void DataLink< STORABLE >::toIdentifiedObject ( sgkey_t  key,
const EventContext &  ctx 
)

Set the link to an object given by a hashed key.

Parameters
keyHashed key of the object.
ctxEvent context for this link.

May throw ExcCLIDMismatch.

◆ toIdentifiedObject() [8/8]

template<class STORABLE >
void DataLink< STORABLE >::toIdentifiedObject ( sgkey_t  key,
IProxyDict sg = 0 
)

Set the link to an object given by a hashed key.

Parameters
keyHashed key of the object.
sgAssociated store.

If sg is 0, then we take the store from whatever the link's currently set to. If the link has no current store, then we take the global default.

May throw ExcCLIDMismatch.

◆ toPersistent()

template<class STORABLE >
bool DataLink< STORABLE >::toPersistent ( )

Prepare the object to be written out.

◆ toPersistentNoRemap()

bool DataLinkBase::toPersistentNoRemap ( )
inherited

Prepare this link for writing.

One of the toPersistent methods should be called before trying to write the link with root.

Ensures the hashed SG key to be saved is correct. If this link is referencing an object not in SG, we throw ExcPointerNotInSG.

This version does not perform link remapping.

Returns true.

◆ toStorableObject() [1/4]

void DataLinkBase::toStorableObject ( const_pointer_t  obj,
CLID  clid_in,
IProxyDict sg 
)
protectedinherited

Set the link to an object given by a pointer.

Parameters
objPointer to the object.
link_clidCLID of the link being set.
sgAssociated store.
Returns
The SG key for this object.

If sg is 0, then we take the store from whatever the link's currently set to. If the link has no current store, then we take the global default.

May throw ExcCLIDMismatch.

◆ toStorableObject() [2/4]

template<class STORABLE >
void DataLink< STORABLE >::toStorableObject ( const_reference  data)

Set the link to a data object that's already in the event.

◆ toStorableObject() [3/4]

template<class STORABLE >
void DataLink< STORABLE >::toStorableObject ( const_reference  data,
const EventContext &  ctx 
)

Set the link to an object given by a reference.

Parameters
dataThe object to which to link.
ctxEvent context for this link.

◆ toStorableObject() [4/4]

template<class STORABLE >
void DataLink< STORABLE >::toStorableObject ( const_reference  data,
IProxyDict sg = 0 
)

Set the link to an object given by a reference.

Parameters
dataThe object to which to link.
sgAssociated store.

If sg is 0, then we take the store from whatever the link's currently set to. If the link has no current store, then we take the global default.

◆ toTransient() [1/7]

template<class STORABLE >
virtual bool DataLink< STORABLE >::toTransient ( )
privatevirtual

Reset the object's internal cache.

Implements DataLinkBase.

◆ toTransient() [2/7]

template<class STORABLE >
bool DataLink< STORABLE >::toTransient ( const EventContext &  ctx)

Finish initialization after link has been read.

Parameters
ctxEvent context for this link.

This should be called after a link has been read by root in order to set the proxy pointer. Returns true.

◆ toTransient() [3/7]

bool DataLinkBase::toTransient ( const ID_type dataID,
CLID  link_clid,
const EventContext &  ctx 
)
inherited

Finish initialization like the link as just been read from root, but with a specified key.

Parameters
dataIDKey of the object.
link_clidCLID of the link being set.
ctxEvent context for this link.

The link should be clear before this is called. Returns true.

◆ toTransient() [4/7]

bool DataLinkBase::toTransient ( const ID_type dataID,
CLID  link_clid,
IProxyDict sg = 0 
)
inherited

Finish initialization like the link as just been read from root, but with a specified key.

Parameters
dataIDKey of the object.
link_clidCLID of the link being set.
sgAssociated store.

The link should be clear before this is called. Returns true.

If sg is 0, then we use the global default store.

◆ toTransient() [5/7]

template<class STORABLE >
bool DataLink< STORABLE >::toTransient ( const ID_type dataID,
const EventContext &  ctx 
)

Finish initialization like the link as just been read from root, but with a specified key.

Parameters
dataIDKey of the object.
ctxEvent context for this link.

The link should be clear before this is called. Returns true.

◆ toTransient() [6/7]

template<class STORABLE >
bool DataLink< STORABLE >::toTransient ( const ID_type dataID,
IProxyDict sg = 0 
)

Finish initialization like the link as just been read from root, but with a specified key.

Parameters
dataIDKey of the object.
sgAssociated store.

The link should be clear before this is called. Returns true.

If sg is 0, then we use the global default store.

◆ toTransient() [7/7]

template<class STORABLE >
bool DataLink< STORABLE >::toTransient ( IProxyDict sg = 0)

Finish initialization after link has been read.

Parameters
sgAssociated store.

This should be called after a link has been read by root in order to set the proxy pointer. Returns true.

If sg is 0, then we use the global default store.

Member Data Documentation

◆ m_event [1/2]

template<class STORABLE >
xAOD::TVirtualEvent* DataLink< STORABLE >::m_event
private

Pointer to the event object.

Definition at line 150 of file A/AthLinks/DataLink.h.

◆ m_event [2/2]

template<class STORABLE >
ROOT_SELECTION_NS::MemberAttributes< kTransient > DataLink< STORABLE >::m_event

Declare m_event as transient.

Definition at line 173 of file A/AthLinks/DataLink.h.

◆ m_isDirectIO

bool DataLinkBase::m_isDirectIO
protectedinherited

A transient variable signalling when direct I/O is happening.

This flag is used exclusively by the DataLink<>::toTransient() function to know when it should take the persistent data stored in this object into account. That function may be called in normal P->T conversions as well, in which case using the data from this class would just reset the object to its default state.

Definition at line 60 of file A/AthLinks/DataLinkBase.h.

◆ m_object [1/2]

template<class STORABLE >
const_pointer DataLink< STORABLE >::m_object
mutableprivate

Cached pointer to the object.

Definition at line 148 of file A/AthLinks/DataLink.h.

◆ m_object [2/2]

template<class STORABLE >
ROOT_SELECTION_NS::MemberAttributes< kTransient > DataLink< STORABLE >::m_object

Declare m_object as transient.

Definition at line 171 of file A/AthLinks/DataLink.h.

◆ m_persKey [1/2]

uint32_t DataLinkBase::m_persKey
protectedinherited

Key/identifier of the referenced object.

Definition at line 50 of file A/AthLinks/DataLinkBase.h.

◆ m_persKey [2/2]

sgkey_t DataLinkBase::m_persKey
privateinherited

The hashed key for this link.

Definition at line 341 of file AthLinks/DataLinkBase.h.

◆ m_proxy

SG::DataProxyHolder DataLinkBase::m_proxy
privateinherited

SG proxy for this link.

Definition at line 344 of file AthLinks/DataLinkBase.h.


The documentation for this class was generated from the following file:
DataLinkBase::m_persKey
sgkey_t m_persKey
The hashed key for this link.
Definition: AthLinks/DataLinkBase.h:341
DataLinkBase::persKey
uint32_t persKey() const
Get the key/identifier of the referenced container.
Definition: DataLinkBase.cxx:13
DataLinkBase::key
sgkey_t key() const
Return the SG key that we reference, as a hash.
DataLinkBase::toTransient
virtual bool toTransient()=0
Reset the object's internal cache.
python.PyAthena.obj
obj
Definition: PyAthena.py:132