14#include <unordered_map>
28#include "GaudiKernel/IClassIDSvc.h"
29#include "GaudiKernel/IHistorySvc.h"
30#include "GaudiKernel/ISvcLocator.h"
31#include "GaudiKernel/IConversionSvc.h"
32#include "GaudiKernel/Incident.h"
33#include "GaudiKernel/IOpaqueAddress.h"
34#include "GaudiKernel/MsgStream.h"
35#include "GaudiKernel/StatusCode.h"
36#include "GaudiKernel/DataHistory.h"
70template <
class...
Args>
void print(std::FILE* stream, std::format_string<Args...>
fmt,
Args&&... args) {
71 std::fputs(std::format(
fmt, std::forward<Args>(args)...), stream);
74template <
class T>
void*
ptr(T* p) {
return static_cast<void*
>(p); }
103 : base_class(name, svc),
127 declareProperty(
"IncidentSvc",
m_pIncSvc);
151 CHECK( Service::initialize() );
168 if (!(
m_pIncSvc.retrieve()).isSuccess()) {
169 error() <<
"Could not locate IncidentSvc "
171 return StatusCode::FAILURE;
187 SG_MSG_DEBUG(
" Failed to preLoad proxies");
188 return StatusCode::FAILURE;
196 return StatusCode::SUCCESS;
211 return StatusCode::SUCCESS;
221 ISvcManager* pISM(
dynamic_cast<ISvcManager*
>(serviceLocator().
get()));
223 return StatusCode::FAILURE;
224 pISM->setPriority(name(), pISM->getPriority(name())+1).ignore();
225 verbose() <<
"stop: setting service priority to " << pISM->getPriority(name())
226 <<
" so that event stores get finalized and cleared before other stores" <<
endmsg;
228 return StatusCode::SUCCESS;
234 if (inc.type() ==
"EndEvent") {
236 SG_MSG_DEBUG(
"Dumping StoreGate Contents");
237 info() <<
'\n' <<
dump() << endl
245 StatusCode
sc(StatusCode::SUCCESS);
251 dbg::print(stderr,
"SGImplSvc::loadEventProxies() LOADED PROXIES on {}\n", name());
254 dbg::print(stderr,
"SGImplSvc::loadEventProxies() PROXIES ALREADY LOADED on {}\n", name());
264 return std::to_string(
m_pStore->typeCount(
id) + 1);
271 dbg::print(stderr,
"SGImplSvc::clearStore(forceRemove={}) on {}\n", forceRemove, name());
275 std::ostringstream s;
277 info() <<
"Report for Arena: " <<
m_arena.name() <<
'\n'
287 debug() <<
"Clearing store with forceRemove="
290 m_pStore->clearStore(forceRemove, hard_reset, &msgStream(MSG::DEBUG));
299 return StatusCode::SUCCESS;
310 const bool FORCEREMOVE(
true);
320 return Service::finalize();
326 const bool FORCEREMOVE(
true);
329 return StatusCode::SUCCESS;
338 bool clearAddressFlag)
341 assert(0 != pAddress);
342 CLID dataID = pAddress->clID();
346 warning() <<
"recordAddress: Invalid Class ID found in IOpaqueAddress @"
347 << pAddress.
get() <<
". IOA will not be recorded"
349 return StatusCode::FAILURE;
358 if (dp && dp->provider()) {
359 std::string clidTypeName;
360 m_pCLIDSvc->getTypeNameOfID(dataID, clidTypeName).ignore();
361 warning() <<
"recordAddress: failed for key="<< skey <<
", type "
363 <<
" (CLID " << dataID <<
')'
364 <<
"\n there is already a persistent version of this object. Will not record a duplicate! "
366 return StatusCode::FAILURE;
372 if (0 == dp && 0 !=
m_pPPS) {
384 m_pStore->addToStore(dataID, dp).ignore();
388 else if ((0 != dp) && (0 == dp->address()))
392 dp->setAddress(std::move(pAddress));
397 m_pCLIDSvc->getTypeNameOfID(dataID, errType).ignore();
398 warning() <<
"recordAddress: preexisting proxy @" << dp
399 <<
" with non-NULL IOA found for key "
400 << skey <<
" type " << errType <<
" (" << dataID <<
"). \n"
401 <<
"Cannot record IOpaqueAddress @" << pAddress.
get()
403 return StatusCode::FAILURE;
406 return StatusCode::SUCCESS;
415 bool clearAddressFlag)
418 assert(0 != pAddress);
420 CLID dataID = pAddress->clID();
422 string gK = (pAddress->par())[1];
423 if (gK.empty()) gK = (pAddress->par())[0];
426 return this->
recordAddress(gK, std::move(pAddress), clearAddressFlag);
438 if (0 != dp->object())
441 warning() <<
" setupProxy:: error setting up proxy for key "
442 << gK <<
" and clid " << dataID
443 <<
"\n Pre-existing valid DataProxy @"<< dp
444 <<
" found in Store for key " << dp->object()->name()
445 <<
" with clid " << dp->object()->clID()
451 dp->setObject(pDObj);
452 if (!allowMods) dp->setConst();
458 !allowMods, resetOnly);
459 if (!(
m_pStore->addToStore(dataID, dp).isSuccess())) {
460 warning() <<
" setupProxy:: could not addToStore proxy @" << dp
486 bool includeAlias,
bool onlyValid)
490 return store()->
keys(
id, vkeys, includeAlias, onlyValid);
496 return (0 != dp) ? dp->transientID(linkID) :
false;
507 return (
m_pIOVSvc->regFcn(c1,c2,fcn,trigger) );
518 return (
m_pIOVSvc->regFcn(toolName,c2,fcn,trigger) );
527 auto out_buffer = std::string{};
528 auto out = std::back_inserter(out_buffer);
529 const std::string me = name();
530 std::format_to(out,
"{}: <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> \n", me);
531 std::format_to(out,
"{}: SGImplSvc()::dump() which is {} \n", me,
m_storeLoaded ?
"LOADED" :
"NOT LOADED");
536 for (; s_iter != s_end; ++s_iter)
539 CLID id = s_iter->first;
542 m_pCLIDSvc->getTypeNameOfID(
id, tname).ignore();
543 std::format_to(out,
"{}: Found {} {} for ClassID {} ({}): \n", me, nProxy, ((nProxy == 1) ?
"proxy" :
"proxies"),
id, tname);
549 while (p_iter != p_end) {
551 std::format_to(out,
"{}: flags: ({:7s}, {:8s}, {:6s}) --- data: {:10p} --- key: {}\n", me,
552 (dp.isValid() ?
"valid" :
"INVALID"),
553 (dp.isConst() ?
"locked" :
"UNLOCKED"),
554 (dp.isResetOnly() ?
"reset" :
"DELETE"),
555 dbg::ptr(dp.object()), p_iter->first);
559 std::format_to(out,
"{}: <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> \n", me);
586 StatusCode::SUCCESS :
596 StatusCode::SUCCESS :
605 warning() <<
"addSymLink: no target DataProxy found. Sorry, can't link to a non-existing data object"
607 return StatusCode::FAILURE;
609 StatusCode
sc =
m_pStore->addSymLink(linkid, dp);
613 if (
sc.isSuccess() && dp->object()) {
629 error() <<
"setAlias: problem setting alias "
631 <<
"DataObject does not exist, record before setting alias."
633 return StatusCode::FAILURE;
637 if (
sc.isFailure()) {
638 error() <<
"setAlias: problem setting alias "
640 <<
"DataObject does not exist, record before setting alias."
642 return StatusCode::FAILURE;
645 return StatusCode::SUCCESS;
650 const std::string& key,
const std::string& aKey)
657 error() <<
"setAlias: problem setting alias "
658 << std::string(aKey) <<
'\n'
659 <<
"DataObject does not exist, record before setting alias."
661 return StatusCode::FAILURE;
665 if (
sc.isFailure()) {
666 error() <<
"setAlias: problem setting alias "
667 << (std::string)aKey <<
'\n'
668 <<
"DataObject does not exist, record before setting alias."
670 return StatusCode::FAILURE;
673 return StatusCode::SUCCESS;
685 warning() <<
"addAlias: no target DataProxy given, Cannot alias to a non-existing object"
687 return StatusCode::FAILURE;
705 return (0 !=
proxy(
id, key,
true));
706 }
catch(...) {
return false; }
715 }
catch(...) {
return false; }
725 return m_pStore->locatePersistent(pTransient);
731 return proxy(
id,
false);
741 if (0 == dp && 0 !=
m_pPPS) {
743 dp =
m_pPPS->retrieveProxy(
id,
string(
"DEFAULT"), *pStore);
749 if (checkValid && 0 != dp) {
753 return dp->isValid() ? dp : 0;
761 return proxy(
id, key,
false);
772 if (!dp)
dbg::print(stderr,
"::SGImplSvc::proxy(name={}, key={}): data proxy is null, m_pPPS is {}\n", this->name(), key,
m_pPPS == 0 ?
"NULL" :
"NOT NULL");
774 if (0 == dp && 0 !=
m_pPPS) {
776 dp =
m_pPPS->retrieveProxy(
id, key, *pStore);
778 if (!dp)
dbg::print(stderr,
"::SGImplSvc::proxy(name={}, key={}): data proxy is still null\n", this->name(), key);
784 if (checkValid && 0 != dp && !(dp->isValid())) {
824 const std::string& key,
829 const void* raw_ptr = obj.get();
830 const std::type_info* tinfo =
nullptr;
833 raw_ptr = bucket->object();
834 tinfo = &bucket->tinfo();
837 if (returnExisting) {
844 if (
proxy->transientID (obj->clID())) {
848 std::string clidTypeName;
850 warning() <<
"SGImplSvc::recordObject: addAlias fails for object "
851 <<
clid <<
"[" << clidTypeName <<
"] " <<
proxy->name()
852 <<
" and new key " << key
859 else if (key ==
proxy->name() ||
proxy->hasAlias(key) > 0)
864 std::string clidTypeName;
866 CLID newclid = obj->clID();
867 std::string newclidTypeName;
868 m_pCLIDSvc->getTypeNameOfID(newclid, newclidTypeName).ignore();
869 error() <<
"SGImplSvc::recordObject: addSymLink fails for object "
870 <<
clid <<
"[" << clidTypeName <<
"] " <<
proxy->name()
871 <<
" and new clid " << newclid <<
"[" << newclidTypeName <<
"]"
879 std::string clidTypeName;
881 CLID newclid = obj->clID();
882 std::string newclidTypeName;
883 m_pCLIDSvc->getTypeNameOfID(newclid, newclidTypeName).ignore();
884 error() <<
"SGImplSvc::recordObject: existing object found with "
885 <<
clid <<
"[" << clidTypeName <<
"] " <<
proxy->name()
886 <<
" but neither clid " << newclid <<
"[" << newclidTypeName <<
"]"
887 <<
" nor key " << key <<
" match."
896 const bool resetOnly =
true;
897 const bool noHist =
false;
900 allowMods, resetOnly, noHist, tinfo,
901 &
proxy,
true).isFailure())
934std::vector<const SG::DataProxy*>
939 std::vector<const SG::DataProxy*> ret (
proxies.begin(),
proxies.end());
953 std::vector<CLID>
clids;
954 clids.reserve( distance( s_iter, s_end ) );
956 for (; s_iter != s_end; ++s_iter ) {
957 const CLID id = s_iter->first;
958 clids.push_back (
id);
970 return ( (0 != dp && dp->isValidObject()) ? dp : 0 );
978 return (0 == theProxy) ? 0 : theProxy->
accessData();
986 return (0 == theProxy) ? 0 : theProxy->
accessData();
991 const std::string& keyA,
const std::string& keyB )
994 const bool checkValid =
true;
997 if ( 0 ==
a || 0 == b ) {
return false; }
998 DataObject* objA =
a->accessData();
999 DataObject* objB = b->accessData();
1001 if ( 0 == objA || 0 == objB ) {
return false; }
1003 const unsigned int refCntA = objA->addRef();
1004 const unsigned int refCntB = objB->addRef();
1008 a->setObject( objA );
1009 b->setObject( objB );
1011 return ( (refCntA-1) == objA->release() &&
1012 (refCntB-1) == objB->release() );
1017 const void*
const raw_ptr,
1018 bool allowMods,
bool resetOnly,
bool noHist)
1020 return typeless_record (obj, key, raw_ptr, allowMods, resetOnly, noHist, 0,
1027 const void*
const raw_ptr,
1028 bool allowMods,
bool resetOnly,
bool noHist,
1029 const std::type_info* tinfo)
1031 return typeless_record (obj, key, raw_ptr, allowMods, resetOnly, noHist,tinfo,
1038 const void*
const raw_ptr,
1039 bool allowMods,
bool resetOnly,
bool noHist,
1040 const std::type_info* tinfo,
1046 record_impl( obj, key, raw_ptr, allowMods, resetOnly, !noOverwrite, tinfo);
1047 if (
proxy ==
nullptr )
1048 return StatusCode::FAILURE;
1053 return StatusCode::SUCCESS;
1057 return StatusCode::SUCCESS;
1059 return record_HistObj( obj->clID(), key, name(), allowMods, resetOnly );
1066 const std::string& key,
1067 const void*
const raw_ptr,
1070 const std::type_info* tinfo)
1073 StatusCode
sc(StatusCode::SUCCESS);
1075 if (0 != toRemove) {
1077 const bool FORCEREMOVE(
true);
1080 if (
sc.isSuccess()) {
1081 const bool ALLOWOVERWRITE(
true);
1082 const bool NORESET(
false);
1083 if (
record_impl( obj, key, raw_ptr, allowMods, NORESET, ALLOWOVERWRITE, tinfo) ==
nullptr)
1084 sc = StatusCode::FAILURE;
1094 toRemove->release();
1100 const void*
const raw_ptr,
1101 bool allowMods,
bool resetOnly,
bool allowOverwrite,
1102 const std::type_info* tinfo)
1105 std::string rawKey(key);
1113 const std::string& pTAName(dp->name());
1122 warning() <<
"record_impl: Could not setup alias key "
1124 <<
" for unversioned object " << pTAName
1139 if (!allowOverwrite &&
m_pPPS) {
1145 if (dp && dp->provider()) {
1146 std::string clidTypeName;
1148 warning() <<
"record_impl: you are recording an object with key "
1149 << rawKey <<
", type " << clidTypeName
1150 <<
" (CLID " <<
clid <<
')'
1151 <<
"\n There is already a persistent version of this object. Recording a duplicate may lead to unreproducible results and it is deprecated."
1159 std::string clidTypeName;
1161 warning() <<
"record_impl: failed for key="<< rawKey <<
", type "
1163 <<
" (CLID " <<
clid <<
')'
1164 <<
"\n object @" << raw_ptr
1165 <<
" already in store with key="<< dp->name()
1166 <<
". Will not record a duplicate! "
1168 if (pDObj != dp->object()) {
1170 if (!pDBB) std::abort();
1181 std::string clidTypeName;
1183 warning() <<
"record_impl: Problem setting up the proxy for object @"
1185 <<
"\n recorded with key " << rawKey
1186 <<
" of type " << clidTypeName
1187 <<
" (CLID " <<
clid <<
") in DataObject @" << pDObj
1194 if ( !(this->
t2pRegister( raw_ptr, dp )).isSuccess() ) {
1195 std::string clidTypeName;
1197 warning() <<
"record_impl: can not add to t2p map object @" <<raw_ptr
1198 <<
"\n with key " << rawKey
1199 <<
" of type " << clidTypeName
1200 <<
" (CLID " <<
clid <<
')'
1214 if (!(this->
addAlias(vk.
key(), dp)).isSuccess()) {
1215 warning() <<
"record_impl: Could not setup alias key " << vk.
key()
1216 <<
" for VersionedKey " << rawKey
1217 <<
". Generic access to this object with clid" <<
clid
1228 bool checkValid)
const
1232 if (checkValid && 0 != dp) {
1233 return dp->isValid() ? dp : 0;
1245 if (0 ==
proxy)
return StatusCode::FAILURE;
1249 if (bucket) pTrans = bucket->
object();
1257 if (
proxy->isValidObject()) {
1260 for (SG::DataProxy::CLIDCont_t::const_iterator i =
clids.begin();
1276 return m_pStore->t2pRegister(pTrans, pPers);
1290 updateMsgStreamOutputLevel( outputLevel() );
1291 msgSvc()->setOutputLevel(name(), outputLevel());
1299 return m_pStore->pRange(
id,begin,end);
1310 warning() <<
"setConst: NO Proxy for the dobj you want to set const"
1312 return StatusCode::FAILURE;
1316 return StatusCode::SUCCESS;
1334 const bool FORCEREMOVE(
true);
1363 if (dp ==
nullptr &&
m_pPPS !=
nullptr) {
1367 if (0 == dp)
return false;
1369 if (! dp->bindHandle(
ir) ) {
1370 fatal() <<
"DataHandle at " << hex <<
ir << dec
1371 <<
" already bound to DataProxy with key " <<
ir->key()
1372 <<
". Cannot bind to proxy " << dp->name() <<
" as well\n"
1373 <<
" You have probably registered multiple callbacks via regFcn with the same DataHandle using different keys (DataProxies)\n"
1381 SG_MSG_DEBUG(
" Bound handle " << MSG::hex <<
ir <<
" to proxy "
1396 if (
sc.isFailure())
return false;
1413 if (
sc.isFailure())
return false;
1415 if (
sc.isFailure())
return false;
1424 const std::string&
store,
1425 bool allowMods,
bool resetOnly) {
1431 StatusCode
sc =
m_pCLIDSvc->getTypeNameOfID(
id, idname);
1432 if (
sc.isFailure() || idname.empty() ) {
1433 idname = std::to_string(
id);
1440 const bool ALLOWOVERWRITE(
false);
1441 if (
record_impl(obj, idname, dho, allowMods, resetOnly, ALLOWOVERWRITE,
1442 &
typeid(DataHistory)) ==
nullptr)
1443 return StatusCode::FAILURE;
1444 return StatusCode::SUCCESS;
1507 const std::string&
str,
1513 const std::string* str2 =
m_stringpool.keyToString (key, clid2);
1515 <<
" maps to multiple string key/CLID pairs: "
1516 << *str2 <<
"/" << clid2 <<
" and "
1537 lock_t lock (other.m_stringPoolMutex);
1538 tmp = other.m_stringpool;
1549 if (0 != (pP =
proxy(
id, key))) {
1552 SG::DataProxy::CLIDCont_t::const_iterator i(
clids.begin()), e(
clids.end());
1558 pP->
reset (hard_reset);
1571 if (dp->isValidObject()) {
1573 SG::DataProxy::CLIDCont_t::const_iterator i(
clids.begin()), e(
clids.end());
1580 dp->reset (hard_reset);
1597 payload.target = target;
1598 payload.index_offset = index_offset;
1612 sgkey_t& sgkey_out,
size_t& index_out)
1615 SG::RemapImpl::remap_map_t::iterator i =
1620 sgkey_out = payload.target;
1621 index_out = index_in + payload.index_offset;
1627 const std::string& key)
1630 DataObject* obj =
nullptr;
1633 if (dp && dp->isValid()) {
1648 for ( ; s_iter != s_end; ++s_iter ) {
1649 if ( s_iter->second.find( key ) != s_iter->second.end() ) {
1650 return s_iter->first;
1661 std::vector<CLID>
clids;
1665 for ( ; s_iter != s_end; ++s_iter ) {
1666 if ( s_iter->second.find( key ) != s_iter->second.end() ) {
1667 clids.push_back(s_iter->first);
1679 const std::type_info* tinfo,
1696 const std::vector<CLID>& bases = bib->
get_bases();
1697 for ( std::size_t i = 0, iMax = bases.size(); i < iMax; ++i ) {
1698 if ( bases[i] !=
clid ) {
1699 if (
addSymLink( bases[i], dp ).isSuccess() ) {
1705 warning() <<
"record_impl: Doing auto-symlinks for object with CLID "
1707 <<
" and SG key " << key
1708 <<
": Proxy already set for base CLID " << bases[i]
1709 <<
"; not making auto-symlink." <<
endmsg;
1717 if (
m_pStore->addSymLink (copy_clid, dp).isFailure()) {
1718 warning() <<
"record_impl: Doing auto-symlinks for object with CLID "
1720 <<
" and SG key " << key
1721 <<
": Proxy already set for copy-conversion CLID "
1723 <<
"; not making auto-symlink." <<
endmsg;
1730 warning() <<
"record_impl: Could not find suitable SG::BaseInfoBase for CLID ["
1731 <<
clid <<
"] (" << key <<
") !\t"
1732 <<
"No auto-symlink established !"
1744 std::vector<IResetable*> handles;
1747 h->reset (hard_reset);
1772 std::vector<IResetable*>::iterator it =
1773 std::find (v.begin(), v.end(),
handle);
1801 IOpaqueAddress* addr,
1802 DataObject*& refpObject)
1809 return cvt->createObj (addr, refpObject);
1816 std::cout << sg->
dump() <<
"\n";
1820 std::ofstream f (fname);
1821 f << sg->
dump() <<
"\n";
1839 return dh->begin()->getToken()->dbID().toString();
1861 SG_MSG_DEBUG(
"retrieve(range): no object found "
1862 <<
" of type " << typnam
1863 <<
"(CLID " <<
clid <<
')');
1866 (ciend.
setState(end, end,
true)).ignore();
1868 if (!(cibegin.
setState(first, end,
true)).isSuccess()) {
1871 SG_MSG_DEBUG(
"retrieve(range): Can't initialize iterator for object range "
1872 <<
" of type " << typnam
1873 <<
"(CLID " <<
clid <<
')');
1874 return StatusCode::FAILURE;
1877 return StatusCode::SUCCESS;
1882 const std::string& key,
1889 if (ptr->hasStore())
return true;
1892 SG_MSG_VERBOSE(
"called associateAux_impl for key " + key);
1894 if (!ptr->hasStore()) {
1897 if (!dp->isConst()) {
1900 ptr->setStore (pAux);
1907 ptr->setStore (pAux);
1917 const std::string& key,
1921 SG_MSG_VERBOSE(
"called associateAux_impl for key " + key);
1923 if (!ptr->hasStore()) {
1926 if (!dp->isConst()) {
1929 ptr->setStore (pAux);
1936 ptr->setStore (pAux);
Manage index tracking and synchronization of auxiliary data.
a static registry of CLID->typeName entries.
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE(LVL)
Report a message.
#define CHECK(...)
Evaluate an expression and check for errors.
void swap(DataVector< T > &a, DataVector< T > &b)
See DataVector<T, BASE>::swap().
uint32_t CLID
The Class ID type.
Interface for non-const operations on an auxiliary store.
Interface for const operations on an auxiliary store.
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
void SG_dump(SGImplSvc *sg)
These are intended to be easy to call from the debugger.
defines a StoreGateSvc key with a version number
Incident sent after a store is cleared.
Maintain a mapping of strings to 64-bit ints.
Define macros for attributes used to control the static checker.
#define ATLAS_THREAD_SAFE
Header file for AthHistogramAlgorithm.
static const std::type_info * CLIDToTypeinfo(CLID clid)
Translate between CLID and type_info.
Simple smart pointer for Gaudi-style refcounted objects.
T * get()
Get the pointer.
A non-templated base class for DataBucket, allows to access the transient object address as a void*.
virtual void * object()=0
virtual void relinquish()=0
Give up ownership of the DataBucket contents.
StoreMap::const_iterator ConstStoreIterator
SG::sgkey_t sgkey_t
Type of the keys.
The Athena Transient Store API.
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.
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
virtual ~SGImplSvc() override final
Standard Destructor.
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.
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)
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.
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.
std::vector< CLID > clids(const std::string &key) const
Retrieve all the CLID s (including symlinks) of the object recorded in StoreGate with the given "key"...
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.
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
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
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
virtual StatusCode reinitialize() override final
Service reinitialization.
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
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.
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.
The non-template portion of the BaseInfo implementation.
static const BaseInfoBase * find(CLID clid)
Find the BaseInfoBase instance for clid.
const std::vector< CLID > & get_bases() const
Return the class IDs of all known bases of T (that have class IDs).
std::vector< CLID > get_copy_conversions() const
Return known copy conversions.
static IProxyDict * setStore(IProxyDict *store)
Set the current store.
bool transientID(CLID id) const
return the list of transient IDs (primary or symLinked):
void reset(bool hard=false)
Other methods of DataProxy (not in Interface IRegistry):
DataObject * accessData()
Access DataObject on-demand using conversion service.
TransientAddress::TransientClidSet CLIDCont_t
Hold DataProxy instances associated with a store.
int typeCount(const CLID &id) const
Count number of object of a given type in store.
StatusCode tRange(ConstStoreIterator &f, ConstStoreIterator &e) const
Return an iterator over the StoreMap:
virtual StoreID::type storeID() const override
void keys(const CLID &id, std::vector< std::string > &vkeys, bool includeAlias, bool onlyValid)
StoreMap::const_iterator ConstStoreIterator
void setStoreID(StoreID::type id)
const std::vector< DataProxy * > & proxies() const
All proxies managed by this store.
Interface for non-const operations on an auxiliary store.
Interface for const operations on an auxiliary store.
a StoreGateSvc key with a version number.
unsigned char version() const
static bool isVersionedKey(const char *)
quickly determine whether a string has the right format to be a VK
const std::string & rawVersionKey() const
static bool isAuto(const std::string &)
quickly determine whether a string has the right format to be a VK with auto-generated version #
const std::string & key() const
Implementation class, not to be used directly Iterates over valid proxies it the range.
StatusCode setState(SG::ConstProxyIterator itr, SG::ConstProxyIterator itrEnd, bool isConst)
Reset state of the iterator.
static StoreID::type findStoreID(const std::string &storeName)
int ir
counter of the current depth
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
DATA * DataProxy_cast(DataProxy *proxy)
cast the proxy into the concrete data object it proxies
CxxUtils::RefCountedPtr< T > DataObjectSharedPtr
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
ProxyMap::const_iterator ConstProxyIterator
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
std::unordered_map< sgkey_t, T > SGKeyMap
A map using sgkey_t as a key.
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)
SGKeyMap< remap_t > remap_map_t
IStringPool::sgkey_t sgkey_t