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"
51#include "GaudiKernel/IClassIDSvc.h"
60#include "GaudiKernel/IIncidentSvc.h"
78struct _object;
typedef _object
PyObject;
136 bool clearAddressFlag=
true);
139 bool clearAddressFlag=
true);
142 StatusCode
symLink (
const void* p2BRegistered,
CLID linkID );
145 StatusCode
symLink (
const CLID id,
const std::string& key,
const CLID linkid);
148 StatusCode
setAlias(
CLID clid,
const std::string& key,
const std::string& aliasKey);
151 StatusCode
setAlias(
const void* p2BAliased,
const std::string& aliasKey);
157 StatusCode
setConst(
const void* pointer);
160 StatusCode
remove(
const void* pObject);
171 const std::string& keyA,
const std::string& keyB );
186 CLID clid(
const std::string& key )
const;
191 std::vector<CLID>
clids(
const std::string& key )
const;
199 bool contains(
const CLID id,
const std::string& key)
const;
208 std::string
dump()
const;
224 keys(
const CLID&
id, std::vector<std::string>& vkeys,
225 bool includeAlias =
false,
bool onlyValid =
true);
242 bool trigger =
false);
245 StatusCode
regFcn (
const std::string& toolName,
248 bool trigger =
false);
265 {
return this->
proxy(
id, std::string(key)); }
292 const std::string& key,
294 bool returnExisting)
override final;
317 {
return this->
proxy(
id, std::string(key), checkValid); }
320 virtual std::vector<const SG::DataProxy*>
proxies()
const override final;
403 CLID clidid) override final;
444 sgkey_t& sgkey_out,
size_t& index_out) override final;
458 virtual StatusCode
initialize() override final;
460 virtual StatusCode
start() override final;
461 virtual StatusCode
stop() override final;
462 virtual StatusCode
finalize() override final;
470 virtual
void handle(
const Incident&) override final;
481 virtual StatusCode
clearStore(
bool forceRemove=false) override final;
530 IOpaqueAddress* addr,
531 DataObject*& refpObject) override;
539 bool resetOnly=true);
549 bool allowMods,
bool resetOnly=true,
553 DataObject* obj,
const std::
string& key,
561 bool allowMods,
bool resetOnly,
566 bool allowMods,
bool resetOnly,
576 bool allowMods,
bool resetOnly,
bool allowOverwrite,
596 bool checkValid = false)
const;
629 void recycle(DataObject* pBadDObj);
650 bool forceRemove=false);
670 bool warn_nobib = true);
736#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.
defines and typedefs for IOVSvc
boost::function< StatusCode(IOVSVC_CALLBACK_ARGS) > IOVSvcCallBackFcn
the type of an IOVSvc call back: it wraps both the method and the object the method is called on
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.
associate a data object with its VersionedKey
defines a StoreGateSvc key with a version number
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.
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 symLink(const void *p2BRegistered, CLID linkID)
make a soft link to the object T* already registered
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.
DataObject * typeless_retrievePrivateCopy(const CLID clid, const std::string &key)
virtual sgkey_t stringToKey(const std::string &str, CLID clid) override final
Find the key for a string/CLID pair.
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
StatusCode setAlias(CLID clid, const std::string &key, const std::string &aliasKey)
make an alias to a DataObject (provide data type and old key)
friend class AthenaOutputStream
access proxyRange()
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
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.
StatusCode regFcn(const CallBackID &c1, const CallBackID &c2, const IOVSvcCallBackFcn &fcn, bool trigger=false)
register a callback function(2) with an already registered function(1)
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
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.
StoreID::type storeID() const
get store ID. request forwarded to DataStore:
StatusCode proxyRange(const CLID &id, SG::ConstProxyIterator &beg, SG::ConstProxyIterator &end) const
return a range to all proxies of a given CLID
bool bindHandleToProxyAndRegister(const CLID &id, const std::string &key, IResetable *ir, SG::DataProxy *&dp)
Also do registration with IOVSvc.
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)
bool bindHandleToProxy(const CLID &id, const std::string &key, IResetable *ir, SG::DataProxy *&dp)
name says it all
std::lock_guard< mutex_t > lock_t
IProxyProviderSvc * m_pPPS
virtual void commitNewDataObjects() override final
Reset handles added since the last call to commit.
int typeCount(const CLID &id) const
Return the number of instances of type T (input CLID)
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 recordAddress(const std::string &skey, CxxUtils::RefCountedPtr< IOpaqueAddress > pAddress, bool clearAddressFlag=true)
Create a proxy object using an IOpaqueAddress and a transient key.
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
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
virtual SG::DataProxy * proxy(const CLID &id, const char *key, bool checkValid) const
get proxy with given id and key, optionally checking validity.
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.
virtual SG::DataProxy * proxy(const CLID &id, const char *key) const final
get proxy with given id and key.
friend class IOVDbSvc
access clearProxyPayload
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...
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
Base class for elements of a container that can have aux data.
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 it the range.
The Athena Transient Store API.
int ir
counter of the current depth
PyObject * recordObjectToStore(StoreGateSvc *, PyObject *, PyObject *, bool, bool, bool)
record object to storegate
void py_sg_clearProxyPayload(StoreGateSvc *self, SG::DataProxy *)
=============================================================================
CxxUtils::RefCountedPtr< T > DataObjectSharedPtr
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.