14#ifndef ATHLINKS_ELEMENTLINKBASE_H
15#define ATHLINKS_ELEMENTLINKBASE_H
20#include "AthLinks/DataLinkBase.h"
62 static const uint32_t
INVALID =
static_cast<uint32_t
> (-1);
347 template <
class FROM_TRAITS,
class TO_TRAITS>
349 FROM_TRAITS*, TO_TRAITS*);
Cached pointer with atomic update.
Manage DataProxy reference in ElementLink/DataLink.
uint32_t CLID
The Class ID type.
Indexing policy for a vector-like container.
char data[hepevt_bytes_allocation_ATLAS]
Type-independent part of DataLink; holds the persistent state.
ElementLinkBase(sgkey_t key, CLID link_clid, index_type elemID, const void *elt, IProxyDict *sg)
Construct a link from a hashed key, index, AND pointer to element.
bool isDefault() const
Test to see if this link is in the default state.
friend class ElementLinkBase_test
For regression testing.
ElementLinkBase(const ElementLinkBase &other, index_type elemID)
Construct a link from another link, changing the index.
bool toIndexedElement(const_pointer_t obj, CLID link_clid, index_type elemID, IProxyDict *sg)
Set the link to an element given by index and pointer to container.
const SG::DataProxy * proxy() const
Return the SG proxy for the container holding this element.
bool isDefaultIndex() const
Test the index validity.
void clearCachedElement()
Clear the currently-cached element.
ElementLinkBase(const_pointer_t obj, CLID link_clid, index_type elemID, IProxyDict *sg)
Construct a link from an index and pointer to the container.
ElementLinkBase & operator=(const ElementLinkBase &)=default
SG::DataProxyHolder::sgkey_t sgkey_t
Type of hashed keys.
void resetWithKeyAndIndex(const ID_type &dataID, CLID link_clid, index_type elemID, IProxyDict *sg)
Set the link to an element given by string key and index.
void * storableBase(castfn_t *castfn, CLID clid, bool isConst) const
Return a pointer to the currently-referenced container object.
const void * ElementType
Generic pointer to an element.
CxxUtils::CachedPointer< void > m_element
Transient.
bool thin()
Adjust for thinning.
stored_index_type persIndex() const
Return the index of the link.
sgkey_t key() const
Return the SG key that we reference, as a hash.
ElementLinkBase(const ElementLinkBase &other, FROM_TRAITS *, TO_TRAITS *)
Constructor from a link referencing a different type.
ElementLinkBase(const ID_type &dataID, CLID link_clid, index_type elemID, IProxyDict *sg)
Construct a link from a string key and an index.
stored_index_type m_persIndex
The index of the element within the container for this link.
bool toPersistent()
Prepare this link for writing.
void setCachedElement(ElementType elt) const
Set the cached element stored in the link, assuming the cached element is null.
void setIndex(index_type index)
Set the index part of the link.
SG::DataProxyHolder::ID_type ID_type
Type of string keys.
SG::DataProxyHolder m_proxy
SG proxy for this link.
uint32_t stored_index_type
The type of the index as it is stored internally.
sgkey_t persKey() const
Return the SG key that we reference, as a hash.
ElementLinkBase(sgkey_t key, CLID link_clid, index_type elemID, IProxyDict *sg)
Construct a link from a hashed key and an index.
ElementLinkBase(const ID_type &dataID, CLID link_clid, index_type elemID, const void *elt, IProxyDict *sg)
Construct a link from a string key, index, AND pointer to element.
size_t index_type
The index type presented to and returned from the link.
ElementLinkBase()
Default constructor.
static const uint32_t INVALID
Value to mark an invalid index.
IProxyDict * source() const
Return the data source for this reference.
void * castfn_t(SG::DataProxy *)
Function casting from a SG::DataProxy to a pointer.
const ID_type & dataID() const
Return the SG key that we reference, as a string.
index_type index() const
Return the index of the link.
bool getCachedElement(const T *&elt) const
Retrieve the cached element from the link.
bool thin(const SG::ThinningCache *thinningCache)
Adjust for thinning.
const stored_index_type & storedIndex() const
Return the stored representation of the link index.
SG::sgkey_t m_persKey
The hashed key for this link.
void resetWithKeyAndIndex(sgkey_t key, CLID link_clid, index_type elemID, IProxyDict *sg)
Set the link to an element given by string key and index.
const SG::DataProxyHolder & proxyHolder() const
Return the internal proxy holder object.
ElementLinkBase(const DataLinkBase &dlink, index_type index)
Construct a link from a DataLink and an index.
void reset()
Reset the link to a null state.
bool setStorableObject(const_pointer_t data, CLID link_clid, bool replace, IProxyDict *sg)
Set the container referenced by the link to data.
bool hasCachedElement() const
Test to see if this link has a cached element pointer.
void storeCachedElement(ElementType elt)
Set the cached element stored in the link.
SG::DataProxyHolder::const_pointer_t const_pointer_t
Generic pointer to the container (storable).
ElementLinkBase(const ElementLinkBase &)=default
bool toTransient(IProxyDict *sg=0)
Finish initialization after link has been read.
Manage DataProxy reference in ElementLink/DataLink.
SG::sgkey_t sgkey_t
Type of hashed keys.
std::string ID_type
Type of string keys.
const void * const_pointer_t
Cache thinning decisions for converters.
Helpers to retrieve the current thinning cache from the event context.
std::string replace(std::string s, const std::string &s2, const std::string &s3)
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Cached pointer with atomic update.