![]() |
ATLAS Offline Software
|
#include <TestStore.h>
Public Types | |
typedef std::unordered_map< const void *, SG::DataProxy * > | tmap_t |
typedef SG::SGKeyMap< SG::DataProxy * > | kmap_t |
typedef std::unordered_map< TestStoreRemap, TestStoreRemap, TestStoreRemapHash > | remap_t |
typedef std::mutex | mutex_t |
typedef std::lock_guard< mutex_t > | lock_t |
typedef SG::sgkey_t | sgkey_t |
Type of the keys. More... | |
Public Member Functions | |
virtual unsigned long | addRef () override |
virtual unsigned long | release () override |
virtual StatusCode | queryInterface (const InterfaceID &, void **) override |
virtual std::vector< const SG::DataProxy * > | proxies () const override |
Return the list of all current proxies in store. More... | |
virtual const std::string * | keyToString (sgkey_t) const override |
Find the string corresponding to a given key. More... | |
virtual void | registerKey (sgkey_t, const std::string &, CLID) override |
Remember an additional mapping from key to string/CLID. More... | |
virtual const std::string & | name () const override |
virtual SG::DataProxy * | proxy (const void *const pTransient) const override |
Get a proxy referencing a given transient object. More... | |
virtual SG::DataProxy * | proxy (const CLID &id, const std::string &key) const override |
Get proxy with given id and key. More... | |
virtual SG::DataProxy * | proxy_exact (SG::sgkey_t sgkey) const override |
Get proxy given a hashed key+clid. More... | |
virtual sgkey_t | stringToKey (const std::string &str, CLID clid) override |
Find the key for a string/CLID pair. More... | |
virtual const std::string * | keyToString (sgkey_t key, CLID &clid) const override |
Find the string and CLID corresponding to a given key. More... | |
virtual bool | tryELRemap (sgkey_t sgkey_in, size_t index_in, sgkey_t &sgkey_out, size_t &index_out) override |
Test to see if the target of an ElementLink has moved. More... | |
virtual StatusCode | addToStore (CLID, SG::DataProxy *proxy) override |
Add a new proxy to the store. More... | |
virtual void | boundHandle (IResetable *handle) override |
Tell the store that a handle has been bound to a proxy. More... | |
virtual void | unboundHandle (IResetable *handle) override |
Tell the store that a handle has been unbound from a proxy. More... | |
virtual SG::DataProxy * | recordObject (SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting) override |
Record an object in the store. More... | |
template<class T > | |
void | record (const T *p, const std::string &key) |
template<class T > | |
void | record (std::unique_ptr< T > up, const std::string &key) |
void | remap (sgkey_t sgkey_in, sgkey_t sgkey_out, size_t index_in=0, size_t index_out=0) |
template<class T > | |
void | remap (const std::string &key_in, const std::string &key_out, size_t index_in=0, size_t index_out=0) |
void | alias (SG::DataProxy *proxy, const std::string &newKey) |
SG::DataProxy * | proxy (lock_t &, const void *const pTransient) const |
SG::DataProxy * | proxy (lock_t &, const CLID &id, const std::string &key) const |
SG::DataProxy * | record1 (lock_t &, const void *p, DataObject *obj, CLID clid, const std::string &key) |
DeclareInterfaceID (IProxyDict, 2, 0) | |
DeclareInterfaceID (INamedInterface, 2, 0) | |
virtual StatusCode | createObj (IConverter *cvt, IOpaqueAddress *addr, DataObject *&refpObject) |
Call converter to create an object, possibly with locking. More... | |
virtual IProxyDict * | hiveProxyDict () 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... | |
Public Attributes | |
tmap_t | m_tmap |
kmap_t | m_kmap |
remap_t | m_remap |
SG::StringPool m_stringPool | ATLAS_THREAD_SAFE |
std::vector< IResetable * > | m_boundHandles |
std::vector< std::pair< CLID, std::string > > m_missedProxies | ATLAS_THREAD_SAFE |
mutex_t | m_mutex |
Definition at line 50 of file TestStore.h.
Definition at line 125 of file TestStore.h.
typedef std::lock_guard<mutex_t> SGTest::TestStore::lock_t |
Definition at line 139 of file TestStore.h.
typedef std::mutex SGTest::TestStore::mutex_t |
Definition at line 138 of file TestStore.h.
typedef std::unordered_map<TestStoreRemap, TestStoreRemap, TestStoreRemapHash> SGTest::TestStore::remap_t |
Definition at line 128 of file TestStore.h.
|
inherited |
Type of the keys.
Definition at line 34 of file IStringPool.h.
typedef std::unordered_map<const void*, SG::DataProxy*> SGTest::TestStore::tmap_t |
Definition at line 122 of file TestStore.h.
|
overridevirtual |
Definition at line 26 of file TestStore.cxx.
|
overridevirtual |
Add a new proxy to the store.
id | CLID as which the proxy should be added. |
proxy | The 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.
Implements IProxyDict.
Definition at line 194 of file TestStore.cxx.
void SGTest::TestStore::alias | ( | SG::DataProxy * | proxy, |
const std::string & | newKey | ||
) |
|
overridevirtual |
Tell the store that a handle has been bound to a proxy.
handle | The handle that was bound. The default implementation does nothing. |
Reimplemented from IProxyDict.
Definition at line 204 of file TestStore.cxx.
|
virtualinherited |
Call converter to create an object, possibly with locking.
cvt | The converter to call. |
addr | Opaque address information for the object to create. |
refpObject | Reference 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.
|
inherited |
|
inherited |
|
overridevirtualinherited |
Return the current event-slot-specific store.
The default version just returns this.
Implements IHiveStore.
Reimplemented in StoreGateSvc, and SGImplSvc.
Definition at line 83 of file IProxyDict.cxx.
|
overridevirtual |
Find the string and CLID corresponding to a given key.
key | The key to look up. |
clid[out] | The found CLID. |
stringToKey()
or registerKey()
. Implements IStringPool.
Definition at line 175 of file TestStore.cxx.
Find the string corresponding to a given key.
key | The key to look up. |
stringToKey()
or registerKey()
. Implements IStringPool.
Definition at line 50 of file TestStore.cxx.
|
overridevirtual |
Definition at line 115 of file TestStore.cxx.
|
overridevirtual |
Return the list of all current proxies in store.
Implements IProxyDict.
Definition at line 44 of file TestStore.cxx.
|
overridevirtual |
Get proxy with given id and key.
id | The CLID of the desired object. |
key | The 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
Implements IProxyDict.
Definition at line 139 of file TestStore.cxx.
|
overridevirtual |
Get a proxy referencing a given transient object.
pTransient | The object to find. |
Returns 0 to flag failure
Implements IProxyDict.
Definition at line 122 of file TestStore.cxx.
SG::DataProxy * SGTest::TestStore::proxy | ( | lock_t & | , |
const CLID & | id, | ||
const std::string & | key | ||
) | const |
SG::DataProxy * SGTest::TestStore::proxy | ( | lock_t & | , |
const void *const | pTransient | ||
) | const |
|
overridevirtual |
Get proxy given a hashed key+clid.
sgkey | Hashed key to look up. |
Find an exact match; no handling of aliases, etc. Returns 0 to flag failure.
Implements IProxyDict.
Definition at line 158 of file TestStore.cxx.
|
overridevirtual |
Definition at line 38 of file TestStore.cxx.
Definition at line 85 of file TestStore.h.
|
inline |
SG::DataProxy * SGTest::TestStore::record1 | ( | lock_t & | , |
const void * | p, | ||
DataObject * | obj, | ||
CLID | clid, | ||
const std::string & | key | ||
) |
Definition at line 221 of file TestStore.cxx.
|
overridevirtual |
Record an object in the store.
obj | The data object to store. |
key | The key as which it should be stored. |
allowMods | If false, the object will be recorded as const. |
returnExisting | If 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.
Implements IProxyDict.
Definition at line 64 of file TestStore.cxx.
|
overridevirtual |
Remember an additional mapping from key to string/CLID.
key | The key to enter. |
str | The string to enter. |
clid | The CLID associated with the string. |
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.
Implements IStringPool.
Definition at line 56 of file TestStore.cxx.
|
overridevirtual |
Definition at line 32 of file TestStore.cxx.
|
inline |
Definition at line 111 of file TestStore.h.
void SGTest::TestStore::remap | ( | sgkey_t | sgkey_in, |
sgkey_t | sgkey_out, | ||
size_t | index_in = 0 , |
||
size_t | index_out = 0 |
||
) |
Definition at line 245 of file TestStore.cxx.
|
virtualinherited |
Return the metadata source ID for the current event slot.
key | SG 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.
Find the key for a string/CLID pair.
str | The string to look up. |
clid | The CLID associated with the string. |
Implements IStringPool.
Definition at line 168 of file TestStore.cxx.
|
overridevirtual |
Test to see if the target of an ElementLink has moved.
sgkey_in | Original hashed key of the EL. |
index_in | Original index of the EL. |
sgkey_out[out] | New hashed key for the EL. |
index_out[out] | New index for the EL. |
The default implementation here always returns false.
Reimplemented from IProxyDict.
Definition at line 182 of file TestStore.cxx.
|
overridevirtual |
Tell the store that a handle has been unbound from a proxy.
handle | The handle that was unbound. The default implementation does nothing. |
Reimplemented from IProxyDict.
Definition at line 211 of file TestStore.cxx.
|
mutable |
Definition at line 131 of file TestStore.h.
|
mutable |
Definition at line 136 of file TestStore.h.
std::vector<IResetable*> SGTest::TestStore::m_boundHandles |
Definition at line 133 of file TestStore.h.
kmap_t SGTest::TestStore::m_kmap |
Definition at line 126 of file TestStore.h.
|
mutable |
Definition at line 140 of file TestStore.h.
remap_t SGTest::TestStore::m_remap |
Definition at line 129 of file TestStore.h.
tmap_t SGTest::TestStore::m_tmap |
Definition at line 123 of file TestStore.h.