2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5 * @file StoreGate/WriteHandle.icc
6 * @author S. Binet, P. Calafiura, scott snyder <snyder@bnl.gov>
7 * @date Updated: Feb, 2016
8 * @brief Handle class for recording to StoreGate.
11#ifndef STOREGATE_SG_WRITEHANDLE_ICC
12#define STOREGATE_SG_WRITEHANDLE_ICC 1
15#include "StoreGate/exceptions.h"
16#include "AthenaKernel/ClassID_traits.h"
17#include "AthenaKernel/errorcheck.h"
24//************************************************************************
30 * @brief Default constructor.
32 * The handle will not be usable until a non-blank key is assigned.
36WriteHandle<T>::WriteHandle()
37 : VarHandleBase(ClassID_traits<T>::ID(), Gaudi::DataHandle::Writer)
43 * @brief Constructor specifying the key as a string.
44 * @param sgkey StoreGate key of the referenced object.
45 * @param storename Name of the referenced event store.
49WriteHandle<T>::WriteHandle (const std::string& sgkey,
50 const std::string& storename /* ="StoreGateSvc"*/)
51 : VarHandleBase (ClassID_traits<T>::ID(), sgkey,
52 Gaudi::DataHandle::Writer, storename, nullptr)
58 * @brief Constructor specifying the key as a string, with context.
59 * @param sgkey StoreGate key of the referenced object.
60 * @param ctx The event context.
64WriteHandle<T>::WriteHandle(const std::string& sgkey, const EventContext& ctx)
65 : WriteHandle(sgkey, StoreID::storeName(StoreID::EVENT_STORE), ctx)
71 * @brief Constructor specifying the key as a string, with data store.
72 * @param sgkey StoreGate key of the referenced object.
73 * @param sg Data store.
77WriteHandle<T>::WriteHandle(const std::string& sgkey, IProxyDict* sg)
78 : VarHandleBase(ClassID_traits<T>::ID(), sgkey, Gaudi::DataHandle::Writer, sg)
80 // cppcheck-suppress missingReturn; false positive
85 * @brief Constructor specifying the key as a string, with context.
86 * @param sgkey StoreGate key of the referenced object.
87 * @param storename Name of the referenced event store.
88 * @param ctx The event context.
92WriteHandle<T>::WriteHandle(const std::string& sgkey,
93 const std::string& storename,
94 const EventContext& ctx)
95 : VarHandleBase( ClassID_traits<T>::ID(),
96 sgkey, Gaudi::DataHandle::Writer, storename, &ctx )
102 * @brief Constructor from a WriteHandleKey.
103 * @param key The key object holding the clid/key/store.
105 * This will raise an exception if the StoreGate key is blank,
106 * or if the event store cannot be found.
110WriteHandle<T>::WriteHandle (const WriteHandleKey<T>& key)
111 : VarHandleBase (key, nullptr)
117 * @brief Constructor from a WriteHandleKey and an explicit event context.
118 * @param key The key object holding the clid/key.
119 * @param ctx The event context.
121 * This will raise an exception if the StoreGate key is blank,
122 * or if the event store cannot be found.
124 * If the default event store has been requested, then the thread-specific
125 * store from the event context will be used.
129WriteHandle<T>::WriteHandle (const WriteHandleKey<T>& key,
130 const EventContext& ctx)
131 : VarHandleBase (key, &ctx)
133 // cppcheck-suppress missingReturn; false positive
138 * @brief Copy constructor.
142WriteHandle<T>::WriteHandle(const WriteHandle& h)
149 * @brief Move constructor.
152WriteHandle<T>::WriteHandle(WriteHandle&& h) noexcept
153 : VarHandleBase(std::move(h))
155 m_lockAuxPending = h.m_lockAuxPending;
156 h.m_lockAuxPending = nullptr;
161 * @brief Assignment operator.
166// m_lockAuxPending not copied --- want lifetime to stay with the
168// cppcheck-suppress operatorEqVarError
169WriteHandle<T>::operator= (const WriteHandle& h)
172 this->VarHandleBase::operator=(h);
178 * @brief Move operator.
183WriteHandle<T>::operator= (WriteHandle&& h) noexcept
186 this->VarHandleBase::operator=(std::move(h));
187 m_lockAuxPending = h.m_lockAuxPending;
188 h.m_lockAuxPending = nullptr;
197 * Lock an aux object if m_lockAuxPending is true.
200WriteHandle<T>::~WriteHandle()
202 if (m_lockAuxPending) {
203 m_lockAuxPending->setConst();
208//************************************************************************
209// Deference. These all return only the cached pointer.
214 * @brief Dereference the pointer.
215 * Returns the cached pointer. Throws ExcNullWriteHandle if null.
219typename WriteHandle<T>::pointer_type
220WriteHandle<T>::operator->()
222 return WriteHandle<T>::checkedCachedPtr();
227 * @brief Dereference the pointer.
228 * Returns the cached pointer. Throws ExcNullWriteHandle if null.
232typename WriteHandle<T>::reference_type
233WriteHandle<T>::operator*()
235 return *WriteHandle<T>::checkedCachedPtr();
240 * @brief Dereference the pointer.
241 * Returns the cached pointer.
245typename WriteHandle<T>::const_pointer_type
246WriteHandle<T>::cptr() const
248 return reinterpret_cast<pointer_type>(this->m_ptr);
253 * @brief Dereference the pointer.
254 * Returns the cached pointer.
258typename WriteHandle<T>::pointer_type
266 * @brief Return the cached pointer directly; no lookup.
270typename WriteHandle<T>::pointer_type
271WriteHandle<T>::cachedPtr()
273 return reinterpret_cast<pointer_type>(this->m_ptr);
278 * @brief Can the handle be successfully dereferenced?
282bool WriteHandle<T>::isValid()
284 return this->m_ptr != nullptr;
288//************************************************************************
293 * @brief Record a const object to the store.
294 * @param data The object to record.
299WriteHandle<T>::WriteHandle::record (std::unique_ptr<T> data)
301 return this->doRecord (std::move(data), true, false);
306 * @brief Record a non-const object to the store.
307 * @param data The object to record.
308 * @param isConst If true, record the object as const.
313WriteHandle<T>::WriteHandle::recordNonConst (std::unique_ptr<T> data)
315 return this->doRecord (std::move(data), false, false);
320 * @brief Record a const object and its auxiliary store to the store.
321 * @param data The object to record.
322 * @param auxstore Auxiliary store object.
325template <class AUXSTORE>
328WriteHandle<T>::WriteHandle::record (std::unique_ptr<T> data,
329 std::unique_ptr<AUXSTORE> auxstore)
331 return record (std::move(data), std::move(auxstore), true);
336 * @brief Record a non-const object and its auxiliary store to the store.
337 * @param data The object to record.
338 * @param auxstore Auxiliary store object.
341template <class AUXSTORE>
344WriteHandle<T>::WriteHandle::recordNonConst (std::unique_ptr<T> data,
345 std::unique_ptr<AUXSTORE> auxstore)
347 return record (std::move(data), std::move(auxstore), false);
352 * @brief Record a const shared DataObject to the store.
353 * @param data The object to record.
355 * The event store takes shared ownership of the object.
358template <std::derived_from<DataObject> DOBJ>
359requires std::convertible_to<DOBJ*, T*>
362WriteHandle<T>::record (SG::DataObjectSharedPtr<DOBJ> data)
364 return this->doRecord (std::move(data), true, false);
369 * @brief Record a non-const shared DataObject to the store.
370 * @param data The object to record.
372 * The event store takes shared ownership of the object.
375template <std::derived_from<DataObject> DOBJ>
376requires std::convertible_to<DOBJ*, T*>
379WriteHandle<T>::recordNonConst (SG::DataObjectSharedPtr<DOBJ> data)
381 return this->doRecord (std::move(data), false, false);
386 * @brief Record an object to the store.
387 * @param data The object to record.
388 * @param returnExisting Allow an existing object?
390 * Unlike record(), this does not change the handle object.
391 * That means that one will not be able to get the object back
392 * by dereferencing the handle.
393 * Returns the object placed in the store, or nullptr if there
395 * If there was already an object in the store with the given key,
396 * then return null, unless @c returnExisting is true, in which case
397 * return success. In either case, @c data is destroyed.
401typename WriteHandle<T>::const_pointer_type
402WriteHandle<T>::put (std::unique_ptr<T> data,
403 bool returnExisting /*= false*/) const
405 IProxyDict* store = nullptr;
406 return doPut (nullptr, std::move(data), returnExisting, store);
411 * @brief Record an object to the store.
412 * @param data The object to record.
413 * @param returnExisting Allow an existing object?
415 * Unlike record(), this does not change the handle object.
416 * That means that one will not be able to get the object back
417 * by dereferencing the handle.
418 * Returns the object placed in the store, or nullptr if there
420 * If there was already an object in the store with the given key,
421 * then return null, unless @c returnExisting is true, in which case
422 * return success. In either case, @c data is destroyed.
426typename WriteHandle<T>::const_pointer_type
427WriteHandle<T>::put (std::unique_ptr<const T> data,
428 bool returnExisting /*= false*/) const
430 IProxyDict* store = nullptr;
431 return doPut (nullptr, std::move(data), returnExisting, store);
436 * @brief Record an object to the store.
437 * @param data The object to record.
438 * @param returnExisting Allow an existing object?
440 * Unlike record(), this does not change the handle object.
441 * That means that one will not be able to get the object back
442 * by dereferencing the handle.
443 * Returns the object placed in the store, or nullptr if there
445 * If there was already an object in the store with the given key,
446 * then return null, unless @c returnExisting is true, in which case
447 * return success. In either case, @c data is destroyed.
451typename WriteHandle<T>::const_pointer_type
452WriteHandle<T>::put (std::unique_ptr<const ConstDataVector<T> > data,
453 bool returnExisting /*= false*/) const
455 IProxyDict* store = nullptr;
456 std::unique_ptr<const T> coll (data.release()->asDataVector());
457 return doPut (nullptr, std::move(coll), returnExisting, store);
462 * @brief Record an object to the store.
463 * @param ctx The event context to use.
464 * @param data The object to record.
465 * @param returnExisting Allow an existing object?
467 * Unlike record(), this does not change the handle object.
468 * That means that one will not be able to get the object back
469 * by dereferencing the handle.
470 * Returns the object placed in the store, or nullptr if there
472 * If there was already an object in the store with the given key,
473 * then return null, unless @c returnExisting is true, in which case
474 * return success. In either case, @c data is destroyed.
478typename WriteHandle<T>::const_pointer_type
479WriteHandle<T>::put (const EventContext& ctx,
480 std::unique_ptr<const ConstDataVector<T> > data,
481 bool returnExisting /*= false*/) const
483 IProxyDict* store = nullptr;
484 std::unique_ptr<const T> coll (data.release()->asDataVector());
485 return doPut (&ctx, std::move(coll), returnExisting, store);
490 * @brief Record an object to the store.
491 * @param ctx The event context to use.
492 * @param data The object to record.
493 * @param returnExisting Allow an existing object?
495 * Unlike record(), this does not change the handle object.
496 * That means that one will not be able to get the object back
497 * by dereferencing the handle.
498 * Returns the object placed in the store, or nullptr if there
500 * If there was already an object in the store with the given key,
501 * then return null, unless @c returnExisting is true, in which case
502 * return success. In either case, @c data is destroyed.
506typename WriteHandle<T>::const_pointer_type
507WriteHandle<T>::put (const EventContext& ctx,
508 std::unique_ptr<T> data,
509 bool returnExisting /*= false*/) const
511 IProxyDict* store = nullptr;
512 return doPut (&ctx, std::move(data), returnExisting, store);
517 * @brief Record an object to the store.
518 * @param ctx The event context to use.
519 * @param data The object to record.
520 * @param returnExisting Allow an existing object?
522 * Unlike record(), this does not change the handle object.
523 * That means that one will not be able to get the object back
524 * by dereferencing the handle.
525 * Returns the object placed in the store, or nullptr if there
527 * If there was already an object in the store with the given key,
528 * then return null, unless @c returnExisting is true, in which case
529 * return success. In either case, @c data is destroyed.
533typename WriteHandle<T>::const_pointer_type
534WriteHandle<T>::put (const EventContext& ctx,
535 std::unique_ptr<const T> data,
536 bool returnExisting /*= false*/) const
538 IProxyDict* store = nullptr;
539 return doPut (&ctx, std::move(data), returnExisting, store);
544 * @brief Record an object to the store.
545 * @param data The object to record.
547 * Unlike record(), this does not change the handle object.
548 * That means that one will not be able to get the object back
549 * by dereferencing the handle.
550 * Returns the object placed in the store, or nullptr if there
553 * The event store takes shared ownership of the object.
556template <std::derived_from<DataObject> DOBJ>
557requires std::convertible_to<DOBJ*, T*>
559typename WriteHandle<T>::const_pointer_type
560WriteHandle<T>::put (SG::DataObjectSharedPtr<DOBJ> data) const
562 IProxyDict* store = nullptr;
563 return doPut (nullptr, std::move(data), false, store);
568 * @brief Record an object to the store.
569 * @param ctx The event context to use.
570 * @param data The object to record.
572 * Unlike record(), this does not change the handle object.
573 * That means that one will not be able to get the object back
574 * by dereferencing the handle.
575 * Returns the object placed in the store, or nullptr if there
578 * The event store takes shared ownership of the object.
581template <std::derived_from<DataObject> DOBJ>
582requires std::convertible_to<DOBJ*, T*>
584typename WriteHandle<T>::const_pointer_type
585WriteHandle<T>::put (const EventContext& ctx,
586 SG::DataObjectSharedPtr<DOBJ> data) const
588 IProxyDict* store = nullptr;
589 return doPut (&ctx, std::move(data), false, store);
594 * @brief Record an object and its auxiliary store to the store.
595 * @param data The object to record.
596 * @param auxstore Auxiliary store object.
598 * Unlike record(), this does not change the handle object.
599 * That means that one will not be able to get the object back
600 * by dereferencing the handle.
601 * Returns the object placed in the store, or nullptr if there
603 * If there was already an object in the store with the given key,
604 * then return null, and the objects passed in are destroyed.
607template <class AUXSTORE>
608typename WriteHandle<T>::const_pointer_type
609WriteHandle<T>::put (std::unique_ptr<T> data,
610 std::unique_ptr<AUXSTORE> auxstore) const
612 return doPut (nullptr, std::move(data), std::move(auxstore));
618 * @brief Record an object and its auxiliary store to the store.
619 * @param data The object to record.
620 * @param auxstore Auxiliary store object.
622 * Unlike record(), this does not change the handle object.
623 * That means that one will not be able to get the object back
624 * by dereferencing the handle.
625 * Returns the object placed in the store, or nullptr if there
627 * If there was already an object in the store with the given key,
628 * then return null, and the objects passed in are destroyed.
630 * Unlike the version taking unique_ptr<T>, this does not alter the
631 * store pointer of @c data.
634template <class AUXSTORE>
635typename WriteHandle<T>::const_pointer_type
636WriteHandle<T>::put (std::unique_ptr<const T> data,
637 std::unique_ptr<const AUXSTORE> auxstore) const
639 return doPut (nullptr, std::move(data), std::move(auxstore));
644 * @brief Record an object and its auxiliary store to the store.
645 * @param ctx The event context to use.
646 * @param data The object to record.
647 * @param auxstore Auxiliary store object.
649 * Unlike record(), this does not change the handle object.
650 * That means that one will not be able to get the object back
651 * by dereferencing the handle.
652 * Returns the object placed in the store, or nullptr if there
654 * If there was already an object in the store with the given key,
655 * then return null, and the objects passed in are destroyed.
658template <class AUXSTORE>
659typename WriteHandle<T>::const_pointer_type
660WriteHandle<T>::put (const EventContext& ctx,
661 std::unique_ptr<T> data,
662 std::unique_ptr<AUXSTORE> auxstore) const
664 return doPut (&ctx, std::move(data), std::move(auxstore));
669 * @brief Record an object and its auxiliary store to the store.
670 * @param ctx The event context to use.
671 * @param data The object to record.
672 * @param auxstore Auxiliary store object.
674 * Unlike record(), this does not change the handle object.
675 * That means that one will not be able to get the object back
676 * by dereferencing the handle.
677 * Returns the object placed in the store, or nullptr if there
679 * If there was already an object in the store with the given key,
680 * then return null, and the objects passed in are destroyed.
682 * Unlike the version taking unique_ptr<T>, this does not alter the
683 * store pointer of @c data.
686template <class AUXSTORE>
687typename WriteHandle<T>::const_pointer_type
688WriteHandle<T>::put (const EventContext& ctx,
689 std::unique_ptr<const T> data,
690 std::unique_ptr<const AUXSTORE> auxstore) const
692 return doPut (&ctx, std::move(data), std::move(auxstore));
697 * @brief Alternate notation for record. Records a non-const object.
698 * @param data Object to record.
700 * Throws an exception on failure.
704WriteHandle<T>::operator= (std::unique_ptr<T> data)
706 if (recordNonConst (std::move(data)).isFailure()) {
707 throw std::runtime_error ("WriteHandle<T>::operator=(unique_ptr) Record failed.");
714 * @brief Make an alias.
715 * @param key Alternate key by which the referenced object should be known.
717 * The current handle should be valid and referencing an object
718 * (i.e., @c record should have been called on it).
720 * The object will also be known by the name given in @c key.
723StatusCode WriteHandle<T>::alias (const WriteHandleKey<T>& key)
725 return symLink_impl (this->clid(), key.key());
730 * @brief Make an explicit link.
731 * @param key Alternate clid by which the referenced object
732 * should be known. The SG key must match the key of the
735 * You should generally not be using this!
737 * The current handle should be valid and referencing an object
738 * (i.e., @c record should have been called on it).
740 * This makes a symlink: the object will be retrievable
741 * as a different type.
743 * Note that if @c T and @c @U are related via @c SG_BASE and/or
744 * @c DATAVECTOR_BASE, then you shouldn't need to explicitly make a symlink;
745 * that should happen automatically.
747 * If a @c U* is not convertable to a @c T* via C++ rules, then you likely
748 * will be, at best, relying on undefined behavior. You will probably
749 * get warnings from the undefined behavior sanitizer when if you try
750 * to dereference the @c U*.
752 * This usage is here mainly to assist in migrating some existing
753 * patterns to MT. You should think several times before using
758StatusCode WriteHandle<T>::symLink (const WriteHandleKey<U>& other)
760 if (this->key() != other.key()) {
761 REPORT_ERROR (StatusCode::FAILURE)
762 << "symLink: SG keys do not match: " << other.key() << " vs "
764 return StatusCode::FAILURE;
766 return symLink_impl (other.clid(), other.key());
771 * @brief Return the cached pointer directly.
773 * If it is null, throw ExcNullWriteHandle.
776typename WriteHandle<T>::pointer_type
777WriteHandle<T>::checkedCachedPtr()
780 throwExcNullWriteHandle (clid(), key(), store());
786 * @brief Helper for record.
787 * @param data The object to record.
788 * @param isConst If true, record the object as const.
789 * @param returnExisting Allow an existing object.
793StatusCode WriteHandle<T>::doRecord (U data,
797 typedef typename U::element_type elt_t;
799 // make sure the BaseInfo(Base) structure is initialized
800 SG::BaseInfo<elt_t>::baseinfo();
802 // If s_isConst is set for this type, then we want to automatically
803 // make it const when recorded.
804 bool allowMods = !isConst;
805 if (ClassID_traits<elt_t>::s_isConst)
808 void* dataPtr(data.get());
809 std::unique_ptr<DataObject> dobj (SG::asStorable (std::move (data)));
810 return this->record_impl (std::move(dobj), dataPtr, allowMods, returnExisting);
815 * @brief Helper for put.
816 * @param ctx The event context, or nullptr to use the current context.
817 * @param data The object to record.
818 * @param returnExisting Allow an existing object.
819 * @param[out] store The store being used.
821 * Unlike record(), this does not change the handle object.
822 * That means that will not be able to get the object back
823 * by dereferencing the handle.
824 * Returns the object placed in the store, or nullptr if there
826 * If there was already an object in the store with the given key,
827 * then return null, unless @c returnExisting is true, in which case
828 * return success. In either case, @c data is destroyed.
832typename WriteHandle<T>::const_pointer_type
833WriteHandle<T>::doPut (const EventContext* ctx,
836 IProxyDict* & store) const
838 //typedef typename U::element_type elt_t;
841 // make sure the BaseInfo(Base) structure is initialized
842 SG::BaseInfo<elt_t>::baseinfo();
844 const void* dataPtr = data.get();
845 std::unique_ptr<DataObject> dobj (SG::asStorable (std::move (data)));
846 return reinterpret_cast<const T*>
847 (this->put_impl (ctx, std::move(dobj), dataPtr, false, returnExisting, store));
852 * @brief Helper for recording an object and its auxiliary store to the store.
853 * @param ctx The event context, or nullptr to use the current context.
854 * @param data The object to record.
855 * @param auxstore Auxiliary store object.
857 * Unlike record(), this does not change the handle object.
858 * That means that will not be able to get the object back
859 * by dereferencing the handle.
860 * Returns the object placed in the store, or nullptr if there
862 * If there was already an object in the store with the given key,
863 * then return null, and the objects passed in are destroyed.
866template <class AUXSTORE>
867typename WriteHandle<T>::const_pointer_type
868WriteHandle<T>::doPut (const EventContext* ctx,
869 std::unique_ptr<T> data,
870 std::unique_ptr<AUXSTORE> auxstore) const
874 // If there's no store association, do it now.
875 if (data->getStore() == nullptr)
876 data->setStore (auxstore.get());
878 IProxyDict* store = nullptr;
879 const T* ptr = this->doPut (ctx, std::move(data), false, store);
880 if (!ptr) return nullptr;
882 SG::DataObjectSharedPtr<DataObject> dobj
883 (SG::asStorable (std::move (auxstore)));
884 SG::DataProxy* proxy = store->recordObject (std::move(dobj),
885 this->name() + "Aux.",
889 REPORT_ERROR (StatusCode::FAILURE)
890 << "recordObject of aux store failed";
892 // If we've failed here, then the aux store object has been deleted,
893 // but not the primary object. Null out the store pointer to prevent
894 // having a dangling pointer to a deleted object.
895 dref.setStore (static_cast<SG::IConstAuxStore*>(nullptr));
904 * @brief Helper for recording an object and its auxiliary store to the store.
905 * @param ctx The event context, or nullptr to use the current context.
906 * @param data The object to record.
907 * @param auxstore Auxiliary store object.
909 * Unlike record(), this does not change the handle object.
910 * That means that will not be able to get the object back
911 * by dereferencing the handle.
912 * Returns the object placed in the store, or nullptr if there
914 * If there was already an object in the store with the given key,
915 * then return null, and the objects passed in are destroyed.
918template <class AUXSTORE>
919typename WriteHandle<T>::const_pointer_type
920WriteHandle<T>::doPut (const EventContext* ctx,
921 std::unique_ptr<const T> data,
922 std::unique_ptr<const AUXSTORE> auxstore) const
924 IProxyDict* store = nullptr;
925 const T* ptr = this->doPut (ctx, std::move(data), false, store);
926 if (!ptr) return nullptr;
928 SG::DataObjectSharedPtr<DataObject> dobj
929 (SG::asStorable (std::move (auxstore)));
930 SG::DataProxy* proxy = store->recordObject (std::move(dobj),
931 this->name() + "Aux.",
935 REPORT_ERROR (StatusCode::FAILURE)
936 << "recordObject of aux store failed";
945 * @brief Record an object and its auxiliary store to the store.
946 * @param data The object to record.
947 * @param auxstore Auxiliary store object.
948 * @param isConst If true, record the objects as const.
951template <class AUXSTORE>
953WriteHandle<T>::record (std::unique_ptr<T> data,
954 std::unique_ptr<AUXSTORE> auxstore,
959 // If there's no store association, do it now.
960 if (data->getStore() == nullptr)
961 data->setStore (auxstore.get());
964 // Temporarily clear the store association, in order to prevent
965 // the aux store from being locked at this point.
966 IAuxStore* store = dref.getStore();
968 dref.setStore (static_cast<SG::IAuxStore*>(nullptr));
969 CHECK (this->record(std::move(data)));
970 // Deliberately not using RAII here. If there is an error,
971 // then the object referenced by data will be deleted.
972 dref.setStore (store);
975 CHECK (this->recordNonConst(std::move(data)));
977 // Store and proxy must be valid if we get to this point.
979 SG::DataObjectSharedPtr<DataObject> dobj
980 (SG::asStorable (std::move (auxstore)));
981 SG::DataProxy* proxy = m_store->recordObject (std::move(dobj),
982 this->name() + "Aux.",
986 REPORT_ERROR (StatusCode::FAILURE)
987 << "recordObject of aux store failed";
989 // If we've failed here, then the aux store object has been deleted,
990 // but not the primary object. Null out the store pointer to prevent
991 // having a dangling pointer to a deleted object.
992 dref.setStore (static_cast<SG::IConstAuxStore*>(nullptr));
993 return StatusCode::FAILURE;
996 if (m_proxy->isConst())
997 m_lockAuxPending = proxy;
999 return StatusCode::SUCCESS;
1004 * @brief Return a @c WriteHandle referencing @c key.
1005 * @param key The key object holding the clid/key/store.
1007 * This will raise an exception if the StoreGate key is blank,
1008 * or if the event store cannot be found.
1011WriteHandle<T> makeHandle (const WriteHandleKey<T>& key)
1013 return WriteHandle<T> (key);
1018 * @brief Return a @c WriteHandle referencing @c key for an explicit context.
1019 * @param key The key object holding the clid/key/store.
1020 * @param ctx The event context.
1022 * This will raise an exception if the StoreGate key is blank,
1023 * or if the event store cannot be found.
1025 * If the default event store has been requested, then the thread-specific
1026 * store from the event context will be used.
1029WriteHandle<T> makeHandle (const WriteHandleKey<T>& key,
1030 const EventContext& ctx)
1032 return WriteHandle<T> (key, ctx);
1039#endif //> !STOREGATE_SG_WRITEHANDLE_ICC