4 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
7/** @file StoreGateSvc.icc
10#ifndef STOREGATE_STOREGATESVC_ICC
11#define STOREGATE_STOREGATESVC_ICC
12#include "StoreGate/constraints/KeyConcept.h"
13#include "AthContainersInterfaces/AuxStore_traits.h"
14#include "AthenaKernel/ClassName.h"
15#include "CxxUtils/checker_macros.h"
18/// macro to help writing the function calls.
19/// first looks if there is a hive slot defined, otherwise forwards to the "serial" implementation
20#define _SGXCALL(FUN,ARGS,ONERR) \
21 SGImplSvc* impl = this->currentStore(); \
23 return impl->FUN ARGS; \
28/// macro to help writing the function calls
29#define _SGVOIDCALL(FUN,ARGS) \
30 SGImplSvc* impl = this->currentStore(); \
38StoreGateSvc::storeID() const
46StoreGateSvc::currentStore() const {
47 if (m_storeID == StoreID::EVENT_STORE) {
48 SG::HiveEventSlot* slot = currentSlot();
49 if (slot) return slot->pEvtStore;
51 return m_defaultStore;
57StoreGateSvc::proxy(const CLID& id, const char* key) const {
58 _SGXCALL( proxy, (id, key), 0 );
63StoreGateSvc::proxy_exact (SG::sgkey_t sgkey) const {
64 _SGXCALL( proxy_exact, (sgkey), 0 );
67template <typename H, typename TKEY>
69StoreGateSvc::regHandle ATLAS_NOT_THREAD_SAFE ( const DataHandle<H>& handle, const TKEY& key )
71 CLID clid = ClassID_traits<H>::ID();
72 IResetable *ir = const_cast<IResetable*> (static_cast<const IResetable*> (&handle));
73 SG::DataProxy *dp = 0;
75 bool ret = this->currentStore()->bindHandleToProxyAndRegister (clid, key, ir, dp);
77 return StatusCode::FAILURE;
80 return handle.setState(dp); // FIXME - should be retrieve?
83/// non-const method - will return an error
84template <typename H, typename TKEY>
86StoreGateSvc::regHandle( DataHandle<H>& /*handle*/, const TKEY& key)
88 error() << "regHandle(): DataHandle must be const: "
89 << ClassName<H>::name() << "[" + key + "]"
92 return StatusCode::FAILURE;
95///////////////////////////////////////////////////////////////////
96// create an object and record it with key
97//////////////////////////////////////////////////////////////////
98template <typename T, typename TKEY, typename... ARGS>
100StoreGateSvc::create(const TKEY& key, ARGS... constructorArgs) {
101 T* pT = new T(constructorArgs...);
102 if(!(this->record(pT, key).isSuccess())) {
103 error() << "create: problem recording created object @"
104 << pT << " using key " << key << endmsg;
105 pT=0; //record will take care of deleting pT even if it fails
109///////////////////////////////////////////////////////////////////
110// record an object with key
111//////////////////////////////////////////////////////////////////
112template <typename T, typename TKEY>
113StatusCode StoreGateSvc::record(T* pObject, const TKEY& key)
115 const bool ALLOWMODS(true);
116 return record(pObject, key, ALLOWMODS); //allow mods by default
118//-------------------------------------------------------------------
119template <typename T, typename TKEY>
120StatusCode StoreGateSvc::record(const T* pObject, const TKEY& key)
122 const bool NOMODS(false);
123 // Ok --- we hold objects as non-const pointers internally, but mark
124 // them as const, so they can only be retrieved as const.
125 T* pObject_nc ATLAS_THREAD_SAFE = const_cast<T*> (pObject);
126 return record(pObject_nc, key, NOMODS); // do not allow mods
129//-------------------------------------------------------------------
130template <typename T, typename TKEY>
131StatusCode StoreGateSvc::record(T* pObject, const TKEY& key,
132 bool allowMods, bool resetOnly, bool noHist)
134 return record1 (SG::asStorable<T>(pObject), pObject, key,
135 allowMods, resetOnly, noHist);
139//-------------------------------------------------------------------
142template <typename T, typename TKEY>
143StatusCode StoreGateSvc::record1(DataObject* obj,
144 T* pObject, const TKEY& key,
145 bool allowMods, bool resetOnly, bool noHist)
146requires KeyConcept<TKEY>
148 if (m_storeID == StoreID::EVENT_STORE && currentSlot() != nullptr) {
149 rememberBadRecord (ClassID_traits<T>::ID(), key);
152 // make sure the BaseInfo(Base) structure is initialized
153 SG::BaseInfo<T>::baseinfo();
155 // If s_isConst is set for this type, then we want to automatically
156 // make it const when recorded.
157 if (ClassID_traits<T>::s_isConst)
160 StatusCode sc = this->currentStore()->typeless_record( obj, key, pObject,
161 allowMods, resetOnly, noHist,
164 if (sc.isSuccess()) {
166 "Recorded object @" << pObject
167 << " with key " << (std::string)key
168 << " of type " << ClassID_traits<T>::typeName()
169 << "(CLID " << ClassID_traits<T>::ID()
170 << ")\n in DataObject @" << obj
171 << "\n object " << (allowMods ? "" : "not ")
172 << "modifiable when retrieved");
180//-------------------------------------------------------------------
183template <typename T, typename TKEY>
184StatusCode StoreGateSvc::overwrite1(DataObject* obj, T* pObject,
186 bool allowMods, bool noHist)
187requires KeyConcept<TKEY>
189 if (m_storeID == StoreID::EVENT_STORE && currentSlot() != nullptr) {
190 rememberBadRecord (ClassID_traits<T>::ID(), key);
193 // make sure the BaseInfo(Base) structure is initialized
194 SG::BaseInfo<T>::baseinfo();
196 // If s_isConst is set for this type, then we want to automatically
197 // make it const when recorded.
198 if (ClassID_traits<T>::s_isConst) allowMods = false;
200 StatusCode sc = this->currentStore()->typeless_overwrite(ClassID_traits<T>::ID(),
202 pObject, allowMods, noHist,
205 if (sc.isSuccess()) {
207 "overwrite: Recorded object @" << pObject
208 << " with key " << (std::string)key
209 << " of type " << ClassID_traits<T>::typeName()
210 << "(CLID " << ClassID_traits<T>::ID()
211 << ")\n in DataObject @" << obj
212 << "\n object " << (allowMods ? "" : "not ")
213 << "modifiable when retrieved");
219//////////////////////////////////////////////////////////////////
220// Retrieve the default object (with no key) as a const pointer
221//////////////////////////////////////////////////////////////////
223StatusCode StoreGateSvc::retrieve(const T*& ptr) const
225 if (m_storeID == StoreID::EVENT_STORE && currentSlot() != nullptr) {
226 rememberBadRetrieve (ClassID_traits<T>::ID(), "");
229 SG::DataProxy* dp =proxy(ClassID_traits<T>::ID());
230 if (!dp || !dp->isValid()) {
232 << "retrieve(default): No valid proxy for default object \n"
233 << " of type " << ClassID_traits<T>::typeName() << "(CLID "
234 << ClassID_traits<T>::ID() << ')' << endmsg;
235 return StatusCode::FAILURE;
237 ptr = SG::DataProxy_cast<T> (dp);
239 return StatusCode::FAILURE;
242 //for types with an associated store, try to retrieve it and associate it
243 this->associateAux (ptr, SG::DEFAULTKEY);
245 SG_MSG_DEBUG("retrieve(default): Retrieved const pointer to default object \n"
246 << " of type " << ClassID_traits<T>::typeName()
247 << "(CLID " << ClassID_traits<T>::ID() << ')');
250 return StatusCode::SUCCESS;
253//////////////////////////////////////////////////////////////////
254// Retrieve the default object (with no key) as a pointer (non-const)
255//////////////////////////////////////////////////////////////////
257StatusCode StoreGateSvc::retrieve(T*& ptr) const
259 if (m_storeID == StoreID::EVENT_STORE && currentSlot() != nullptr) {
260 rememberBadRetrieve (ClassID_traits<T>::ID(), "");
263 SG::DataProxy* dp =proxy(ClassID_traits<T>::ID());
264 if (!dp || !dp->isValid() || dp->isConst()) {
266 << "retrieve(default): No valid proxy for default object "
267 << " of type " << ClassID_traits<T>::typeName() << "(CLID "
268 << ClassID_traits<T>::ID() << ")\n Try to use a const retrieve "
270 return StatusCode::FAILURE;
272 ptr = SG::DataProxy_cast<T> (dp);
274 return StatusCode::FAILURE;
277 //for types with an associated store, try to retrieve it and associate it
278 this->associateAux (ptr, SG::DEFAULTKEY);
280 SG_MSG_DEBUG("retrieve(default): Retrieved non-const pointer to default object \n"
281 << " of type " << ClassID_traits<T>::typeName()
282 << "(CLID " << ClassID_traits<T>::ID() << ')');
285 return StatusCode::SUCCESS;
288//////////////////////////////////////////////////////////////////
289// Retrieve the keyed object as a const pointer
290// Overload for std::string key type
291//////////////////////////////////////////////////////////////////
293StatusCode StoreGateSvc::retrieve(const T*& ptr, const std::string& key) const
295 if (m_storeID == StoreID::EVENT_STORE && currentSlot() != nullptr) {
296 rememberBadRetrieve (ClassID_traits<T>::ID(), key);
299 SG::DataProxy* dp =proxy (ClassID_traits<T>::ID(),
302 if (!dp || !dp->isValid()) {
304 << "retrieve(const): No valid proxy for object " << key << ' '
305 << " of type " << ClassID_traits<T>::typeName() << "(CLID "
306 << ClassID_traits<T>::ID() << ')' << endmsg;
307 return StatusCode::FAILURE;
309 ptr = SG::DataProxy_cast<T> (dp);
311 return StatusCode::FAILURE;
314 //for types with an associated store, try to retrieve it and associate it
315 this->associateAux (ptr, key);
317 SG_MSG_DEBUG( "Retrieved const pointer to object " << key << ' '
318 << " of type " << ClassID_traits<T>::typeName()
319 << "(CLID " << ClassID_traits<T>::ID() << ')');
322 return StatusCode::SUCCESS;
325//////////////////////////////////////////////////////////////////
326// Retrieve the keyed object as a const pointer
327//////////////////////////////////////////////////////////////////
328template <typename T, typename TKEY>
329StatusCode StoreGateSvc::retrieve(const T*& ptr, const TKEY& key) const
330requires KeyConcept<TKEY>
332 return this->retrieve(ptr, static_cast<std::string>(key));
335//////////////////////////////////////////////////////////////////
336// Retrieve the keyed object as a non-const pointer
337// Overload for std::string key type
338//////////////////////////////////////////////////////////////////
340StatusCode StoreGateSvc::retrieve(T*& ptr, const std::string& key) const
342 if (m_storeID == StoreID::EVENT_STORE && currentSlot() != nullptr) {
343 rememberBadRetrieve (ClassID_traits<T>::ID(), key);
346 SG::DataProxy* dp =proxy (ClassID_traits<T>::ID(),
349 if (!dp || !dp->isValid() || dp->isConst()) {
350 SG_MSG_WARNING("retrieve(non-const): No valid proxy for object "
352 << " of type " << ClassID_traits<T>::typeName() << "(CLID "
353 << ClassID_traits<T>::ID()
354 << ") \n Try to use a const retrieve" );
355 return StatusCode::FAILURE;
357 ptr = SG::DataProxy_cast<T> (dp);
359 return StatusCode::FAILURE;
362 //for types with an associated store, try to retrieve it and associate it
363 this->associateAux (ptr, key);
365 SG_MSG_DEBUG("Retrieved non-const pointer to object " << (std::string)key
366 << ' ' << " of type " << ClassID_traits<T>::typeName()
367 << "(CLID " << ClassID_traits<T>::ID() << ')');
370 return StatusCode::SUCCESS;
373//////////////////////////////////////////////////////////////////
374// Retrieve the keyed object as a non-const pointer
375//////////////////////////////////////////////////////////////////
376template <typename T, typename TKEY>
377StatusCode StoreGateSvc::retrieve(T*& ptr, const TKEY& key) const
378requires KeyConcept<TKEY>
380 return this->retrieve(ptr, static_cast<std::string>(key));
383/// Retrieve all objects of type T: returns an SG::ConstIterator range
386StoreGateSvc::retrieve(SG::ConstIterator<T>& begin,
387 SG::ConstIterator<T>& end) const {
388 if (m_storeID == StoreID::EVENT_STORE && currentSlot() != nullptr) {
389 rememberBadRetrieve (ClassID_traits<T>::ID(), "(iterator)");
391 _SGXCALL(retrieve, (ClassID_traits<T>::ID(), begin, end), StatusCode::FAILURE);
396 * @brief Retrieve an object of type @c T from StoreGate.
397 * Return 0 if not found.
401T* StoreGateSvc::retrieve () const
404 retrieve (p).ignore();
409 * @brief Retrieve an object of type @c T from StoreGate.
410 * Return 0 if not found.
411 * @param key The key to use for the lookup.
413template <typename T, class TKEY>
414T* StoreGateSvc::retrieve (const TKEY& key) const
417 retrieve (p, key).ignore();
422 * @brief Retrieve an object of type @c T from StoreGate.
423 * Return 0 if not found.
426T* StoreGateSvc::tryRetrieve () const
428 if (m_storeID == StoreID::EVENT_STORE && currentSlot() != nullptr) {
429 rememberBadRetrieve (ClassID_traits<T>::ID(), "");
432 SG::DataProxy* dp = proxy (ClassID_traits<T>::ID());
433 if (dp && dp->isValid() && !dp->isConst()) {
434 T* ptr = SG::DataProxy_cast<T> (dp);
436 this->associateAux (ptr, SG::DEFAULTKEY);
444const T* StoreGateSvc::tryConstRetrieve() const
446 if (m_storeID == StoreID::EVENT_STORE && currentSlot() != nullptr) {
447 rememberBadRetrieve (ClassID_traits<T>::ID(), "");
450 SG::DataProxy* dp = proxy (ClassID_traits<T>::ID());
451 if (dp && dp->isValid()) {
452 const T* ptr = SG::DataProxy_cast<T> (dp);
454 this->associateAux (ptr, SG::DEFAULTKEY);
462 * @brief Retrieve an object of type @c T from StoreGate.
463 * Return 0 if not found. Don't print any WARNINGs
464 * @param key The key to use for the lookup.
466template <typename T, class TKEY>
467T* StoreGateSvc::tryRetrieve (const TKEY& key) const
468requires KeyConcept<TKEY>
470 if (m_storeID == StoreID::EVENT_STORE && currentSlot() != nullptr) {
471 rememberBadRetrieve (ClassID_traits<T>::ID(), key);
473 SG::DataProxy* dp = proxy (ClassID_traits<T>::ID(),
474 static_cast<std::string> (key),
476 if (dp && dp->isValid() && !dp->isConst()) {
477 T* ptr = SG::DataProxy_cast<T> (dp);
479 this->associateAux (ptr, key);
486template <typename T, class TKEY>
487const T* StoreGateSvc::tryConstRetrieve (const TKEY& key) const
488requires KeyConcept<TKEY>
490 if (m_storeID == StoreID::EVENT_STORE && currentSlot() != nullptr) {
491 rememberBadRetrieve (ClassID_traits<T>::ID(), key);
494 SG::DataProxy* dp = proxy (ClassID_traits<T>::ID(),
495 static_cast<std::string> (key),
497 if (dp && dp->isValid()) {
498 const T* ptr = SG::DataProxy_cast<T> (dp);
500 this->associateAux (ptr, key);
508int StoreGateSvc::typeCount() const
510 return typeCount(ClassID_traits<T>::ID());
514template <typename T, typename TKEY>
516StoreGateSvc::contains(const TKEY& key) const
518 return this->contains(ClassID_traits<T>::ID(), key);
521template <typename TKEY>
523StoreGateSvc::contains(const CLID& clid, const TKEY& key) const
525 _SGXCALL( contains, (clid,key), false );
528template <typename T, typename TKEY>
530StoreGateSvc::transientContains(const TKEY& key) const
532 return transientContains(ClassID_traits<T>::ID(), key);
537template <typename TKEY>
539StoreGateSvc::transientContains(const CLID& id, const TKEY& key) const
541 _SGXCALL(transientContains, (id, key), false);
544//-------------------------end of contains methods--------------------
547StoreGateSvc::keys(std::vector<std::string>& vkeys,
548 bool includeAlias, bool onlyValid) const {
549 return this->keys(ClassID_traits<T>::ID(), vkeys, includeAlias, onlyValid);
553template <typename T, typename TKEY>
555StoreGateSvc::bind ATLAS_NOT_THREAD_SAFE (const DataHandle<T>& handle, const TKEY& key) {
556 CLID clid = ClassID_traits<T>::ID();
557 IResetable *ir = const_cast<IResetable*> (static_cast<const IResetable*> (&handle));
558 SG::DataProxy *dp = 0;
559 bool ret = this->currentStore()->bindHandleToProxy (clid, key, ir, dp);
561 return StatusCode::FAILURE;
564 return handle.setState(dp); // FIXME - should be retrieve?
567//-------------------------------------------------------------------
568template <typename T, typename TKEY>
569StatusCode StoreGateSvc::record(std::unique_ptr<T> pUnique, const TKEY& key)
571 const bool ALLOWMODS(true);
572 return record(std::move(pUnique), key, ALLOWMODS); //allow mods by default
574//-------------------------------------------------------------------
575template <typename T, typename TKEY>
576StatusCode StoreGateSvc::record(std::unique_ptr<const T> pUnique,
579 const bool NOMODS(false);
580 // Ok --- we hold objects as non-const pointers internally, but mark
581 // them as const, so they can only be retrieved as const.
582 T* ptr ATLAS_THREAD_SAFE = const_cast<T*> (pUnique.release());
583 return record1(SG::asStorable (ptr), ptr,
584 key, NOMODS); // do not allow mods
587//-------------------------------------------------------------------
588template <typename T, typename TKEY>
589StatusCode StoreGateSvc::record(std::unique_ptr<T> pUnique, const TKEY& key,
590 bool allowMods, bool resetOnly, bool noHist)
592 T* ptr = pUnique.get();
593 return record1 (SG::asStorable<T>(std::move(pUnique)), ptr, key,
594 allowMods, resetOnly, noHist);
597template <typename T, typename TKEY>
598StatusCode StoreGateSvc::overwrite(T* p2BRegistered, const TKEY& key)
600 const bool ALLOWMODS(true);
601 return overwrite(p2BRegistered, key, ALLOWMODS); //SG takes ownership
604template <typename T, typename TKEY>
606StoreGateSvc::overwrite(T* pObject, const TKEY& key,
607 bool allowMods, bool noHist)
609 return overwrite1 (SG::asStorable<T>(pObject), pObject, key,
613template <typename T, typename TKEY>
614StatusCode StoreGateSvc::overwrite(std::unique_ptr<T> pUnique, const TKEY& key)
616 const bool ALLOWMODS(true);
617 return overwrite(std::move(pUnique), key, ALLOWMODS); //allow mods by default
620template <typename T, typename TKEY>
621StatusCode StoreGateSvc::overwrite(std::unique_ptr<T> pUnique, const TKEY& key,
622 bool allowMods, bool noHist)
624 T* ptr = pUnique.get();
625 return overwrite1 (SG::asStorable<T>(std::move(pUnique)), ptr, key,
629template <typename T, typename AKEY>
630StatusCode StoreGateSvc::setAlias(const T* pObject, const AKEY& aKey)
631requires KeyConcept<AKEY>
633 _SGXCALL(setAlias, (pObject, aKey), StatusCode::FAILURE);
635//-------------------------------------------------------------------
636template <typename T, typename TKEY, typename AKEY>
638StoreGateSvc::setAlias(const T* /*dummy*/,
639 const TKEY& key, const AKEY& aKey)
640requires KeyConcept<TKEY> && KeyConcept<AKEY>
642 _SGXCALL(setAlias, (ClassID_traits<T>::ID(), key, aKey), StatusCode::FAILURE);
647StoreGateSvc::setAlias(SG::DataProxy* proxy, const std::string& aliasKey)
649 _SGXCALL(setAlias, (proxy, aliasKey), StatusCode::FAILURE);
652//////////////////////////////////////////////////////////////////
653// Make a soft link to the object with key: return non_const link
654//////////////////////////////////////////////////////////////////
655template <typename T, typename TLINK>
657StoreGateSvc::symLink(const T* pObject, TLINK* /*dummy*/)
659 _SGXCALL(symLink, (pObject, ClassID_traits<TLINK>::ID()), StatusCode::FAILURE);
662//////////////////////////////////////////////////////////////////
663// Make a soft link to the object with key: set const link
664//////////////////////////////////////////////////////////////////
665template <typename T, typename TLINK>
667StoreGateSvc::symLink(const T* pObject, const TLINK* /*dummy*/)
669 _SGXCALL(symLink, (pObject, ClassID_traits<TLINK>::ID()), StatusCode::FAILURE);
672template <KeyConcept TKEY>
674StoreGateSvc::symLink(const CLID id, const TKEY& key, const CLID linkid)
676 _SGXCALL(symLink, (id, key, linkid), StatusCode::FAILURE);
680/// Remove pObject, will remove its proxy if not reset only.
683StoreGateSvc::remove(const T* pObject) {
684 _SGXCALL(remove, (pObject), StatusCode::FAILURE);
687/// Remove pObject and its proxy no matter what.
690StoreGateSvc::removeDataAndProxy(const T* pObject) {
691 _SGXCALL(removeDataAndProxy, (pObject), StatusCode::FAILURE);
694template <typename T, class TKEY>
696StoreGateSvc::retrieveHighestVersion(SG::ObjectWithVersion<T>& dobjWithVersion,
697 const TKEY& requestedKey) const
699 std::list< SG::ObjectWithVersion<T> > allVersions;
700 StatusCode sc(this->retrieveAllVersions(allVersions,requestedKey));
701 if (sc.isSuccess()) {
702 allVersions.sort(); // on highest version number
703 dobjWithVersion.versionedKey.copyVK(allVersions.back().versionedKey.rawVersionKey());
708template <typename T, class TKEY>
710StoreGateSvc::retrieveAllVersions(std::list< SG::ObjectWithVersion<T> >& allVersions,
711 const TKEY& requestedKey) const
713 StatusCode sc(StatusCode::FAILURE);
714 SG::ConstIterator<T> i,e;
715 if ((this->retrieve<T>(i,e)).isSuccess()){
716 SG::VersionedKey reqVK(requestedKey);
718 SG::VersionedKey vk(i.key());
719 if (reqVK.sameKey(vk)) {
720 sc = StatusCode::SUCCESS;
721 SG::ObjectWithVersion<T> okOWV(vk, i.proxy());
722 allVersions.push_back(okOWV);
733StoreGateSvc::retrieveUniquePrivateCopy (const std::string& key)
735 CLID clid = ClassID_traits<T>::ID();
736 DataObject* obj = this->currentStore()->typeless_retrievePrivateCopy(clid, key);
737 std::unique_ptr<T> ret (SG::Storable_cast<T>(obj));
738 if (DataBucketBase* dbb = dynamic_cast<DataBucketBase*> (obj))
746//////////////////////////////////////////////////////////////////
747// Retrieve the @c CLID of a given "key"
749//////////////////////////////////////////////////////////////////
750template<typename TKEY>
752StoreGateSvc::clid( const TKEY& key ) const
754 _SGXCALL(clid, (key), CLID_NULL);
757//////////////////////////////////////////////////////////////////
758// Retrieve the @c CLID s of a given "key"
760//////////////////////////////////////////////////////////////////
761template<typename TKEY>
763StoreGateSvc::clids( const TKEY& key ) const
765 std::vector<CLID> nullV;
766 _SGXCALL(clids, (key), nullV);
769///////////////////////////////////////////////////////////////////////////
773StoreGateSvc::setProxyProviderSvc(IProxyProviderSvc* pPPSvc) {
774 _SGVOIDCALL(setProxyProviderSvc, (pPPSvc));
780StoreGateSvc::proxyProviderSvc() {
781 _SGXCALL(proxyProviderSvc, (), nullptr);
786 * @brief Return the metadata source ID for the current event slot.
787 * @param key SG key of the DataHeader to query.
788 * Returns an empty string if no source has been set.
790 * The default version always returns an empty string.
794StoreGateSvc::sourceID (const std::string& key /*= "EventSelector"*/) const {
795 _SGXCALL(sourceID, (key), "");
801StoreGateSvc::remap (CLID clid,
804 off_t index_offset) {
805 _SGVOIDCALL(remap_impl, (this->stringToKey (source, clid),
806 this->stringToKey (target, clid),
812 * @brief Remember that retrieve() was called for a MT store.
813 * @param clid CLID of the operation.
814 * @param key Key of the operation.
817void StoreGateSvc::rememberBadRetrieve (CLID clid, const std::string& key) const
819 rememberBad (m_badRetrieves, clid, key);
824 * @brief Remember that retrieve() was called for a MT store.
825 * @param clid CLID of the operation.
826 * @param key Key of the operation.
829void StoreGateSvc::rememberBadRecord (CLID clid, const std::string& key) const
831 rememberBad (m_badRecords, clid, key);
835template <class DOBJ, class AUXSTORE>
836bool StoreGateSvc::associateAux_impl (DOBJ* ptr,
837 const std::string& key,
838 const AUXSTORE*) const
840 CLID auxclid = ClassID_traits<AUXSTORE>::ID();
841 _SGXCALL( associateAux_impl, (ptr, key, auxclid), false);
846bool StoreGateSvc::associateAux_impl (DOBJ* /*ptr*/,
847 const std::string& /*key*/,
848 const SG::NoAuxStore*) const
855 * @brief associate a data object to its auxiliary store
856 * Return false if the aux store is not found.
857 * @param key The key to use for the lookup.
860bool StoreGateSvc::associateAux (DOBJ* ptr,
861 const std::string& key,
862 bool ignoreMissing) const
864 typename SG::AuxStore_traits<DOBJ>::type* pDummy(0); //used to pass down auxstore type
865 bool hasAux=associateAux_impl(ptr, key, pDummy) || ignoreMissing;
866 if (!hasAux) SG_MSG_WARNING("associateAux const: Could not associate AuxStore of type "
867 << SG::AuxStore_traits<DOBJ>::const_typeName()
868 << "\n to object of type " << ClassID_traits<DOBJ>::typeName() << "(CLID "
869 << ClassID_traits<DOBJ>::ID() << ") with key " << key << endmsg);
875bool StoreGateSvc::associateAux (const DOBJ* ptr,
876 const std::string& key,
877 bool ignoreMissing) const
879 typename SG::AuxStore_traits<DOBJ>::const_type* pDummy(0); //used to pass down auxstore type
880 // Should generally be ok, since any actual modification is done
881 // inside the store lock. Still kind of a wart that we still do this, though.
882 DOBJ* ptr_nc ATLAS_THREAD_SAFE = const_cast<DOBJ*> (ptr);
883 bool hasAux=associateAux_impl(ptr_nc, key, pDummy) || ignoreMissing;
884 if (!hasAux) SG_MSG_WARNING("associateAux const: Could not associate AuxStore of type "
885 << SG::AuxStore_traits<DOBJ>::const_typeName()
886 << "\n to object of type " << ClassID_traits<DOBJ>::typeName() << "(CLID "
887 << ClassID_traits<DOBJ>::ID() << ") with key " << key << endmsg);
892#endif //STOREGATE_STOREGATESVC_ICC