Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
7 #ifndef STOREGATE_STOREGATESVC_H
8 #define STOREGATE_STOREGATESVC_H
17 #include "GaudiKernel/Service.h"
25 #include <GaudiKernel/ClassID.h>
26 #include <GaudiKernel/IInterface.h>
27 #include <GaudiKernel/IMessageSvc.h>
28 #include "Gaudi/Property.h"
29 #include "GaudiKernel/ServiceHandle.h"
30 #include "GaudiKernel/StatusCode.h"
31 #include "GaudiKernel/DataObjID.h"
32 #include "GaudiKernel/IAlgContextSvc.h"
39 #include <sys/types.h>
41 #include <type_traits>
52 #include "GaudiKernel/IClassIDSvc.h"
61 #include "GaudiKernel/IIncidentListener.h"
67 class TransientAddress;
69 class TestHiveStoreSvc;
123 public IIncidentListener
127 #ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES
128 #ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
151 template <
typename T,
typename TKEY,
typename... ARGS>
162 template <
typename T,
typename TKEY>
166 template <
typename T,
typename TKEY>
172 template <
typename T,
typename TKEY>
174 bool allowMods,
bool resetOnly=
true,
bool noHist=
false);
177 template <
typename T,
typename TKEY>
181 template <
typename T,
typename TKEY>
186 template <
typename T,
typename TKEY>
188 bool allowMods,
bool resetOnly=
true,
bool noHist=
false);
197 template <
typename T>
201 template <
typename T>
206 template <
typename T>
211 template <
typename T>
213 template <
typename T>
217 template <
typename T,
typename TKEY>
222 template <
typename T>
227 template <
typename T,
typename TKEY>
232 template <
typename T>
238 template <
typename T,
class TKEY>
243 template <
typename T,
class TKEY>
245 template <
typename T,
class TKEY>
251 template <
typename T>
258 template <
typename T,
typename TKEY>
275 template <
typename T,
typename TKEY>
285 template <
typename T,
typename TKEY>
289 template <
typename T,
typename TKEY>
291 bool allowMods,
bool noHist=
false);
295 template <
typename T,
typename TKEY>
297 bool allowMods,
bool noHist=
false);
300 template <
typename T,
typename TKEY>
305 IOpaqueAddress* pAddress,
bool clearAddressFlag=
true);
310 template <
typename T,
typename TLINK>
314 template <
typename T,
typename TLINK>
318 template <
typename TKEY>
322 template <
typename T,
typename TKEY,
typename AKEY>
326 template <
typename T,
typename AKEY>
336 template <
typename T>
340 template <
typename T>
349 const std::string& keyA,
const std::string& keyB );
365 template <
typename T,
class TKEY>
367 const TKEY& requestedKey)
const;
379 template <
typename T,
class TKEY>
382 const TKEY& requestedKey)
const;
397 template <
typename T>
403 template<
typename TKEY>
409 template<
typename TKEY>
416 template <
typename T>
425 template <
typename TKEY>
432 template <
typename T,
typename TKEY>
438 template <
typename TKEY>
443 std::string
dump()
const;
457 template <
typename T>
459 keys(std::vector<std::string>& vkeys,
460 bool includeAlias =
false,
bool onlyValid =
true)
const;
470 keys(
const CLID&
id, std::vector<std::string>& vkeys,
471 bool includeAlias =
false,
bool onlyValid =
true)
const;
521 const TKEY&
key,
bool trigger=false);
527 const TKEY&
key,
bool trigger=false);
584 bool returnExisting) override
final;
607 {
return this->
proxy(
id, std::string(
key), checkValid); }
797 IOpaqueAddress* addr,
798 DataObject*& refpObject) override;
813 friend class
SG::TestHiveStoreSvc;
849 friend class
SG::VarHandleBase;
857 bool allowMods,
bool resetOnly=true,
865 const std::type_info* tinfo=0);
870 bool allowMods,
bool resetOnly=true,
bool noHist=false);
875 bool allowMods,
bool noHist=false);
888 const std::
string& gK,
904 bool forceRemove=false);
915 const std::type_info* tinfo,
916 bool warn_nobib = true);
933 : DataObjID (
clid,
key), m_algo (algo)
937 typedef std::unordered_set<BadListItem, DataObjID_Hasher>
BadItemList;
975 const std::string&
key)
const;
984 const std::string&
what)
const;
992 template <
class DOBJ>
994 const std::string&
key,
995 bool ignoreMissing=
true)
const;
996 template <
class DOBJ>
998 const std::string&
key,
999 bool ignoreMissing=
true)
const;
1001 template <
class DOBJ,
class AUXSTORE>
1003 const std::string&
key,
1004 const AUXSTORE*)
const;
1005 template <
class DOBJ>
1007 const std::string& ,
1031 if ( StatusCode::SUCCESS == psg->
retrieve(
obj ) )
1045 #endif // STOREGATE_STOREGATESVC_H
bool transientSwap(const CLID &id, const std::string &keyA, const std::string &keyB)
swap the content of 2 keys payload A indexed by keyA will now be accessed via keyB and vice versa Not...
Athena service for Interval Of Validity database. The IOVDbSvc may be in one of three time states whi...
StatusCode record(T *p2BRegistered, const TKEY &key)
Record an object with a key.
Abstract interface for looking up strings/CLIDs in a pool.
int typeCount() const
Return the number of instances of an object of type T int i = p_store->typeCount<T>(); Note that th...
bool contains(const TKEY &key) const
Look up a keyed object in TDS (compare also tryRetrieve) returns false if object not available in TDS...
std::string createKey(const CLID &dataID)
creates a key internally if none specified by client
StatusCode addSymLink(const CLID &linkid, SG::DataProxy *dp)
T * tryRetrieve(const TKEY &key) const
Variant of the above which doesn't print a warning message.
static void setSlot(SG::HiveEventSlot *pSlot)
set the hive event slot pointer: used by the event loop mgrs
T * retrieve() const
Variant of the above which doesn't return a status code.
void clearProxyPayload(SG::DataProxy *)
use to reset a proxy (clearing the data object it contains) Unlike DataProxy::reset this method corre...
bool associateAux_impl(DOBJ *, const std::string &, const SG::NoAuxStore *) const
T * retrieve(const TKEY &key) const
Variant of the above which doesn't return a status code.
static const InterfaceID & interfaceID()
Should rather be in IStoreGateSvc.h if we had one.
virtual StatusCode stop() override
Service start.
void keys(const CLID &id, std::vector< std::string > &vkeys, bool includeAlias=false, bool onlyValid=true) const
provide list of all StoreGate keys associated with an object.
BadListItem(CLID clid, const std::string &key, const std::string &algo)
void setProxyProviderSvc(IProxyProviderSvc *pPPSvc)
associate ProxyProviderSvc to this store
StatusCode setAlias(const T *p2BAliased, const TKEY &key, const AKEY &aliasKey)
make an alias to a DataObject (provide data type and old key)
virtual void handle(const Incident &) override final
StatusCode retrieve(T *&ptr, const TKEY &key) const
Retrieve an object with "key", into a T*.
void msg_update_handler(Gaudi::Details::PropertyBase &outputLevel)
callback for output level property
StoreID::type m_storeID
Cache store type in the facade class.
associate a data object with its VersionedKey
T * tryRetrieve() const
Variant of the above which doesn't print a warning message.
StatusCode overwrite(T *p2BRegistered, const TKEY &key)
Record an object with a key, overwriting any existing object with same key.
StoreGateSvc(const StoreGateSvc &)
StatusCode overwrite(std::unique_ptr< T > pUnique, const TKEY &key)
Record an object with a key, overwriting any existing object with same key, take ownership of the uni...
void makeCurrent()
The current store is becoming the active store.
SG::DataProxy * setupProxy(const CLID &dataID, const std::string &gK, DataObject *pDObj, bool allowMods, bool resetOnly)
try to locate a proxy or create it if needed
BadItemList m_badRetrieves ATLAS_THREAD_SAFE
Remember calls to retrieve and record for a MT store, so we can warn about them during finalize().
bool m_ActivateHistory
property: activate the history service
bool m_DumpStore
property Dump: triggers dump() at EndEvent
void printBadList(const BadItemList &bad, const std::string &what) const
Print out a list of bad calls during finalization.
StatusCode typeless_overwrite(const CLID &id, DataObject *obj, const std::string &key, const void *const raw_ptr, bool allowMods, bool noHist=false, const std::type_info *tinfo=0)
same as typeless_record, allows to overwrite an object in memory or on disk
virtual void commitNewDataObjects() override final
Reset handles added since the last call to commit.
SGImplSvc * currentStore() const
returns pointer to the current SGImplSvc
CLID clid(const TKEY &key) const
Retrieve the main CLID of the object recorded in StoreGate with the given "key" WARNING: slow!
bool associateAux(const DOBJ *, const std::string &key, bool ignoreMissing=true) const
int typeCount(const CLID &id) const
Return the number of instances of type T (input CLID)
static const T * retrieve(StoreGateSvc *psg)
ServiceHandle< IProxyProviderSvc > m_pPPSHandle
property
std::vector< CLID > clids(const TKEY &key) const
Retrieve all the CLID s (including symlinks) of the object recorded in StoreGate with the given "key"...
A standard conforming forward iterator over items in StoreGate.
bool const RAWDATA *ch2 const
void keys(std::vector< std::string > &vkeys, bool includeAlias=false, bool onlyValid=true) const
provide list of all StoreGate keys associated with an object.
SG::sgkey_t sgkey_t
Type of the keys.
#define IOVSVC_CALLBACK_ARGS
short hand for IOVSvc call back argument list, to be used when no access to formal arguments is neede...
void rememberBadRetrieve(CLID clid, const std::string &key) const
Remember that retrieve() was called for a MT store.
A structure created by HiveMgrSvc and used by SGHiveStoreSvc to forward the StoreGateSvc method to a ...
StatusCode removeProxy(SG::DataProxy *proxy, const void *pTrans, bool forceRemove=false)
remove proxy from store, unless it is reset only.
StatusCode record(std::unique_ptr< T > pUnique, const TKEY &key)
Record an object with a key, take ownership of the unique_ptr obj.
StatusCode record(const T *p2BRegistered, const TKEY &key)
Record a const object with a key.
StoreID::type storeID() const
get store ID. request forwarded to DataStore:
void remap_impl(sgkey_t source, sgkey_t target, off_t index_offset)
Declare a remapping.
the preferred mechanism to access information from the different event stores in a pileup job.
bool transientContains(const CLID &id, const TKEY &key) const
Look up a transient data object in TDS only by CLID.
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
StatusCode retrieveAllVersions(std::list< SG::ObjectWithVersion< T > > &allVersions, const TKEY &requestedKey) const
Retrieve all versions of a given T,KEY combination sets allVersions, a ref to a vector of ObjectWithV...
StatusCode proxyRange(const CLID &id, SG::ConstProxyIterator &beg, SG::ConstProxyIterator &end) const
return a range to all proxies of a given CLID
std::mutex mutex_t
Protect access to m_bad* members.
SGImplSvc * m_defaultStore
Mark that there's no associated AuxStore class.
void emptyTrash()
throw away bad objects
bool m_DumpArena
DumpArena Property flag : trigger m_arena->report() at clearStore.
StatusCode setAlias(const T *p2BAliased, const AKEY &aliasKey)
make an alias to a DataObject (provide only valid pointer)
virtual StatusCode finalize() override
StatusCode retrieve(const T *&ptr, const TKEY &key) const
Retrieve an object with "key", into a const T*.
The Athena Transient Store API.
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface) override
void releaseObject(const CLID &id, const std::string &key)
release object held by proxy, if any.
StatusCode record1(DataObject *obj, T *pObject, const TKEY &key, bool allowMods, bool resetOnly=true, bool noHist=false)
StoreGateSvc & operator=(const StoreGateSvc &)
const T * tryConstRetrieve(const TKEY &key) const
virtual StatusCode initialize() override
Service initialization.
std::string dump() const
dump objects in store.
StatusCode regHandle(DataHandle< H > &handle, const TKEY &key)
non-const method - will return an error
std::unordered_set< BadListItem, DataObjID_Hasher > BadItemList
StatusCode overwrite(std::unique_ptr< T > pUnique, const TKEY &key, bool allowMods, bool noHist=false)
Record an object with a key, overwriting any existing object with same key.
ServiceHandle< IIncidentSvc > m_incSvc
property
StatusCode record(std::unique_ptr< T > pUnique, const TKEY &key, bool allowMods, bool resetOnly=true, bool noHist=false)
Record an object with a key, allow possibility of specifying const-access.
void addAutoSymLinks(const std::string &key, CLID clid, SG::DataProxy *dp, const std::type_info *tinfo, bool warn_nobib=true)
Add automatically-made symlinks for DP.
StatusCode overwrite1(DataObject *obj, T *pObject, const TKEY &key, bool allowMods, bool noHist=false)
::StatusCode StatusCode
StatusCode definition for legacy code.
StatusCode retrieve(T *&ptr) const
Retrieve the default object into a T*.
StatusCode retrieve(SG::ConstIterator< T > &begin, SG::ConstIterator< T > &end) const
Retrieve all objects of type T: returns an SG::ConstIterator range.
static StoreGateSvc * currentStoreGate()
get current StoreGate
void setDefaultStore(SGImplSvc *pStore)
set pointer to default event store: used by ActiveStoreSvc
DataProxy provides the registry services for StoreGate.
Maintain a mapping of strings to 64-bit ints.
A service that manages a multi-event collection of StoreGateSvc It implements the IHiveWhiteBoard int...
virtual const std::string * keyToString(sgkey_t key) const override final
Find the string corresponding to a given key.
StatusCode loadEventProxies()
load proxies at begin event
StatusCode setAlias(SG::DataProxy *proxy, const std::string &aliasKey)
make an alias to a DataObject (provide valid proxy)
The Athena Transient Store API.
defines an enum used by address providers to decide what kind of StoreGateSvc they are providing addr...
void rememberBadRecord(CLID clid, const std::string &key) const
Remember that retrieve() was called for a MT store.
virtual StatusCode clearStore(bool forceRemove=false) override final
clear DataStore contents: called by the event loop mgrs
AthROOTErrorHandlerSvc * svc
virtual SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const override final
Get proxy given a hashed key+clid.
virtual void registerKey(sgkey_t key, const std::string &str, CLID clidid) override final
Remember an additional mapping from key to string/CLID.
uint32_t CLID
The Class ID type.
StatusCode bind ATLAS_NOT_THREAD_SAFE(const DataHandle< T > &handle, const TKEY &key)
A "once-per-job" retrieve that binds a data object to a DataHandle, typically a data member of an Alg...
StatusCode overwrite(T *p2BRegistered, const TKEY &key, bool allowMods, bool noHist=false)
Record an object with a key, overwriting any existing object with same key.
bool transientContains(const TKEY &key) const
Look up a transient data object in TDS only (no Proxy lookup) returns false if object not available i...
StatusCode typeless_record(DataObject *obj, const std::string &key, const void *const raw_ptr, bool allowMods, bool resetOnly=true, bool noHist=false)
type-less recording of an object with a key, allow possibility of specifying const-access and history...
virtual sgkey_t stringToKey(const std::string &str, CLID clid) override final
Find the key for a string/CLID pair.
std::vector< CLID > clids() const
Return all CLIDs in the store.
virtual StatusCode createObj(IConverter *cvt, IOpaqueAddress *addr, DataObject *&refpObject) override
Call converter to create an object, with locking.
void rememberBad(BadItemList &bad, CLID clid, const std::string &key) const
Remember that retrieve or record was called for a MT store.
virtual SG::DataProxy * proxy(const void *const pTransient) const override final
get proxy for a given data object address in memory
std::lock_guard< mutex_t > lock_t
StatusCode symLink(const T *p2BRegistered, TLINK *p2BLinked)
make a soft link to the object T* already registered (non-const)
void t2pRemove(const void *const pTrans)
forwarded to DataStore
StatusCode setConst(const void *pointer)
prevent downstream clients from modifying the pointed-at dobj
StatusCode t2pRegister(const void *const pTrans, SG::DataProxy *const pPers)
forwarded to DataStore
StatusCode symLink(const T *p2BRegistered, const TLINK *p2BLinked)
make a soft link to the object T* already registered (const link)
Algorithm preparing auxiliary store objects for slimming.
StatusCode symLink(const CLID id, const TKEY &key, const CLID linkid)
make a soft link to the object pointed by id/key
an iterator over instances of a given type in StoreGateSvc. It d-casts and caches locally the pointed...
the interface through which HiveWB control StoreGate instances
BadItemList m_badRecords ATLAS_THREAD_SAFE
StatusCode recordAddress(const std::string &skey, IOpaqueAddress *pAddress, bool clearAddressFlag=true)
Create a proxy object using an IOpaqueAddress and a transient key.
void py_sg_clearProxyPayload(StoreGateSvc *self, SG::DataProxy *)
DataObject * accessData(const CLID &id) const
find proxy and access its data. Returns 0 to flag failure
StatusCode retrieve(const T *&ptr, const std::string &key) const
Retrieve an object with "key", into a const T*.
const T * tryConstRetrieve() const
std::unique_ptr< T > retrieveUniquePrivateCopy(const std::string &key)
EXPERTS ONLY: like readPrivateCopy this method returns your own private copy of a data object of type...
virtual SG::DataProxy * recordObject(SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting) override final
Record an object in the store.
virtual std::vector< const SG::DataProxy * > proxies() const override final
return the list of all current proxies in store
Collection of memory allocators with a common lifetime, plus subsystem summary.
virtual bool tryELRemap(sgkey_t sgkey_in, size_t index_in, sgkey_t &sgkey_out, size_t &index_out) override final
Test to see if the target of an ElementLink has moved.
void remap(CLID clid, const TKEY &source, const TKEY &target, off_t index_offset)
Declare a remapping.
static const T * retrieve(StoreGateSvc *psg, const std::string &key)
virtual SG::SourceID sourceID(const std::string &key="EventSelector") const override
Return the metadata source ID for the current event slot.
StatusCode removeDataAndProxy(const T *pObject)
Remove pObject and its proxy no matter what.
StatusCode record(std::unique_ptr< const T > pUnique, const TKEY &key)
Record a const object with a key.
void SG_dump(StoreGateSvc *sg)
These are intended to be easy to call from the debugger.
bool associateAux_impl(DOBJ *ptr, const std::string &key, const AUXSTORE *) const
algorithm that marks for write data objects in SG
ServiceHandle< IAlgContextSvc > m_algContextSvc
Algorithm context, for tracking bad calls.
StatusCode recordAddress(IOpaqueAddress *pAddress, bool clearAddressFlag=true)
Create a proxy object using an IOpaqueAddress.
void setStoreID(StoreID::type id)
set store ID. request forwarded to DataStore:
StatusCode retrieveHighestVersion(SG::ObjectWithVersion< T > &dobjWithVersion, const TKEY &requestedKey) const
Retrieve version with highest cycle number for a given T,KEY combination If there is only one availab...
=============================================================================
StatusCode remove(const T *pObject)
Remove pObject, will remove its proxy if not reset only.
bool associateAux(DOBJ *, const std::string &key, bool ignoreMissing=true) const
try to associate a data object to its auxiliary store if ignoreMissing=false
StatusCode retrieve(T *&ptr, const std::string &key) const
Retrieve an object with "key", into a T*.
defines and typedefs for IOVSvc
virtual ::IProxyDict * hiveProxyDict() override final
implements IHiveStore interface
SG::DataProxy * transientProxy(const CLID &id, const std::string &key) const
get proxy with given id and key.
IProxyProviderSvc * proxyProviderSvc()
Return current ProxyProviderSvc.
virtual StatusCode addToStore(CLID id, SG::DataProxy *proxy) override final
Raw addition of a proxy to the store.
associate a data object with its VersionedKey The object is held by a ReadHandle to delay its retriev...
Define macros for attributes used to control the static checker.
StatusCode addAlias(const std::string &aliasKey, SG::DataProxy *dp)
SG::WPtr< T > create(const TKEY &key, ARGS... constructorArgs)
Create an object with one of its constructors and record it with a key.
bool isSymLinked(const CLID &linkID, SG::DataProxy *dp)
the interface that provides access to the current hive store
void recycle(DataObject *pBadDObj)
put a bad (unrecordable) dobj away
macros to associate a CLID to a type
static SG::HiveEventSlot * currentSlot()
PyObject * recordObjectToStore(StoreGateSvc *, PyObject *, PyObject *, bool, bool, bool)
record object to storegate
ProxyMap::const_iterator ConstProxyIterator
StatusCode record(T *p2BRegistered, const TKEY &key, bool allowMods, bool resetOnly=true, bool noHist=false)
Record an object with a key, allow possibility of specifying const-access.
bool contains(const CLID &id, const TKEY &key) const
Look up a keyed object in TDS by CLID.