ATLAS Offline Software
Public Types | Public Member Functions | List of all members
IProxyDict Class Referenceabstract

A proxy dictionary. More...

#include <IProxyDict.h>

Inheritance diagram for IProxyDict:
Collaboration diagram for IProxyDict:

Public Types

typedef SG::sgkey_t sgkey_t
 Type of the keys. More...
 

Public Member Functions

 DeclareInterfaceID (IProxyDict, 2, 0)
 
virtual ~IProxyDict () override
 
virtual SG::DataProxyproxy_exact (SG::sgkey_t sgkey) const =0
 Get proxy given a hashed key+clid. More...
 
virtual SG::DataProxyproxy (const CLID &id, const std::string &key) const =0
 Get proxy with given id and key. More...
 
virtual SG::DataProxyproxy (const void *const pTransient) const =0
 Get a proxy referencing a given transient object. More...
 
virtual std::vector< const SG::DataProxy * > proxies () const =0
 Return the list of all current proxies in store. More...
 
virtual StatusCode addToStore (CLID id, SG::DataProxy *proxy)=0
 Add a new proxy to the store. More...
 
virtual SG::DataProxyrecordObject (SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting)=0
 Record an object in the store. More...
 
virtual void boundHandle (IResetable *handle)
 Tell the store that a handle has been bound to a proxy. More...
 
virtual void unboundHandle (IResetable *handle)
 Tell the store that a handle has been unbound from a proxy. More...
 
virtual bool tryELRemap (sgkey_t sgkey_in, size_t index_in, sgkey_t &sgkey_out, size_t &index_out)
 Test to see if the target of an ElementLink has moved. More...
 
virtual StatusCode createObj (IConverter *cvt, IOpaqueAddress *addr, DataObject *&refpObject)
 Call converter to create an object, possibly with locking. More...
 
virtual IProxyDicthiveProxyDict () override
 Return the current event-slot-specific store. More...
 
virtual SG::SourceID sourceID (const std::string &key="EventSelector") const
 Return the metadata source ID for the current event slot. More...
 
virtual sgkey_t stringToKey (const std::string &str, CLID clid)=0
 Find the key for a string/CLID pair. More...
 
virtual const std::string * keyToString (sgkey_t key) const =0
 Find the string corresponding to a given key. More...
 
virtual const std::string * keyToString (sgkey_t key, CLID &clid) const =0
 Find the string and CLID corresponding to a given key. More...
 
virtual void registerKey (sgkey_t key, const std::string &str, CLID clid)=0
 Remember an additional mapping from key to string/CLID. More...
 

Detailed Description

A proxy dictionary.

This is the internal interface used by StoreGateSvc and similar. It provides interfaces for taking a set of DataProxy objects and looking them up by either CLID+key or by a pointer to the transient objects.

Objects can be identified by either a CLID+key pair or by a hash of this data. This interface also provides methods for converting between the two representations.

Author
Paolo Calafiura - ATLAS

Definition at line 45 of file AthenaKernel/AthenaKernel/IProxyDict.h.

Member Typedef Documentation

◆ sgkey_t

typedef SG::sgkey_t IStringPool::sgkey_t
inherited

Type of the keys.

Definition at line 34 of file IStringPool.h.

Constructor & Destructor Documentation

◆ ~IProxyDict()

virtual IProxyDict::~IProxyDict ( )
inlineoverridevirtual

Definition at line 50 of file AthenaKernel/AthenaKernel/IProxyDict.h.

50 {}

Member Function Documentation

◆ addToStore()

virtual StatusCode IProxyDict::addToStore ( CLID  id,
SG::DataProxy proxy 
)
pure virtual

Add a new proxy to the store.

Parameters
idCLID as which the proxy should be added.
proxyThe proxy to add.

Simple addition of a proxy to the store. The key is taken as the primary key of the proxy. Does not handle things like overwrite, history, symlinks, etc. Should return failure if there is already an entry for this clid/key.

Implemented in StoreGateSvc, SGImplSvc, and ActiveStoreSvc.

◆ boundHandle()

void IProxyDict::boundHandle ( IResetable handle)
virtual

Tell the store that a handle has been bound to a proxy.

Parameters
handleThe handle that was bound. The default implementation does nothing.

Reimplemented in SGImplSvc.

Definition at line 23 of file IProxyDict.cxx.

24 {
25 }

◆ createObj()

StatusCode IProxyDict::createObj ( IConverter *  cvt,
IOpaqueAddress *  addr,
DataObject *&  refpObject 
)
virtual

Call converter to create an object, possibly with locking.

Parameters
cvtThe converter to call.
addrOpaque address information for the object to create.
refpObjectReference to location of the pointer of the created object.

This calls the createObj method on cvt to create the referenced transient object.

This will also lock the store, if that is required.

The default implementation just forwards the method call, with no locking.

Reimplemented in StoreGateSvc, and SGImplSvc.

Definition at line 70 of file IProxyDict.cxx.

73 {
74  return cvt->createObj (addr, refpObject);
75 }

◆ DeclareInterfaceID()

IProxyDict::DeclareInterfaceID ( IProxyDict  ,
,
 
)

◆ hiveProxyDict()

IProxyDict * IProxyDict::hiveProxyDict ( )
overridevirtual

Return the current event-slot-specific store.

The default version just returns this.

Reimplemented in StoreGateSvc, and SGImplSvc.

Definition at line 83 of file IProxyDict.cxx.

84 {
85  return this;
86 }

◆ keyToString() [1/2]

virtual const std::string* IStringPool::keyToString ( sgkey_t  key) const
pure virtualinherited

Find the string corresponding to a given key.

Parameters
keyThe key to look up.
Returns
Pointer to the string found, or null. We can find keys as long as the corresponding string was given to either stringToKey() or registerKey().

Implemented in StoreGateSvc, SGImplSvc, and ActiveStoreSvc.

◆ keyToString() [2/2]

virtual const std::string* IStringPool::keyToString ( sgkey_t  key,
CLID clid 
) const
pure virtualinherited

Find the string and CLID corresponding to a given key.

Parameters
keyThe key to look up.
clid[out]The found CLID.
Returns
Pointer to the string found, or null. We can find keys as long as the corresponding string was given to either stringToKey() or registerKey().

Implemented in StoreGateSvc, SGImplSvc, and ActiveStoreSvc.

◆ proxies()

virtual std::vector<const SG::DataProxy*> IProxyDict::proxies ( ) const
pure virtual

Return the list of all current proxies in store.

Implemented in StoreGateSvc, SGImplSvc, and ActiveStoreSvc.

◆ proxy() [1/2]

virtual SG::DataProxy* IProxyDict::proxy ( const CLID id,
const std::string &  key 
) const
pure virtual

Get proxy with given id and key.

Parameters
idThe CLID of the desired object.
keyThe key of the desired object.

If the key is a null string, then it is a default key. Finding a proxy via the default key should succeed only if there is exactly one object with the given CLID in the store. Finding a proxy via a default key is considered deprecated for the case of the event store.

Returns 0 to flag failure

Implemented in StoreGateSvc, SGImplSvc, and ActiveStoreSvc.

◆ proxy() [2/2]

virtual SG::DataProxy* IProxyDict::proxy ( const void *const  pTransient) const
pure virtual

Get a proxy referencing a given transient object.

Parameters
pTransientThe object to find.

Returns 0 to flag failure

Implemented in StoreGateSvc, SGImplSvc, and ActiveStoreSvc.

◆ proxy_exact()

virtual SG::DataProxy* IProxyDict::proxy_exact ( SG::sgkey_t  sgkey) const
pure virtual

Get proxy given a hashed key+clid.

Parameters
sgkeyHashed key to look up.

Find an exact match; no handling of aliases, etc. Returns 0 to flag failure.

Implemented in StoreGateSvc, SGImplSvc, and ActiveStoreSvc.

◆ recordObject()

virtual SG::DataProxy* IProxyDict::recordObject ( SG::DataObjectSharedPtr< DataObject >  obj,
const std::string &  key,
bool  allowMods,
bool  returnExisting 
)
pure virtual

Record an object in the store.

Parameters
objThe data object to store.
keyThe key as which it should be stored.
allowModsIf false, the object will be recorded as const.
returnExistingIf true, return proxy if this key already exists. If the object has been recorded under a different key, then make an alias. If the object has been recorded under a different clid, then make a link.

Full-blown record. obj should usually be something deriving from SG::DataBucket.

Returns the proxy for the recorded object; nullptr on failure. If the requested CLID/key combination already exists in the store, the behavior is controlled by returnExisting. If true, then the existing proxy is returned; otherwise, nullptr is returned. In either case, obj is destroyed.

Implemented in StoreGateSvc, SGImplSvc, and ActiveStoreSvc.

◆ registerKey()

virtual void IStringPool::registerKey ( sgkey_t  key,
const std::string &  str,
CLID  clid 
)
pure virtualinherited

Remember an additional mapping from key to string/CLID.

Parameters
keyThe key to enter.
strThe string to enter.
clidThe CLID associated with the string.
Returns
True if successful; false if the key already corresponds to a different string.

This registers an additional mapping from a key to a string; it can be found later through lookup() on the string. Logs an error if key already corresponds to a different string.

Implemented in StoreGateSvc, SGImplSvc, and ActiveStoreSvc.

◆ sourceID()

SG::SourceID IProxyDict::sourceID ( const std::string &  key = "EventSelector") const
virtual

Return the metadata source ID for the current event slot.

Parameters
keySG key of the DataHeader to query. Returns an empty string if no source has been set.

The default version always returns an empty string.

Reimplemented in StoreGateSvc, and SGImplSvc.

Definition at line 97 of file IProxyDict.cxx.

98 {
99  return SG::SourceID();
100 }

◆ stringToKey()

virtual sgkey_t IStringPool::stringToKey ( const std::string &  str,
CLID  clid 
)
pure virtualinherited

Find the key for a string/CLID pair.

Parameters
strThe string to look up.
clidThe CLID associated with the string.
Returns
A key identifying the string. A given string will always return the same key. Will abort in case of a hash collision!

Implemented in StoreGateSvc, SGImplSvc, and ActiveStoreSvc.

◆ tryELRemap()

bool IProxyDict::tryELRemap ( sgkey_t  sgkey_in,
size_t  index_in,
sgkey_t sgkey_out,
size_t &  index_out 
)
virtual

Test to see if the target of an ElementLink has moved.

Parameters
sgkey_inOriginal hashed key of the EL.
index_inOriginal index of the EL.
sgkey_out[out]New hashed key for the EL.
index_out[out]New index for the EL.
Returns
True if there is a remapping; false otherwise.

The default implementation here always returns false.

Reimplemented in StoreGateSvc, and SGImplSvc.

Definition at line 48 of file IProxyDict.cxx.

50 {
51  return false;
52 }

◆ unboundHandle()

void IProxyDict::unboundHandle ( IResetable handle)
virtual

Tell the store that a handle has been unbound from a proxy.

Parameters
handleThe handle that was unbound. The default implementation does nothing.

Reimplemented in SGImplSvc.

Definition at line 33 of file IProxyDict.cxx.

34 {
35 }

The documentation for this class was generated from the following files:
SG::SourceID
std::string SourceID
Definition: AthenaKernel/AthenaKernel/SourceID.h:23