7#ifndef STOREGATE_SGIMPLSVC_H
8#define STOREGATE_SGIMPLSVC_H
16#include "GaudiKernel/IIncidentListener.h"
17#include "GaudiKernel/Service.h"
18#include "GaudiKernel/ServiceHandle.h"
19#include "GaudiKernel/IConverter.h"
22#include <GaudiKernel/ClassID.h>
23#include <GaudiKernel/IInterface.h>
24#include <GaudiKernel/IMessageSvc.h>
25#include "GaudiKernel/MsgStream.h"
26#include "Gaudi/Property.h"
27#include "GaudiKernel/StatusCode.h"
29#include "GaudiKernel/DataObjID.h"
50#include "GaudiKernel/IClassIDSvc.h"
57#include "GaudiKernel/IIncidentSvc.h"
75struct _object;
typedef _object
PyObject;
133 bool clearAddressFlag=
true,
134 const std::vector<CLID>& bases = {});
137 bool clearAddressFlag=
true,
138 const std::vector<CLID>& bases = {});
164 CLID clid(
const std::string& key )
const;
169 bool contains(
const CLID id,
const std::string& key)
const;
178 std::string
dump()
const;
194 keys(
const CLID&
id, std::vector<std::string>& vkeys,
195 bool includeAlias =
false,
bool onlyValid =
true);
218 {
return this->
proxy(
id, std::string(key)); }
245 const std::string& key,
247 bool returnExisting)
override final;
270 {
return this->
proxy(
id, std::string(key), checkValid); }
273 virtual std::vector<const SG::DataProxy*>
proxies()
const override final;
356 CLID clidid) override final;
397 sgkey_t& sgkey_out,
size_t& index_out) override final;
411 virtual StatusCode
initialize() override final;
413 virtual StatusCode
start() override final;
414 virtual StatusCode
stop() override final;
415 virtual StatusCode
finalize() override final;
423 virtual
void handle(
const Incident&) override final;
434 virtual StatusCode
clearStore(
bool forceRemove=false) override final;
483 IOpaqueAddress* addr,
484 DataObject*& refpObject) override;
492 bool resetOnly=true);
502 bool allowMods,
bool resetOnly=true,
506 DataObject* obj,
const std::
string& key,
514 bool allowMods,
bool resetOnly,
519 bool allowMods,
bool resetOnly,
529 bool allowMods,
bool resetOnly,
bool allowOverwrite,
549 bool checkValid = false)
const;
575 void recycle(DataObject* pBadDObj);
583 bool forceRemove=false);
603 bool warn_nobib = true);
669#include "StoreGate/tools/SGImplSvc.icc"
Collection of memory allocators with a common lifetime, plus subsystem summary.
macros to associate a CLID to a type
uint32_t CLID
The Class ID type.
Simple smart pointer for Gaudi-style refcounted objects.
void SG_dump(SGImplSvc *sg)
These are intended to be easy to call from the debugger.
A standard conforming forward iterator over items in StoreGate.
return type of StoreGateSvc::create.
Maintain a mapping of strings to 64-bit ints.
A service that caches a pointer to the currently active store.
algorithm that marks for write data objects in SG
Simple smart pointer for Gaudi-style refcounted objects.
DataProxy provides the registry services for StoreGate.
Hold DataProxy instances associated with a store.
Abstract interface for IOVSvc.
Athena service for Interval Of Validity database.
virtual SG::DataProxy * proxy(const CLID &id, const std::string &key) const =0
Get proxy with given id and key.
Abstract interface for looking up strings/CLIDs in a pool.
virtual SG::DataProxy * proxy(const void *const pTransient) const override final
get proxy for a given data object address in memory
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.
std::recursive_mutex mutex_t
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.
void setStoreID(StoreID::type id)
set store ID. request forwarded to DataStore:
StatusCode t2pRegister(const void *const pTrans, SG::DataProxy *const pPers)
forwarded to DataStore
friend class ActiveStoreSvc
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 void boundHandle(IResetable *handle) override final
Tell the store that a proxy has been bound to a handle.
friend class SG::VarHandleBase
access typeless_record
IProxyProviderSvc * proxyProviderSvc()
Return current ProxyProviderSvc.
virtual sgkey_t stringToKey(const std::string &str, CLID clid) override final
Find the key for a string/CLID pair.
SG::DataProxy * proxy(const CLID &id, const char *key) const
get proxy with given id and key.
virtual StoreID::type storeID() const override
get store ID. request forwarded to DataStore:
StatusCode remove(const void *pObject)
Remove pObject, will remove its proxy if not reset only.
virtual void handle(const Incident &) override final
triggered by Incident service
SG::DataProxy * locatePersistent(const SG::TransientAddress *tAddr, bool checkValid=false) const
virtual std::vector< const SG::DataProxy * > proxies() const override final
return the list of all current proxies in store
virtual SG::DataProxy * recordObject(SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting) override final
Record an object in the store.
StatusCode loadEventProxies()
load proxies at begin event
SG::DataProxy * proxy(const CLID &id, const char *key, bool checkValid) const
get proxy with given id and key, optionally checking validity.
void keys(const CLID &id, std::vector< std::string > &vkeys, bool includeAlias=false, bool onlyValid=true)
provide list of all StoreGate keys associated with an object.
SG::RemapImpl * m_remap_impl
int m_slotNumber
The Hive slot number for this store, or -1 if this isn't a Hive store.
ServiceHandle< IProxyProviderSvc > m_pPPSHandle
virtual StatusCode finalize() override final
Service finalization.
friend class StoreGateSvc
std::map< std::thread::id, std::vector< IResetable * > > m_newBoundHandles
Keep track of proxies bound since the last call to commitNewDataObjects or clearStore.
virtual SG::SourceID sourceID(const std::string &key="EventSelector") const override
Return the metadata source ID for the current event slot.
StatusCode setConst(const void *pointer)
prevent downstream clients from modifying the pointed-at dobj
virtual StatusCode createObj(IConverter *cvt, IOpaqueAddress *addr, DataObject *&refpObject) override
Call converter to create an object, with locking.
bool m_DumpStore
Dump Property flag: triggers dump() at EndEvent.
bool m_ActivateHistory
Activate the history service.
CLID clid(const std::string &key) const
Retrieve the main CLID of the object recorded in StoreGate with the given "key" WARNING: slow!
void msg_update_handler(Gaudi::Details::PropertyBase &outputLevel)
callback for output level property
SG::StringPool m_stringpool
virtual StatusCode start() override final
Service start.
std::string createKey(const CLID &dataID)
creates a key internally if none specified by client
StatusCode setAlias(const void *p2BAliased, const std::string &aliasKey)
make an alias to a DataObject (provide only valid pointer)
bool m_DumpArena
DumpArena Property flag : trigger m_arena->report() at clearStore.
StatusCode removeProxy(SG::DataProxy *proxy, const void *pTrans, bool forceRemove=false)
remove proxy from store, unless it is reset only.
void remap_impl(sgkey_t source, sgkey_t target, off_t index_offset)
Declare a remapping.
virtual void registerKey(sgkey_t key, const std::string &str, CLID clidid) override final
Remember an additional mapping from key to string/CLID.
StatusCode addSymLink(const CLID &linkid, SG::DataProxy *dp)
SG::Arena m_arena
Allocation arena to associate with this store.
virtual StatusCode clearStore(bool forceRemove=false) override final
clear DataStore contents: called by the event loop mgrs
bool isSymLinked(const CLID &linkID, SG::DataProxy *dp)
std::lock_guard< mutex_t > lock_t
IProxyProviderSvc * m_pPPS
StatusCode recordAddress(const std::string &skey, CxxUtils::RefCountedPtr< IOpaqueAddress > pAddress, bool clearAddressFlag=true, const std::vector< CLID > &bases={})
Create a proxy object using an IOpaqueAddress and a transient key.
virtual void commitNewDataObjects() override final
Reset handles added since the last call to commit.
virtual StatusCode stop() override final
Service stop.
void t2pRemove(const void *const pTrans)
forwarded to DataStore
virtual StatusCode addToStore(CLID id, SG::DataProxy *proxy) override final
Raw addition of a proxy to the store.
StatusCode record_HistObj(const CLID &id, const std::string &key, const std::string &store, bool allowMods, bool resetOnly=true)
virtual const std::string * keyToString(sgkey_t key) const override final
Find the string corresponding to a given key.
friend PyObject * AthenaInternal::recordObjectToStore(StoreGateSvc *, PyObject *, PyObject *, bool, bool, bool)
void clearProxyPayload(SG::DataProxy *)
use to reset a proxy (clearing the data object it contains) Unlike DataProxy::reset this method corre...
StatusCode removeDataAndProxy(const void *pObject)
Remove pObject and its proxy no matter what.
mutex_t m_stringPoolMutex
virtual::IProxyDict * hiveProxyDict() override final
implements IHiveStore interface for compat with Hive
StringArrayProperty m_folderNameList
FolderNameList Property.
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
std::vector< CLID > clids() const
Return all CLIDs in the store.
std::list< DataObject * > m_trash
The Recycle Bin.
ServiceHandle< IHistorySvc > m_pHistorySvc
StatusCode symLink(const CLID id, const std::string &key, const CLID linkid)
make a soft link to the object pointed by id/key
void releaseObject(const CLID &id, const std::string &key)
release object held by proxy, if any.
IStringPool::sgkey_t sgkey_t
ServiceHandle< IIOVSvc > m_pIOVSvc
get the IOVSvc "just in time" (breaks recursion at initialize)
void makeCurrent()
The current store is becoming the active store.
SGImplSvc(const SGImplSvc &)=delete
int m_numSlots
The total number of slots. 1 if this isn't a Hive store.
bool mergeStringPool(const SGImplSvc &other)
Merge the string pool from another store into this one.
DataObject * accessData(const CLID &id) const
find proxy and access its data. Returns 0 to flag failure
void recycle(DataObject *pBadDObj)
put a bad (unrecordable) dobj away
SGImplSvc & operator=(const SGImplSvc &)=delete
virtual StatusCode reinitialize() override final
Service reinitialization.
void setProxyProviderSvc(IProxyProviderSvc *pPPSvc)
associate ProxyProviderSvc to this store
bool m_storeLoaded
FIXME hack needed by loadEventProxies.
virtual SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const override final
Get proxy given a hashed key+clid.
ServiceHandle< IClassIDSvc > m_pCLIDSvc
friend void AthenaInternal::py_sg_clearProxyPayload(StoreGateSvc *, SG::DataProxy *)
bool transientContains(const CLID id, const std::string &key) const
Look up a transient data object in TDS only by CLID.
ServiceHandle< IIncidentSvc > m_pIncSvc
property
std::string dump() const
dump objects in store.
StatusCode addAlias(const std::string &aliasKey, SG::DataProxy *dp)
bool contains(const CLID id, const std::string &key) const
Look up a keyed object in TDS by CLID.
friend class IOVDbSvc
access clearProxyPayload
void setSlotNumber(int slot, int numSlots)
Set the Hive slot number for this store.
StatusCode retrieve(CLID clid, SG::detail::IteratorBase &cibegin, SG::detail::IteratorBase &ciend) const
Retrieve all objects of type T: returns an SG::ConstIterator range.
virtual void unboundHandle(IResetable *handle) override final
Tell the store that a handle has been unbound from a proxy.
SG::DataProxy * transientProxy(const CLID &id, const std::string &key) const
get proxy with given id and key.
bool associateAux_impl(SG::AuxVectorBase *ptr, const std::string &key, CLID auxclid) const
virtual StatusCode initialize() override final
Service initialization.
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
SG::DataProxy * record_impl(DataObject *obj, const std::string &key, const void *const raw_ptr, bool allowMods, bool resetOnly, bool allowOverwrite, const std::type_info *tinfo)
real recording of an object with a key, allow possibility of specifying const-access
void emptyTrash()
throw away bad objects
ServiceHandle< IConversionSvc > m_pDataLoader
Manage index tracking and synchronization of auxiliary data.
Hold DataProxy instances associated with a store.
Mark that there's no associated AuxStore class.
Base class for VarHandle types.
Implementation class, not to be used directly Iterates over valid proxies in the range.
The Athena Transient Store API.
PyObject * recordObjectToStore(StoreGateSvc *, PyObject *, PyObject *, bool, bool, bool)
record object to storegate
void py_sg_clearProxyPayload(StoreGateSvc *self, SG::DataProxy *)
::StatusCode StatusCode
StatusCode definition for legacy code.
=============================================================================
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.
CxxUtils::RefCountedPtr< T > DataObjectSharedPtr
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.