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

ElementLink implementation for ROOT usage. More...

#include <ElementLink.h>

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

Public Types

typedef Traits::IndexingPolicy IndexingPolicy
 The indexing policy. More...
 
typedef IndexingPolicy::index_type index_type
 The index type presented to and returned from the link. More...
 
typedef Base::sgkey_t sgkey_t
 Type of hashed keys. More...
 
typedef Base::ID_type ID_type
 Type of string keys. More...
 
typedef STORABLE value_type
 Type of container (storable) and derived types. More...
 
typedef STORABLE * pointer
 
typedef const STORABLE * const_pointer
 
typedef const STORABLE & BaseConstReference
 
typedef const STORABLE * BaseConstPointer
 
typedef IndexingPolicy::ElementType ElementType
 Container element and derived types. More...
 
typedef IndexingPolicy::ElementConstReference ElementConstReference
 
typedef IndexingPolicy::ElementConstPointer ElementConstPointer
 
typedef ElementLink< STORABLE > self
 Helper definition. More...
 
typedef INDEXING_POLICY::stored_index_type stored_index_type
 The type of the index as it is stored internally. 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 const STORABLE & BaseConstReference
 Constant reference to the container. More...
 
typedef const STORABLE * BaseConstPointer
 Constant pointer to the container. More...
 
typedef size_t index_type
 Type of the index used on the container. More...
 
typedef STORABLE::value_type value_type
 Type of the values inside the container. More...
 
typedef STORABLE::const_iterator const_iterator
 Constant iterator type for the container. More...
 
typedef TypeTools::Copy< value_type >::type ElementType
 Type of the elements in the container. More...
 
typedef TypeTools::Copy< value_type >::const_reference ElementConstReference
 Constant reference to an element in the container. More...
 
typedef TypeTools::Copy< value_type >::const_pointer ElementConstPointer
 Constant pointer to an element in the container. More...
 

Public Member Functions

ElementLinkoperator= (const ElementLink &rhs)
 Assignment operator. More...
 
xAOD::TVirtualEventsource () const
 Get the data source for the reference. More...
 
bool toPersistent ()
 Dummy function provinding the offline interface. More...
 
bool isDefaultIndex () const
 Test the index validity. More...
 
bool isDefault () const
 Test to see if this link is in the default state. More...
 
const SG::DataProxyproxy () const
 Return the SG proxy for the container holding this element. More...
 
bool toTransient (IProxyDict *sg=0)
 Finish initialization after link has been read. More...
 
bool thin ()
 Adjust for thinning. More...
 
bool thin (const SG::ThinningCache *thinningCache)
 Adjust for thinning. More...
 
Constructors.
 ElementLink ()
 Default constructor. More...
 
 ElementLink (const ID_type &dataID, index_type elemID, IProxyDict *sg=0)
 Construct a link from a string storable key and an index. More...
 
 ElementLink (const ID_type &dataID, index_type elemID, const EventContext &ctx)
 Construct a link from a string storable key and an index. More...
 
 ElementLink (sgkey_t key, index_type elemID, IProxyDict *sg=0)
 Construct a link from a hashed storable key and an index. More...
 
 ElementLink (sgkey_t key, index_type elemID, const EventContext &ctx)
 Construct a link from a hashed storable key and an index. More...
 
 ElementLink (const ID_type &dataID, index_type elemID, ElementType pEl, IProxyDict *sg=0)
 Construct from a string storable key, index, AND pointer to element. More...
 
 ElementLink (const ID_type &dataID, index_type elemID, ElementType pEl, const EventContext &ctx)
 Construct from a string storable key, index, AND pointer to element. More...
 
 ElementLink (sgkey_t key, index_type elemID, ElementType pEl, IProxyDict *sg=0)
 Construct from a hashed storable key, index, AND pointer to element. More...
 
 ElementLink (sgkey_t key, index_type elemID, ElementType pEl, const EventContext &ctx)
 Construct from a hashed storable key, index, AND pointer to element. More...
 
 ElementLink (BaseConstReference data, index_type elemID, IProxyDict *sg=0)
 Construct a link from an index and reference to the container. More...
 
 ElementLink (BaseConstReference data, index_type elemID, const EventContext &ctx)
 Construct a link from an index and reference to the container. More...
 
 ElementLink (const ElementType &element, BaseConstReference data, IProxyDict *sg=0)
 Construct from an element and reference to the container. More...
 
 ElementLink (const ElementType &element, BaseConstReference data, const EventContext &ctx)
 Construct from an element and reference to the container. More...
 
 ElementLink (const ElementLink &other, index_type elemID)
 Construct a link from another link, changing the index. More...
 
 ElementLink (const DataLink< STORABLE > &dlink, index_type index)
 Construct a link from a DataLink and an index. More...
 
template<class U >
 ElementLink (const ElementLink< U > &other)
 Constructor allowing a derived -> base conversion. More...
 
 ElementLink (const ElementLink &)=default
 
ElementLinkoperator= (const ElementLink &)=default
 
Dereferencing the link.
const_pointer getDataPtr () const
 Return a pointer to the currently-referenced container object. More...
 
pointer getDataNonConstPtr ()
 Return a pointer to the currently-referenced container object. More...
 
DataLink< STORABLE > getDataLink ()
 Return a link to the currently-referenced container object. More...
 
const DataLink< STORABLE > getDataLink () const
 Return a link to the currently-referenced container object. More...
 
BaseConstPointer getStorableObjectPointer () const
 Return a pointer to the currently-referenced container object. More...
 
BaseConstReference getStorableObjectRef () const
 Return a reference to the currently-referenced container object. More...
 
ElementConstPointer cptr () const
 Return a pointer to the referenced element. More...
 
ElementConstReference operator* () const
 Return a reference to the referenced element. More...
 
ElementConstPointer operator-> () const
 Return a pointer to the referenced element. More...
 
 operator ElementConstPointer () const
 Convert to a pointer to the referenced element. More...
 
bool isValid () const
 Test to see if the link can be dereferenced. More...
 
bool operator! () const
 Test to see if the link can not be dereferenced. More...
 
ElementType cachedElement () const
 Return the cached element, if any. More...
 
Constructors
 ElementLink ()
 Default constructor. More...
 
 ElementLink (xAOD::TVirtualEvent *event)
 Constructor setting up the link with a specific event object. More...
 
 ElementLink (const ID_type &key, index_type index, xAOD::TVirtualEvent *event=0)
 Construct object from storable key and element index (fast) More...
 
 ElementLink (sgkey_t id, index_type index, xAOD::TVirtualEvent *event=0)
 Construct object from storable id and element index (fastest) More...
 
 ElementLink (const ID_type &key, index_type index, ElementType element, xAOD::TVirtualEvent *event=0)
 Construct from a storable key and element index, taking the element object from the user. More...
 
 ElementLink (sgkey_t id, index_type index, ElementType element, xAOD::TVirtualEvent *event=0)
 Construct from a storable id and element index, taking the element object from the user. More...
 
 ElementLink (BaseConstReference container, index_type index, xAOD::TVirtualEvent *event=0)
 Construct from a container reference and element index (slower) More...
 
 ElementLink (ElementType element, BaseConstReference container, xAOD::TVirtualEvent *event=0)
 Construct from a container reference and element pointer (slowest) More...
 
 ElementLink (const ElementLink &parent)
 Copy-constructor. More...
 
Setter functions
bool toIndexedElement (BaseConstReference container, index_type index)
 Set link to point to given index (slower) More...
 
bool toContainedElement (BaseConstReference container, ElementType element)
 Set link to point to given element (slowest) More...
 
bool setElement (ElementType element)
 Set link to point to an Element (slowest) More...
 
bool setStorableObject (BaseConstReference data, bool replace=false)
 Set link storable to data object pointed by data (slower) More...
 
void resetWithKeyAndIndex (const ID_type &key, index_type index, xAOD::TVirtualEvent *event=0)
 Reset with storable key and element index (fast) More...
 
void resetWithKeyAndIndex (sgkey_t id, index_type index, xAOD::TVirtualEvent *event=0)
 Reset with storable id and element index (fastest) More...
 
void reset ()
 Reset to default state. More...
 
Accessor functions/operators
BaseConstPointer getStorableObjectPointer () const
 Retrieve storable object pointer. More...
 
BaseConstReference getStorableObjectRef () const
 Retrieve storable object reference. More...
 
index_type index () const
 Get the index of the element inside of its container. 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...
 
bool operator== (const ElementLink &rhs) const
 Comparison operator. More...
 
bool operator!= (const ElementLink &rhs) const
 Comparison operator. More...
 
ElementConstReference operator* () const
 Get a reference to the object in question. More...
 
ElementConstPointer operator-> () const
 Access the object as a smart pointer. More...
 
 operator ElementConstPointer () const
 Auto-convert to the element type. More...
 
ElementConstPointer cptr () const
 Get a constant pointer to the referenced object. More...
 
bool isValid () const
 Check if the element can be found. More...
 
bool operator! () const
 Operator checking the validity of the link. More...
 
ElementType cachedElement () const
 Access the currently cached element. Doesn't trigger lookup. More...
 
bool hasCachedElement () const
 Check if the link has a cached element pointer. 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_container
 Mark all transient members: More...
 
ROOT_SELECTION_NS::MemberAttributes< kTransient > m_element
 
ROOT_SELECTION_NS::MemberAttributes< kTransient > m_elementCached
 
ROOT_SELECTION_NS::MemberAttributes< kTransient > m_event
 
ROOT_SELECTION_NS::TRANSIENT m_proxy
 
ROOT_SELECTION_NS::TRANSIENT m_cacheValid
 

Protected Member Functions

void * storableBase (castfn_t *castfn, const CLID &clid, bool isConst) const
 Return a pointer to the currently-referenced container object. More...
 
bool setStorableObject (const_pointer_t data, CLID link_clid, bool replace, IProxyDict *sg)
 Set the container referenced by the link to data. More...
 
bool toIndexedElement (const_pointer_t obj, CLID link_clid, const index_type &elemID, IProxyDict *sg)
 Set the to an element given by index and pointer to container. More...
 
void resetWithKeyAndIndex (const ID_type &dataID, CLID link_clid, const index_type &elemID, IProxyDict *sg)
 Set the link to an element given by string key and index. More...
 
void resetWithKeyAndIndex (sgkey_t key, CLID link_clid, const index_type &elemID, IProxyDict *sg)
 Set the link to an element given by string key and index. More...
 
void setIndex (const index_type &index)
 Set the index part of the link. More...
 
const stored_index_typestoredIndex () const
 Return the stored representation of the link index. More...
 
void setCachedElement (const ElementType &elt) const
 Set the cached element stored in the link. More...
 
void storeCachedElement (const ElementType &elt)
 Set the cached element stored in the link. More...
 
bool getCachedElement (ElementConstPointer &elt) const
 Retrieve the cached element from the link. More...
 
const SG::DataProxyHolderproxyHolder () const
 Return the internal proxy holder object. More...
 

Private Types

typedef SG::ElementLinkTraits< STORABLE > Traits
 Traits class, from which to derive types. More...
 
typedef Traits::Base Base
 Base class (factoring out code that doesn't directly depend on STORABLE). More...
 
typedef Base::castfn_t castfn_t
 Function casting from a SG::DataProxy to a pointer. More...
 
typedef ROOT_SELECTION_NS::ElementLink< STORABLE >::self DictSel
 Needed to take the Reflex/Cling specifications into account. More...
 
typedef SG::DataProxyHolder::const_pointer_t const_pointer_t
 Generic pointer to the container (storable). 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...
 
void findIndex ()
 Find the index of an element inside the container. More...
 
template<class INDEX >
 requires (std::convertible_to< INDEX, size_t > &&std::convertible_to< size_t, INDEX >) bool thin1(INDEX &persIndex
 Adjust for thinning. More...
 
template<class INDEX >
 requires (!(std::convertible_to< INDEX, size_t > &&std::convertible_to< size_t, INDEX >)) bool thin1(INDEX &persIndex
 Adjust for thinning. More...
 

Private Attributes

BaseConstPointer m_container
 Cached pointer to the container. More...
 
ElementType m_element
 Cached pointer to the object. More...
 
bool m_elementCached
 Status of the cached pointer. More...
 
xAOD::TVirtualEventm_event
 Pointer to the event object. More...
 
const SG::ThinningCachethinningCache
 
SG::sgkey_t m_key
 The hashed key for this link. More...
 
stored_index_type m_index
 The index of the element within the container for this link. More...
 
SG::DataProxyHolder m_proxy
 SG proxy for this link. More...
 

Modifying the link.

bool toIndexedElement (BaseConstReference data, index_type elemID, IProxyDict *sg=0)
 Set the link to an element given by index and pointer to container. More...
 
bool toIndexedElement (BaseConstReference data, index_type elemID, const EventContext &ctx)
 Set the link to an element given by index and pointer to container. More...
 
bool toContainedElement (BaseConstReference data, ElementType element, IProxyDict *sg=0)
 Set from element pointer and a reference to the container (storable) More...
 
bool toContainedElement (BaseConstReference data, ElementType element, const EventContext &ctx)
 Set from element pointer and a reference to the container (storable) More...
 
bool setElement (ElementType element)
 Set to point to an element. More...
 
bool setStorableObject (BaseConstReference data, bool replace=false, IProxyDict *sg=0)
 Set link to point to a new container (storable). More...
 
bool setStorableObject (BaseConstReference data, bool replace, const EventContext &ctx)
 Set link to point to a new container (storable). More...
 
void resetWithKeyAndIndex (const ID_type &dataID, index_type elemID, IProxyDict *sg=0)
 Set the link to an element given by string key and index. More...
 
void resetWithKeyAndIndex (const ID_type &dataID, index_type elemID, const EventContext &ctx)
 Set the link to an element given by string key and index. More...
 
void resetWithKeyAndIndex (sgkey_t key, index_type elemID, IProxyDict *sg=0)
 Set the link to an element given by string key and index. More...
 
void resetWithKeyAndIndex (sgkey_t key, index_type elemID, const EventContext &ctx)
 Set the link to an element given by string key and index. More...
 
const void * storable () const
 Return a (void) pointer to the currently-referenced container object. More...
 
void * storableNonConst ()
 Return a (void) pointer to the currently-referenced container object. More...
 

Detailed Description

template<class STORABLE>
class ElementLink< STORABLE >

ElementLink implementation for ROOT usage.

a persistable pointer to an element of a STORABLE (data object)

This class follows the interface of the offline implementation of ElementLink as closely as reasonably possible. Its functions are supposed to behave the same way as the functions of the offline ElementLink class.

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h
Revision
649074
Date
2015-02-23 17:51:40 +0100 (Mon, 23 Feb 2015)
Parameters
STORABLEhost object type (e,g. vector<Elem>, NOT Elem),

An ElementLink maintains a reference to a container that can be in StoreGate (a la DataLink) and an index within that container. This then identifies an element within the container.

The preferred way to initialize an ElementLink is with the StoreGate key and index. However, the link may also be initialized using the container directly instead of the key, or with the element directly. In the latter case, the reference to the container can be specified later. Be aware, though, that if you initialize the link from the element directly, without the index, the container will have to be searched if the index is needed, which could be slow. Also, if the index and StoreGate key are not available (for example, the container wasn't recorded in StoreGate), then the link will not be persistable.

The relationship between the container and the index is encapsulated by an ‘indexing policy’ class. You normally don't need to worry about this, as the appropriate policy is automatically chosen for STL sequence types as well as for STL set and map types. However, it is possible to customize the policy used, if needed. See the macros in DeclareIndexingPolicy.h; the interface required of an indexing policy is summarized in tools/ElementLinkTraits.h.

Regardless of the indexing policy, all container types must support empty().

Forward declarations:

Dealing with forward declarations has been a problem. For example, you have a class MyCont which is a vector of pointers to MyElt, where MyElt contains an ElementLink<MyCont>. Here is a way to get this to work.

In your header for MyElt, make a forward declaration for MyCont. Then include the special macro ELEMENTLINK_FWD:

ELEMENTLINK_FWD(MyCont, MyElt);

where the first argument is the container type and the second argument is the base type of the (pointer) value type of the container. You can then write a data member of type ElementLink<MyCont>. You will need to have the complete definition of MyCont available in order to actaully call methods on the link, so you'll likely need to include the header for MyCont within the implementation file for MyElt. A more complete example of what the header for MyElt might look like:

#include "AthLinks/ElementLink.h"
class MyElt;
class MyCont;
ELEMENTLINK_FWD(MyCont, MyElt);
class MyElt { ...
};

Restrictions:

Implementation notes:

Internally, we store a hashed SG key, a DataProxyHolder instance to encapsulate access to the DataProxy, the index, and a cached copy of the element to which we refer. These last two are in general of arbitrary type. However, the vast majority of EL instantiations refer to vectors of pointers; in that case, we can get away fixed types for these (an unsigned for the index and a void* for the cached element). Since it makes ROOT I/O easier if our state is in a non-templated class, we move all the state of ElementLink into a base class. The particular type of base class is chosen by ElementLinkTraits: the non-templated class ElementLinkBase is used for the vector of pointers case, while the templated GenericElementLinkBase class is used for the general case.

Definition at line 119 of file AthLinks/ElementLink.h.

Member Typedef Documentation

◆ Base

template<class STORABLE >
typedef Traits::Base ElementLink< STORABLE >::Base
private

Base class (factoring out code that doesn't directly depend on STORABLE).

Definition at line 127 of file AthLinks/ElementLink.h.

◆ BaseConstPointer [1/2]

template<class STORABLE >
typedef const STORABLE* ElementLink< STORABLE >::BaseConstPointer

Constant pointer to the container.

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

◆ BaseConstPointer [2/2]

template<class STORABLE >
typedef const STORABLE* ElementLink< STORABLE >::BaseConstPointer

Definition at line 151 of file AthLinks/ElementLink.h.

◆ BaseConstReference [1/2]

template<class STORABLE >
typedef const STORABLE& ElementLink< STORABLE >::BaseConstReference

Constant reference to the container.

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

◆ BaseConstReference [2/2]

template<class STORABLE >
typedef const STORABLE& ElementLink< STORABLE >::BaseConstReference

Definition at line 150 of file AthLinks/ElementLink.h.

◆ castfn_t

template<class STORABLE >
typedef Base::castfn_t ElementLink< STORABLE >::castfn_t
private

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

Definition at line 130 of file AthLinks/ElementLink.h.

◆ const_iterator

template<class STORABLE >
typedef STORABLE::const_iterator ElementLink< STORABLE >::const_iterator

Constant iterator type for the container.

Definition at line 63 of file A/AthLinks/ElementLink.h.

◆ const_pointer

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

Definition at line 149 of file AthLinks/ElementLink.h.

◆ const_pointer_t

template<class INDEXING_POLICY >
typedef SG::DataProxyHolder::const_pointer_t SG::GenericElementLinkBase< INDEXING_POLICY >::const_pointer_t
privateinherited

Generic pointer to the container (storable).

Definition at line 84 of file GenericElementLinkBase.h.

◆ DictSel

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

Needed to take the Reflex/Cling specifications into account.

Definition at line 209 of file A/AthLinks/ElementLink.h.

◆ ElementConstPointer [1/2]

template<class STORABLE >
typedef TypeTools::Copy< value_type >::const_pointer ElementLink< STORABLE >::ElementConstPointer

Constant pointer to an element in the container.

Definition at line 72 of file A/AthLinks/ElementLink.h.

◆ ElementConstPointer [2/2]

template<class STORABLE >
typedef IndexingPolicy::ElementConstPointer ElementLink< STORABLE >::ElementConstPointer

Definition at line 157 of file AthLinks/ElementLink.h.

◆ ElementConstReference [1/2]

template<class STORABLE >
typedef TypeTools::Copy< value_type >::const_reference ElementLink< STORABLE >::ElementConstReference

Constant reference to an element in the container.

Definition at line 69 of file A/AthLinks/ElementLink.h.

◆ ElementConstReference [2/2]

template<class STORABLE >
typedef IndexingPolicy::ElementConstReference ElementLink< STORABLE >::ElementConstReference

Definition at line 156 of file AthLinks/ElementLink.h.

◆ ElementType [1/2]

template<class STORABLE >
typedef TypeTools::Copy< value_type >::type ElementLink< STORABLE >::ElementType

Type of the elements in the container.

Definition at line 66 of file A/AthLinks/ElementLink.h.

◆ ElementType [2/2]

template<class STORABLE >
typedef IndexingPolicy::ElementType ElementLink< STORABLE >::ElementType

Container element and derived types.

Definition at line 155 of file AthLinks/ElementLink.h.

◆ ID_type [1/2]

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

Type of the "regular" identifiers in the event.

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

◆ ID_type [2/2]

template<class STORABLE >
typedef Base::ID_type ElementLink< STORABLE >::ID_type

Type of string keys.

Definition at line 144 of file AthLinks/ElementLink.h.

◆ index_type [1/2]

template<class STORABLE >
typedef size_t ElementLink< STORABLE >::index_type

Type of the index used on the container.

Definition at line 58 of file A/AthLinks/ElementLink.h.

◆ index_type [2/2]

template<class STORABLE >
typedef IndexingPolicy::index_type ElementLink< STORABLE >::index_type

The index type presented to and returned from the link.

Definition at line 138 of file AthLinks/ElementLink.h.

◆ IndexingPolicy

template<class STORABLE >
typedef Traits::IndexingPolicy ElementLink< STORABLE >::IndexingPolicy

The indexing policy.

Definition at line 135 of file AthLinks/ElementLink.h.

◆ pointer

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

Definition at line 148 of file AthLinks/ElementLink.h.

◆ self

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

Helper definition.

Definition at line 232 of file A/AthLinks/ElementLink.h.

◆ sgkey_t [1/2]

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

Integer identifier for the object in the event.

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

◆ sgkey_t [2/2]

template<class STORABLE >
typedef Base::sgkey_t ElementLink< STORABLE >::sgkey_t

Type of hashed keys.

Definition at line 141 of file AthLinks/ElementLink.h.

◆ stored_index_type

template<class INDEXING_POLICY >
typedef INDEXING_POLICY::stored_index_type SG::GenericElementLinkBase< INDEXING_POLICY >::stored_index_type
inherited

The type of the index as it is stored internally.

Definition at line 92 of file GenericElementLinkBase.h.

◆ Traits

template<class STORABLE >
typedef SG::ElementLinkTraits<STORABLE> ElementLink< STORABLE >::Traits
private

Traits class, from which to derive types.

Definition at line 124 of file AthLinks/ElementLink.h.

◆ value_type [1/2]

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

Type of the values inside the container.

Definition at line 61 of file A/AthLinks/ElementLink.h.

◆ value_type [2/2]

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

Type of container (storable) and derived types.

Definition at line 147 of file AthLinks/ElementLink.h.

Constructor & Destructor Documentation

◆ ElementLink() [1/26]

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

Default constructor.

Makes a null link.

◆ ElementLink() [2/26]

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

Construct a link from a string storable key and an index.

O(1)

Parameters
dataIDKey of the object.
elemIDThe index of the element within the container.
sgAssociated store.

If sg is 0, we take the global default.

◆ ElementLink() [3/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( const ID_type dataID,
index_type  elemID,
const EventContext &  ctx 
)

Construct a link from a string storable key and an index.

O(1)

Parameters
dataIDKey of the object.
elemIDThe index of the element within the container.
ctxEvent context for this link.

◆ ElementLink() [4/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( sgkey_t  key,
index_type  elemID,
IProxyDict sg = 0 
)

Construct a link from a hashed storable key and an index.

O(1)

Parameters
keyHashed key of the object.
elemIDThe index of the element within the container.
sgAssociated store.

If sg is 0, we take the global default.

◆ ElementLink() [5/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( sgkey_t  key,
index_type  elemID,
const EventContext &  ctx 
)

Construct a link from a hashed storable key and an index.

O(1)

Parameters
keyHashed key of the object.
elemIDThe index of the element within the container.
ctxEvent context for this link.

◆ ElementLink() [6/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( const ID_type dataID,
index_type  elemID,
ElementType  pEl,
IProxyDict sg = 0 
)

Construct from a string storable key, index, AND pointer to element.

O(1)

Parameters
dataIDKey of the object.
elemIDThe index of the element within the container.
pElPointer to the element.
sgAssociated store.

USE CAREFULLY: no coherency checks, we just trust you!

If sg is 0, we take the global default.

◆ ElementLink() [7/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( const ID_type dataID,
index_type  elemID,
ElementType  pEl,
const EventContext &  ctx 
)

Construct from a string storable key, index, AND pointer to element.

O(1)

Parameters
dataIDKey of the object.
elemIDThe index of the element within the container.
pElPointer to the element.
ctxEvent context for this link.

USE CAREFULLY: no coherency checks, we just trust you!

◆ ElementLink() [8/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( sgkey_t  key,
index_type  elemID,
ElementType  pEl,
IProxyDict sg = 0 
)

Construct from a hashed storable key, index, AND pointer to element.

O(1)

Parameters
keyHashed key of the object.
elemIDThe index of the element within the container.
pElPointer to the element.
sgAssociated store.

USE CAREFULLY: no coherency checks, we just trust you!

If sg is 0, we take the global default.

◆ ElementLink() [9/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( sgkey_t  key,
index_type  elemID,
ElementType  pEl,
const EventContext &  ctx 
)

Construct from a hashed storable key, index, AND pointer to element.

O(1)

Parameters
keyHashed key of the object.
elemIDThe index of the element within the container.
pElPointer to the element.
ctxEvent context for this link.

USE CAREFULLY: no coherency checks, we just trust you!

◆ ElementLink() [10/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( BaseConstReference  data,
index_type  elemID,
IProxyDict sg = 0 
)

Construct a link from an index and reference to the container.

O(1)

Parameters
dataReference to the container (storable).
elemIDThe index of the element within the container.
sgAssociated store.

If sg is 0, we take the global default.

◆ ElementLink() [11/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( BaseConstReference  data,
index_type  elemID,
const EventContext &  ctx 
)

Construct a link from an index and reference to the container.

O(1)

Parameters
dataReference to the container (storable).
elemIDThe index of the element within the container.
ctxEvent context for this link.

◆ ElementLink() [12/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( const ElementType element,
BaseConstReference  data,
IProxyDict sg = 0 
)

Construct from an element and reference to the container.

O(N)

Parameters
elementThe element to reference.
dataReference to the container (storable).
sgAssociated store.

Does the same thing as the default ctor followed by toContainedElement. Note the reversed parameter order compared to the previous constructor. This is to prevent ambiguities in the case that the contained type is convertable to an int.

Will throw SG::ExcElementNotFound if the element is not in the container.

If sg is 0, we take the global default.

◆ ElementLink() [13/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( const ElementType element,
BaseConstReference  data,
const EventContext &  ctx 
)

Construct from an element and reference to the container.

O(N)

Parameters
elementThe element to reference.
dataReference to the container (storable).
ctxEvent context for this link.

Does the same thing as the default ctor followed by toContainedElement. Note the reversed parameter order compared to the previous constructor. This is to prevent ambiguities in the case that the contained type is convertable to an int.

Will throw SG::ExcElementNotFound if the element is not in the container.

◆ ElementLink() [14/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( const ElementLink< STORABLE > &  other,
index_type  elemID 
)

Construct a link from another link, changing the index.

Parameters
otherThe source link.
elemIDThe index for the new link.

The index being constructed will reference the same container as other, but it will refer to element elemID.

◆ ElementLink() [15/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( const DataLink< STORABLE > &  dlink,
index_type  index 
)

Construct a link from a DataLink and an index.

Parameters
dlinkLink to the container.
indexThe index of the element within the container.

◆ ElementLink() [16/26]

template<class STORABLE >
template<class U >
ElementLink< STORABLE >::ElementLink ( const ElementLink< U > &  other)

Constructor allowing a derived -> base conversion.

◆ ElementLink() [17/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( const ElementLink< STORABLE > &  )
default

◆ ElementLink() [18/26]

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

Default constructor.

◆ ElementLink() [19/26]

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

Constructor setting up the link with a specific event object.

◆ ElementLink() [20/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( const ID_type key,
index_type  index,
xAOD::TVirtualEvent event = 0 
)

Construct object from storable key and element index (fast)

◆ ElementLink() [21/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( sgkey_t  id,
index_type  index,
xAOD::TVirtualEvent event = 0 
)

Construct object from storable id and element index (fastest)

◆ ElementLink() [22/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( const ID_type key,
index_type  index,
ElementType  element,
xAOD::TVirtualEvent event = 0 
)

Construct from a storable key and element index, taking the element object from the user.

Be careful, no checks are done on the received object!

◆ ElementLink() [23/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( sgkey_t  id,
index_type  index,
ElementType  element,
xAOD::TVirtualEvent event = 0 
)

Construct from a storable id and element index, taking the element object from the user.

Be careful, no checks are done on the received object!

◆ ElementLink() [24/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( BaseConstReference  container,
index_type  index,
xAOD::TVirtualEvent event = 0 
)

Construct from a container reference and element index (slower)

◆ ElementLink() [25/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( ElementType  element,
BaseConstReference  container,
xAOD::TVirtualEvent event = 0 
)

Construct from a container reference and element pointer (slowest)

◆ ElementLink() [26/26]

template<class STORABLE >
ElementLink< STORABLE >::ElementLink ( const ElementLink< STORABLE > &  parent)

Copy-constructor.

Member Function Documentation

◆ cachedElement() [1/2]

template<class STORABLE >
ElementType ElementLink< STORABLE >::cachedElement ( ) const
inline

Access the currently cached element. Doesn't trigger lookup.

Definition at line 178 of file A/AthLinks/ElementLink.h.

178 { return m_element; }

◆ cachedElement() [2/2]

template<class STORABLE >
ElementType ElementLink< STORABLE >::cachedElement ( ) const

Return the cached element, if any.

◆ classID()

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

Return the CLID for the class that we reference.

◆ cptr() [1/2]

template<class STORABLE >
ElementConstPointer ElementLink< STORABLE >::cptr ( ) const

Get a constant pointer to the referenced object.

◆ cptr() [2/2]

template<class STORABLE >
ElementConstPointer ElementLink< STORABLE >::cptr ( ) const

Return a pointer to the referenced element.

Be aware: if the element is a pointer, then this will yield a pointer to a pointer.

◆ dataID()

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

Get the key that we reference, as a string.

◆ findIdentifier()

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

Find the identifier of the object being pointed to.

◆ findIndex()

template<class STORABLE >
void ElementLink< STORABLE >::findIndex ( )
private

Find the index of an element inside the container.

◆ getCachedElement()

template<class INDEXING_POLICY >
bool SG::GenericElementLinkBase< INDEXING_POLICY >::getCachedElement ( ElementConstPointer elt) const
protectedinherited

Retrieve the cached element from the link.

Parameters
elt[out]The cached element.
Returns
True if an element was cached; false otherwise.

elt is left unmodified if there is no cached element.

◆ getDataLink() [1/2]

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

Return a link to the currently-referenced container object.

◆ getDataLink() [2/2]

template<class STORABLE >
const DataLink<STORABLE> ElementLink< STORABLE >::getDataLink ( ) const

Return a link to the currently-referenced container object.

◆ getDataNonConstPtr()

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

Return a pointer to the currently-referenced container 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 ElementLink< STORABLE >::getDataPtr ( ) const

Return a pointer to the currently-referenced container object.

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

◆ getStorableObjectPointer() [1/2]

template<class STORABLE >
BaseConstPointer ElementLink< STORABLE >::getStorableObjectPointer ( ) const

Retrieve storable object pointer.

◆ getStorableObjectPointer() [2/2]

template<class STORABLE >
BaseConstPointer ElementLink< STORABLE >::getStorableObjectPointer ( ) const

Return a pointer to the currently-referenced container object.

◆ getStorableObjectRef() [1/2]

template<class STORABLE >
BaseConstReference ElementLink< STORABLE >::getStorableObjectRef ( ) const

Retrieve storable object reference.

◆ getStorableObjectRef() [2/2]

template<class STORABLE >
BaseConstReference ElementLink< STORABLE >::getStorableObjectRef ( ) const

Return a reference to the currently-referenced container object.

◆ hasCachedElement()

template<class STORABLE >
bool ElementLink< STORABLE >::hasCachedElement ( ) const
inline

Check if the link has a cached element pointer.

Definition at line 180 of file A/AthLinks/ElementLink.h.

180 { return m_elementCached; }

◆ index()

template<class STORABLE >
index_type ElementLink< STORABLE >::index ( ) const
inline

Get the index of the element inside of its container.

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

150 { return persIndex(); }

◆ isDefault()

template<class INDEXING_POLICY >
bool SG::GenericElementLinkBase< INDEXING_POLICY >::isDefault ( ) const
inherited

Test to see if this link is in the default state.

◆ isDefaultIndex()

template<class INDEXING_POLICY >
bool SG::GenericElementLinkBase< INDEXING_POLICY >::isDefaultIndex ( ) const
inherited

Test the index validity.

Returns
True if the index is not valid (in default state).

◆ isValid() [1/2]

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

Check if the element can be found.

◆ isValid() [2/2]

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

Test to see if the link can be dereferenced.

Will throw an exception if the container is not empty and the referenced element cannot be retrieved.

◆ key()

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

Get the key that we reference, as a hash.

Definition at line 155 of file A/AthLinks/ElementLink.h.

155 { return persKey(); }

◆ operator ElementConstPointer() [1/2]

template<class STORABLE >
ElementLink< STORABLE >::operator ElementConstPointer ( ) const
inline

Auto-convert to the element type.

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

168 { return cptr(); }

◆ operator ElementConstPointer() [2/2]

template<class STORABLE >
ElementLink< STORABLE >::operator ElementConstPointer ( ) const

Convert to a pointer to the referenced element.

◆ operator!() [1/2]

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

Operator checking the validity of the link.

Definition at line 175 of file A/AthLinks/ElementLink.h.

175 { return ! isValid(); }

◆ operator!() [2/2]

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

Test to see if the link can not be dereferenced.

◆ operator!=()

template<class STORABLE >
bool ElementLink< STORABLE >::operator!= ( const ElementLink< STORABLE > &  rhs) const

Comparison operator.

◆ operator*() [1/2]

template<class STORABLE >
ElementConstReference ElementLink< STORABLE >::operator* ( ) const

Get a reference to the object in question.

◆ operator*() [2/2]

template<class STORABLE >
ElementConstReference ElementLink< STORABLE >::operator* ( ) const

Return a reference to the referenced element.

Will throw an exception if the link is not valid.

◆ operator->() [1/2]

template<class STORABLE >
ElementConstPointer ElementLink< STORABLE >::operator-> ( ) const
inline

Access the object as a smart pointer.

Definition at line 166 of file A/AthLinks/ElementLink.h.

166 { return cptr(); }

◆ operator->() [2/2]

template<class STORABLE >
ElementConstPointer ElementLink< STORABLE >::operator-> ( ) const

Return a pointer to the referenced element.

◆ operator=() [1/2]

template<class STORABLE >
ElementLink& ElementLink< STORABLE >::operator= ( const ElementLink< STORABLE > &  )
default

◆ operator=() [2/2]

template<class STORABLE >
ElementLink& ElementLink< STORABLE >::operator= ( const ElementLink< STORABLE > &  rhs)

Assignment operator.

◆ operator==()

template<class STORABLE >
bool ElementLink< STORABLE >::operator== ( const ElementLink< STORABLE > &  rhs) const

Comparison operator.

◆ proxy()

template<class INDEXING_POLICY >
const SG::DataProxy* SG::GenericElementLinkBase< INDEXING_POLICY >::proxy ( ) const
inherited

Return the SG proxy for the container holding this element.

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.

◆ proxyHolder()

template<class INDEXING_POLICY >
const SG::DataProxyHolder& SG::GenericElementLinkBase< INDEXING_POLICY >::proxyHolder ( ) const
protectedinherited

Return the internal proxy holder object.

◆ requires() [1/2]

template<class INDEXING_POLICY >
template<class INDEX >
SG::GenericElementLinkBase< INDEXING_POLICY >::requires ( std::convertible_to< INDEX, size_t > && std::convertible_to< size_t, INDEX >) &
privateinherited

Adjust for thinning.

If this link points to a container that has been thinned, it will be adjusted accordingly.

Parameters
Indexof the element.
thinningCacheThinning cache for the current stream (may be null).

Returns true if the link was changed; false otherwise.

This overload will be used for the case where thinning is not supported.

◆ requires() [2/2]

template<class INDEXING_POLICY >
template<class INDEX >
SG::GenericElementLinkBase< INDEXING_POLICY >::requires ( std::convertible_to< INDEX, size_t > &&std::convertible_to< size_t, INDEX >  ) &
privateinherited

Adjust for thinning.

If this link points to a container that has been thinned, it will be adjusted accordingly.

Parameters
Indexof the element.
thinningCacheThinning cache for the current stream (may be null).

Returns true if the link was changed; false otherwise.

This overload will be used for the case where thinning is supported: the index can be interconverted with size_t.

◆ reset()

template<class STORABLE >
void ElementLink< STORABLE >::reset ( )

Reset to default state.

◆ resetWithKeyAndIndex() [1/8]

template<class INDEXING_POLICY >
void SG::GenericElementLinkBase< INDEXING_POLICY >::resetWithKeyAndIndex ( const ID_type dataID,
CLID  link_clid,
const index_type elemID,
IProxyDict sg 
)
protectedinherited

Set the link to an element given by string key and index.

Parameters
dataIDKey of the object.
link_clidCLID of the link being set.
elemIDThe index of the element within the container.
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.

◆ resetWithKeyAndIndex() [2/8]

template<class STORABLE >
void ElementLink< STORABLE >::resetWithKeyAndIndex ( const ID_type dataID,
index_type  elemID,
const EventContext &  ctx 
)

Set the link to an element given by string key and index.

Parameters
dataIDKey of the object.
elemIDThe index of the element within the container.
ctxThe event context.

◆ resetWithKeyAndIndex() [3/8]

template<class STORABLE >
void ElementLink< STORABLE >::resetWithKeyAndIndex ( const ID_type dataID,
index_type  elemID,
IProxyDict sg = 0 
)

Set the link to an element given by string key and index.

Parameters
dataIDKey of the object.
elemIDThe index of the element within the container.
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.

◆ resetWithKeyAndIndex() [4/8]

template<class STORABLE >
void ElementLink< STORABLE >::resetWithKeyAndIndex ( const ID_type key,
index_type  index,
xAOD::TVirtualEvent event = 0 
)

Reset with storable key and element index (fast)

◆ resetWithKeyAndIndex() [5/8]

template<class STORABLE >
void ElementLink< STORABLE >::resetWithKeyAndIndex ( sgkey_t  id,
index_type  index,
xAOD::TVirtualEvent event = 0 
)

Reset with storable id and element index (fastest)

◆ resetWithKeyAndIndex() [6/8]

template<class INDEXING_POLICY >
void SG::GenericElementLinkBase< INDEXING_POLICY >::resetWithKeyAndIndex ( sgkey_t  key,
CLID  link_clid,
const index_type elemID,
IProxyDict sg 
)
protectedinherited

Set the link to an element given by string key and index.

Parameters
keyHashed key of the object.
link_clidCLID of the link being set.
elemIDThe index of the element within the container.
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.

◆ resetWithKeyAndIndex() [7/8]

template<class STORABLE >
void ElementLink< STORABLE >::resetWithKeyAndIndex ( sgkey_t  key,
index_type  elemID,
const EventContext &  ctx 
)

Set the link to an element given by string key and index.

Parameters
keyHashed key of the object.
elemIDThe index of the element within the container.
ctxThe event context.

◆ resetWithKeyAndIndex() [8/8]

template<class STORABLE >
void ElementLink< STORABLE >::resetWithKeyAndIndex ( sgkey_t  key,
index_type  elemID,
IProxyDict sg = 0 
)

Set the link to an element given by string key and index.

Parameters
keyHashed key of the object.
elemIDThe index of the element within the container.
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.

◆ setCachedElement()

template<class INDEXING_POLICY >
void SG::GenericElementLinkBase< INDEXING_POLICY >::setCachedElement ( const ElementType elt) const
protectedinherited

Set the cached element stored in the link.

Parameters
eltNew value for the cached element.

◆ setElement() [1/2]

template<class STORABLE >
bool ElementLink< STORABLE >::setElement ( ElementType  element)

Set link to point to an Element (slowest)

◆ setElement() [2/2]

template<class STORABLE >
bool ElementLink< STORABLE >::setElement ( ElementType  element)

Set to point to an element.

Parameters
elementThe element.
Returns
True if the link was changed.

The collection and the element can be specified independently using setElement and setStorableObject.

If the link is already set, this will return false and leave the link unchanged.

◆ setIndex()

template<class INDEXING_POLICY >
void SG::GenericElementLinkBase< INDEXING_POLICY >::setIndex ( const index_type index)
protectedinherited

Set the index part of the link.

Parameters
indexNew index value.

◆ setStorableObject() [1/4]

template<class STORABLE >
bool ElementLink< STORABLE >::setStorableObject ( BaseConstReference  data,
bool  replace,
const EventContext &  ctx 
)

Set link to point to a new container (storable).

Parameters
dataReference to the container (storable).
replaceTrue if we can change an existing link.
ctxThe event context.
Returns
True if the link was changed.

If the link is already set, this will return false and leave the link unchanged unless replace is set. The replace argument should be set if the element is now in a new storable container; e.g. element ptr has been put in a new view container.

◆ setStorableObject() [2/4]

template<class STORABLE >
bool ElementLink< STORABLE >::setStorableObject ( BaseConstReference  data,
bool  replace = false 
)

Set link storable to data object pointed by data (slower)

◆ setStorableObject() [3/4]

template<class STORABLE >
bool ElementLink< STORABLE >::setStorableObject ( BaseConstReference  data,
bool  replace = false,
IProxyDict sg = 0 
)

Set link to point to a new container (storable).

Parameters
dataReference to the container (storable).
replaceTrue if we can change an existing link.
sgAssociated store.
Returns
True if the link was changed.

If the link is already set, this will return false and leave the link unchanged unless replace is set. The replace argument should be set if the element is now in a new storable container; e.g. element ptr has been put in a new view container.

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.

◆ setStorableObject() [4/4]

template<class INDEXING_POLICY >
bool SG::GenericElementLinkBase< INDEXING_POLICY >::setStorableObject ( const_pointer_t  data,
CLID  link_clid,
bool  replace,
IProxyDict sg 
)
protectedinherited

Set the container referenced by the link to data.

Parameters
dataPointer to the new container.
link_clidCLID of the link being set.
replaceTrue if we can change an existing link.
sgAssociated store.
Returns
True if the link was changed.

If the link is already set, this will return false and leave the link unchanged unless replace is set. The replace argument should be set if the element is now in a new storable container; e.g. element ptr has been put in a new view container.

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.

◆ source()

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

Get the data source for the reference.

Definition at line 185 of file A/AthLinks/ElementLink.h.

185 { return m_event; }

◆ storable()

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

Return a (void) pointer to the currently-referenced container 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()

template<class INDEXING_POLICY >
void* SG::GenericElementLinkBase< INDEXING_POLICY >::storableBase ( castfn_t castfn,
const CLID clid,
bool  isConst 
) const
protectedinherited

Return a pointer to the currently-referenced container 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* ElementLink< STORABLE >::storableNonConst ( )
private

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

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

◆ storeCachedElement()

template<class INDEXING_POLICY >
void SG::GenericElementLinkBase< INDEXING_POLICY >::storeCachedElement ( const ElementType elt)
protectedinherited

Set the cached element stored in the link.

Parameters
eltNew value for the cached element.

◆ storedIndex()

template<class INDEXING_POLICY >
const stored_index_type& SG::GenericElementLinkBase< INDEXING_POLICY >::storedIndex ( ) const
protectedinherited

Return the stored representation of the link index.

◆ thin() [1/2]

template<class INDEXING_POLICY >
bool SG::GenericElementLinkBase< INDEXING_POLICY >::thin ( )
inherited

Adjust for thinning.

If this link points to a container that has been thinned, it will be adjusted accordingly.

Returns true if the link was changed; false otherwise.

◆ thin() [2/2]

template<class INDEXING_POLICY >
bool SG::GenericElementLinkBase< INDEXING_POLICY >::thin ( const SG::ThinningCache thinningCache)
inherited

Adjust for thinning.

If this link points to a container that has been thinned, it will be adjusted accordingly.

Parameters
thinningCacheThinning cache for the current stream (may be null).

Returns true if the link was changed; false otherwise.

◆ toContainedElement() [1/3]

template<class STORABLE >
bool ElementLink< STORABLE >::toContainedElement ( BaseConstReference  container,
ElementType  element 
)

Set link to point to given element (slowest)

◆ toContainedElement() [2/3]

template<class STORABLE >
bool ElementLink< STORABLE >::toContainedElement ( BaseConstReference  data,
ElementType  element,
const EventContext &  ctx 
)

Set from element pointer and a reference to the container (storable)

Parameters
dataReference to the container (storable).
elementThe element.
ctxThe event context.
Returns
True if the link was changed.

O(N) for sequences!

If the link is already set, this will return false and leave the link unchanged.

◆ toContainedElement() [3/3]

template<class STORABLE >
bool ElementLink< STORABLE >::toContainedElement ( BaseConstReference  data,
ElementType  element,
IProxyDict sg = 0 
)

Set from element pointer and a reference to the container (storable)

Parameters
dataReference to the container (storable).
elementThe element.
sgAssociated store.
Returns
True if the link was changed.

O(N) for sequences!

If the link is already set, this will return false and leave the link unchanged.

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.

◆ toIndexedElement() [1/4]

template<class STORABLE >
bool ElementLink< STORABLE >::toIndexedElement ( BaseConstReference  container,
index_type  index 
)

Set link to point to given index (slower)

◆ toIndexedElement() [2/4]

template<class STORABLE >
bool ElementLink< STORABLE >::toIndexedElement ( BaseConstReference  data,
index_type  elemID,
const EventContext &  ctx 
)

Set the link to an element given by index and pointer to container.

Parameters
dataReference to the container (storable).
elemIDThe index of the element within the container.
ctxThe event context.
Returns
True if the link was changed.

If the link is already set, this will return false and leave the link unchanged.

◆ toIndexedElement() [3/4]

template<class STORABLE >
bool ElementLink< STORABLE >::toIndexedElement ( BaseConstReference  data,
index_type  elemID,
IProxyDict sg = 0 
)

Set the link to an element given by index and pointer to container.

Parameters
dataReference to the container (storable).
elemIDThe index of the element within the container.
sgAssociated store.
Returns
True if the link was changed.

If the link is already set, this will return false and leave the link unchanged.

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.

◆ toIndexedElement() [4/4]

template<class INDEXING_POLICY >
bool SG::GenericElementLinkBase< INDEXING_POLICY >::toIndexedElement ( const_pointer_t  obj,
CLID  link_clid,
const index_type elemID,
IProxyDict sg 
)
protectedinherited

Set the to an element given by index and pointer to container.

Parameters
objPointer to the container (storable).
link_clidCLID of the link being set.
elemIDThe index of the element within the container.
sgAssociated store.
Returns
True if the link was changed.

If the link is already set, this will return false and leave the link unchanged.

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.

◆ toPersistent()

template<class STORABLE >
bool ElementLink< STORABLE >::toPersistent ( )
inline

Dummy function provinding the offline interface.

Definition at line 188 of file A/AthLinks/ElementLink.h.

188 { return true; }

◆ toTransient() [1/2]

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

Reset the object's internal cache.

◆ toTransient() [2/2]

template<class INDEXING_POLICY >
bool SG::GenericElementLinkBase< INDEXING_POLICY >::toTransient ( IProxyDict sg = 0)
inherited

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_cacheValid

template<class INDEXING_POLICY >
ROOT_SELECTION_NS::TRANSIENT SG::GenericElementLinkBase< INDEXING_POLICY >::m_cacheValid
inherited

Definition at line 563 of file GenericElementLinkBase.h.

◆ m_container [1/2]

template<class STORABLE >
BaseConstPointer ElementLink< STORABLE >::m_container
mutableprivate

Cached pointer to the container.

Definition at line 199 of file A/AthLinks/ElementLink.h.

◆ m_container [2/2]

template<class STORABLE >
ROOT_SELECTION_NS::MemberAttributes< kTransient > ElementLink< STORABLE >::m_container

Mark all transient members:

Definition at line 235 of file A/AthLinks/ElementLink.h.

◆ m_element [1/2]

template<class STORABLE >
ElementType ElementLink< STORABLE >::m_element
mutableprivate

Cached pointer to the object.

Definition at line 201 of file A/AthLinks/ElementLink.h.

◆ m_element [2/2]

template<class STORABLE >
ROOT_SELECTION_NS::MemberAttributes< kTransient > ElementLink< STORABLE >::m_element

Definition at line 236 of file A/AthLinks/ElementLink.h.

◆ m_elementCached [1/2]

template<class STORABLE >
bool ElementLink< STORABLE >::m_elementCached
mutableprivate

Status of the cached pointer.

Definition at line 203 of file A/AthLinks/ElementLink.h.

◆ m_elementCached [2/2]

template<class STORABLE >
ROOT_SELECTION_NS::MemberAttributes< kTransient > ElementLink< STORABLE >::m_elementCached

Definition at line 237 of file A/AthLinks/ElementLink.h.

◆ m_event [1/2]

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

Pointer to the event object.

Definition at line 205 of file A/AthLinks/ElementLink.h.

◆ m_event [2/2]

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

Definition at line 238 of file A/AthLinks/ElementLink.h.

◆ m_index

template<class INDEXING_POLICY >
stored_index_type SG::GenericElementLinkBase< INDEXING_POLICY >::m_index
privateinherited

The index of the element within the container for this link.

Definition at line 538 of file GenericElementLinkBase.h.

◆ m_key

template<class INDEXING_POLICY >
SG::sgkey_t SG::GenericElementLinkBase< INDEXING_POLICY >::m_key
privateinherited

The hashed key for this link.

Definition at line 535 of file GenericElementLinkBase.h.

◆ m_proxy [1/2]

template<class INDEXING_POLICY >
SG::DataProxyHolder SG::GenericElementLinkBase< INDEXING_POLICY >::m_proxy
privateinherited

SG proxy for this link.

Definition at line 541 of file GenericElementLinkBase.h.

◆ m_proxy [2/2]

template<class INDEXING_POLICY >
ROOT_SELECTION_NS::TRANSIENT SG::GenericElementLinkBase< INDEXING_POLICY >::m_proxy
inherited

Definition at line 562 of file GenericElementLinkBase.h.

◆ thinningCache

template<class INDEXING_POLICY >
const SG::ThinningCache * SG::GenericElementLinkBase< INDEXING_POLICY >::thinningCache
privateinherited

Definition at line 505 of file GenericElementLinkBase.h.


The documentation for this class was generated from the following file:
ELEMENTLINK_FWD
#define ELEMENTLINK_FWD(TYPE, VALUE_TYPE)
Forward declaration helper for ElementLink.
Definition: ElementLinkTraits.h:215