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)
84 * @brief Constructor specifying the key as a string, with context.
85 * @param sgkey StoreGate key of the referenced object.
86 * @param storename Name of the referenced event store.
87 * @param ctx The event context.
91WriteHandle<T>::WriteHandle(const std::string& sgkey,
92 const std::string& storename,
93 const EventContext& ctx)
94 : VarHandleBase( ClassID_traits<T>::ID(),
95 sgkey, Gaudi::DataHandle::Writer, storename, &ctx )
101 * @brief Constructor from a WriteHandleKey.
102 * @param key The key object holding the clid/key/store.
104 * This will raise an exception if the StoreGate key is blank,
105 * or if the event store cannot be found.
109WriteHandle<T>::WriteHandle (const WriteHandleKey<T>& key)
110 : VarHandleBase (key, nullptr)
116 * @brief Constructor from a WriteHandleKey and an explicit event context.
117 * @param key The key object holding the clid/key.
118 * @param ctx The event context.
120 * This will raise an exception if the StoreGate key is blank,
121 * or if the event store cannot be found.
123 * If the default event store has been requested, then the thread-specific
124 * store from the event context will be used.
128WriteHandle<T>::WriteHandle (const WriteHandleKey<T>& key,
129 const EventContext& ctx)
130 : VarHandleBase (key, &ctx)
132 // cppcheck-suppress missingReturn; false positive
137 * @brief Copy constructor.
141WriteHandle<T>::WriteHandle(const WriteHandle& h)
148 * @brief Move constructor.
151WriteHandle<T>::WriteHandle(WriteHandle&& h) noexcept
152 : VarHandleBase(std::move(h))
154 m_lockAuxPending = h.m_lockAuxPending;
155 h.m_lockAuxPending = nullptr;
160 * @brief Assignment operator.
165// m_lockAuxPending not copied --- want lifetime to stay with the
167// cppcheck-suppress operatorEqVarError
168WriteHandle<T>::operator= (const WriteHandle& h)
171 this->VarHandleBase::operator=(h);
177 * @brief Move operator.
182WriteHandle<T>::operator= (WriteHandle&& h) noexcept
185 this->VarHandleBase::operator=(std::move(h));
186 m_lockAuxPending = h.m_lockAuxPending;
187 h.m_lockAuxPending = nullptr;
196 * Lock an aux object if m_lockAuxPending is true.
199WriteHandle<T>::~WriteHandle()
201 if (m_lockAuxPending) {
202 m_lockAuxPending->setConst();
207//************************************************************************
208// Deference. These all return only the cached pointer.
213 * @brief Dereference the pointer.
214 * Returns the cached pointer. Throws ExcNullWriteHandle if null.
218typename WriteHandle<T>::pointer_type
219WriteHandle<T>::operator->()
221 return WriteHandle<T>::checkedCachedPtr();
226 * @brief Dereference the pointer.
227 * Returns the cached pointer. Throws ExcNullWriteHandle if null.
231typename WriteHandle<T>::reference_type
232WriteHandle<T>::operator*()
234 return *WriteHandle<T>::checkedCachedPtr();
239 * @brief Dereference the pointer.
240 * Returns the cached pointer.
244typename WriteHandle<T>::const_pointer_type
245WriteHandle<T>::cptr() const
247 return reinterpret_cast<pointer_type>(this->m_ptr);
252 * @brief Dereference the pointer.
253 * Returns the cached pointer.
257typename WriteHandle<T>::pointer_type
265 * @brief Return the cached pointer directly; no lookup.
269typename WriteHandle<T>::pointer_type
270WriteHandle<T>::cachedPtr()
272 return reinterpret_cast<pointer_type>(this->m_ptr);
277 * @brief Can the handle be successfully dereferenced?
281bool WriteHandle<T>::isValid()
283 return this->m_ptr != nullptr;
287//************************************************************************
292 * @brief Record a const object to the store.
293 * @param data The object to record.
298WriteHandle<T>::WriteHandle::record (std::unique_ptr<T> data)
300 return this->doRecord (std::move(data), true, false);
305 * @brief Record a non-const object to the store.
306 * @param data The object to record.
307 * @param isConst If true, record the object as const.
312WriteHandle<T>::WriteHandle::recordNonConst (std::unique_ptr<T> data)
314 return this->doRecord (std::move(data), false, false);
319 * @brief Record a const object and its auxiliary store to the store.
320 * @param data The object to record.
321 * @param auxstore Auxiliary store object.
324template <class AUXSTORE>
327WriteHandle<T>::WriteHandle::record (std::unique_ptr<T> data,
328 std::unique_ptr<AUXSTORE> auxstore)
330 return record (std::move(data), std::move(auxstore), true);
335 * @brief Record a non-const object and its auxiliary store to the store.
336 * @param data The object to record.
337 * @param auxstore Auxiliary store object.
340template <class AUXSTORE>
343WriteHandle<T>::WriteHandle::recordNonConst (std::unique_ptr<T> data,
344 std::unique_ptr<AUXSTORE> auxstore)
346 return record (std::move(data), std::move(auxstore), false);
351 * @brief Record a const shared DataObject to the store.
352 * @param data The object to record.
354 * The event store takes shared ownership of the object.
357template <std::derived_from<DataObject> DOBJ>
358requires std::convertible_to<DOBJ*, T*>
361WriteHandle<T>::record (SG::DataObjectSharedPtr<DOBJ> data)
363 return this->doRecord (std::move(data), true, false);
368 * @brief Record a non-const shared DataObject to the store.
369 * @param data The object to record.
371 * The event store takes shared ownership of the object.
374template <std::derived_from<DataObject> DOBJ>
375requires std::convertible_to<DOBJ*, T*>
378WriteHandle<T>::recordNonConst (SG::DataObjectSharedPtr<DOBJ> data)
380 return this->doRecord (std::move(data), false, false);
385 * @brief Record an object to the store.
386 * @param data The object to record.
387 * @param returnExisting Allow an existing object?
389 * Unlike record(), this does not change the handle object.
390 * That means that one will not be able to get the object back
391 * by dereferencing the handle.
392 * Returns the object placed in the store, or nullptr if there
394 * If there was already an object in the store with the given key,
395 * then return null, unless @c returnExisting is true, in which case
396 * return success. In either case, @c data is destroyed.
400typename WriteHandle<T>::const_pointer_type
401WriteHandle<T>::put (std::unique_ptr<T> data,
402 bool returnExisting /*= false*/) const
404 IProxyDict* store = nullptr;
405 return doPut (nullptr, std::move(data), returnExisting, store);
410 * @brief Record an object to the store.
411 * @param data The object to record.
412 * @param returnExisting Allow an existing object?
414 * Unlike record(), this does not change the handle object.
415 * That means that one will not be able to get the object back
416 * by dereferencing the handle.
417 * Returns the object placed in the store, or nullptr if there
419 * If there was already an object in the store with the given key,
420 * then return null, unless @c returnExisting is true, in which case
421 * return success. In either case, @c data is destroyed.
425typename WriteHandle<T>::const_pointer_type
426WriteHandle<T>::put (std::unique_ptr<const T> data,
427 bool returnExisting /*= false*/) const
429 IProxyDict* store = nullptr;
430 return doPut (nullptr, std::move(data), returnExisting, store);
435 * @brief Record an object to the store.
436 * @param data The object to record.
437 * @param returnExisting Allow an existing object?
439 * Unlike record(), this does not change the handle object.
440 * That means that one will not be able to get the object back
441 * by dereferencing the handle.
442 * Returns the object placed in the store, or nullptr if there
444 * If there was already an object in the store with the given key,
445 * then return null, unless @c returnExisting is true, in which case
446 * return success. In either case, @c data is destroyed.
450typename WriteHandle<T>::const_pointer_type
451WriteHandle<T>::put (std::unique_ptr<const ConstDataVector<T> > data,
452 bool returnExisting /*= false*/) const
454 IProxyDict* store = nullptr;
455 std::unique_ptr<const T> coll (data.release()->asDataVector());
456 return doPut (nullptr, std::move(coll), returnExisting, store);
461 * @brief Record an object to the store.
462 * @param ctx The event context to use.
463 * @param data The object to record.
464 * @param returnExisting Allow an existing object?
466 * Unlike record(), this does not change the handle object.
467 * That means that one will not be able to get the object back
468 * by dereferencing the handle.
469 * Returns the object placed in the store, or nullptr if there
471 * If there was already an object in the store with the given key,
472 * then return null, unless @c returnExisting is true, in which case
473 * return success. In either case, @c data is destroyed.
477typename WriteHandle<T>::const_pointer_type
478WriteHandle<T>::put (const EventContext& ctx,
479 std::unique_ptr<const ConstDataVector<T> > data,
480 bool returnExisting /*= false*/) const
482 IProxyDict* store = nullptr;
483 std::unique_ptr<const T> coll (data.release()->asDataVector());
484 return doPut (&ctx, std::move(coll), returnExisting, store);
489 * @brief Record an object to the store.
490 * @param ctx The event context to use.
491 * @param data The object to record.
492 * @param returnExisting Allow an existing object?
494 * Unlike record(), this does not change the handle object.
495 * That means that one will not be able to get the object back
496 * by dereferencing the handle.
497 * Returns the object placed in the store, or nullptr if there
499 * If there was already an object in the store with the given key,
500 * then return null, unless @c returnExisting is true, in which case
501 * return success. In either case, @c data is destroyed.
505typename WriteHandle<T>::const_pointer_type
506WriteHandle<T>::put (const EventContext& ctx,
507 std::unique_ptr<T> data,
508 bool returnExisting /*= false*/) const
510 IProxyDict* store = nullptr;
511 return doPut (&ctx, std::move(data), returnExisting, store);
516 * @brief Record an object to the store.
517 * @param ctx The event context to use.
518 * @param data The object to record.
519 * @param returnExisting Allow an existing object?
521 * Unlike record(), this does not change the handle object.
522 * That means that one will not be able to get the object back
523 * by dereferencing the handle.
524 * Returns the object placed in the store, or nullptr if there
526 * If there was already an object in the store with the given key,
527 * then return null, unless @c returnExisting is true, in which case
528 * return success. In either case, @c data is destroyed.
532typename WriteHandle<T>::const_pointer_type
533WriteHandle<T>::put (const EventContext& ctx,
534 std::unique_ptr<const T> data,
535 bool returnExisting /*= false*/) const
537 IProxyDict* store = nullptr;
538 return doPut (&ctx, std::move(data), returnExisting, store);
543 * @brief Record an object to the store.
544 * @param data The object to record.
546 * Unlike record(), this does not change the handle object.
547 * That means that one will not be able to get the object back
548 * by dereferencing the handle.
549 * Returns the object placed in the store, or nullptr if there
552 * The event store takes shared ownership of the object.
555template <std::derived_from<DataObject> DOBJ>
556requires std::convertible_to<DOBJ*, T*>
558typename WriteHandle<T>::const_pointer_type
559WriteHandle<T>::put (SG::DataObjectSharedPtr<DOBJ> data) const
561 IProxyDict* store = nullptr;
562 return doPut (nullptr, std::move(data), false, store);
567 * @brief Record an object to the store.
568 * @param ctx The event context to use.
569 * @param data The object to record.
571 * Unlike record(), this does not change the handle object.
572 * That means that one will not be able to get the object back
573 * by dereferencing the handle.
574 * Returns the object placed in the store, or nullptr if there
577 * The event store takes shared ownership of the object.
580template <std::derived_from<DataObject> DOBJ>
581requires std::convertible_to<DOBJ*, T*>
583typename WriteHandle<T>::const_pointer_type
584WriteHandle<T>::put (const EventContext& ctx,
585 SG::DataObjectSharedPtr<DOBJ> data) const
587 IProxyDict* store = nullptr;
588 return doPut (&ctx, std::move(data), false, store);
593 * @brief Record an object and its auxiliary store to the store.
594 * @param data The object to record.
595 * @param auxstore Auxiliary store object.
597 * Unlike record(), this does not change the handle object.
598 * That means that one will not be able to get the object back
599 * by dereferencing the handle.
600 * Returns the object placed in the store, or nullptr if there
602 * If there was already an object in the store with the given key,
603 * then return null, and the objects passed in are destroyed.
606template <class AUXSTORE>
607typename WriteHandle<T>::const_pointer_type
608WriteHandle<T>::put (std::unique_ptr<T> data,
609 std::unique_ptr<AUXSTORE> auxstore) const
611 return doPut (nullptr, std::move(data), std::move(auxstore));
617 * @brief Record an object and its auxiliary store to the store.
618 * @param data The object to record.
619 * @param auxstore Auxiliary store object.
621 * Unlike record(), this does not change the handle object.
622 * That means that one will not be able to get the object back
623 * by dereferencing the handle.
624 * Returns the object placed in the store, or nullptr if there
626 * If there was already an object in the store with the given key,
627 * then return null, and the objects passed in are destroyed.
629 * Unlike the version taking unique_ptr<T>, this does not alter the
630 * store pointer of @c data.
633template <class AUXSTORE>
634typename WriteHandle<T>::const_pointer_type
635WriteHandle<T>::put (std::unique_ptr<const T> data,
636 std::unique_ptr<const AUXSTORE> auxstore) const
638 return doPut (nullptr, std::move(data), std::move(auxstore));
643 * @brief Record an object and its auxiliary store to the store.
644 * @param ctx The event context to use.
645 * @param data The object to record.
646 * @param auxstore Auxiliary store object.
648 * Unlike record(), this does not change the handle object.
649 * That means that one will not be able to get the object back
650 * by dereferencing the handle.
651 * Returns the object placed in the store, or nullptr if there
653 * If there was already an object in the store with the given key,
654 * then return null, and the objects passed in are destroyed.
657template <class AUXSTORE>
658typename WriteHandle<T>::const_pointer_type
659WriteHandle<T>::put (const EventContext& ctx,
660 std::unique_ptr<T> data,
661 std::unique_ptr<AUXSTORE> auxstore) const
663 return doPut (&ctx, std::move(data), std::move(auxstore));
668 * @brief Record an object and its auxiliary store to the store.
669 * @param ctx The event context to use.
670 * @param data The object to record.
671 * @param auxstore Auxiliary store object.
673 * Unlike record(), this does not change the handle object.
674 * That means that one will not be able to get the object back
675 * by dereferencing the handle.
676 * Returns the object placed in the store, or nullptr if there
678 * If there was already an object in the store with the given key,
679 * then return null, and the objects passed in are destroyed.
681 * Unlike the version taking unique_ptr<T>, this does not alter the
682 * store pointer of @c data.
685template <class AUXSTORE>
686typename WriteHandle<T>::const_pointer_type
687WriteHandle<T>::put (const EventContext& ctx,
688 std::unique_ptr<const T> data,
689 std::unique_ptr<const AUXSTORE> auxstore) const
691 return doPut (&ctx, std::move(data), std::move(auxstore));
696 * @brief Alternate notation for record. Records a non-const object.
697 * @param data Object to record.
699 * Throws an exception on failure.
703WriteHandle<T>::operator= (std::unique_ptr<T> data)
705 if (recordNonConst (std::move(data)).isFailure()) {
706 throw std::runtime_error ("WriteHandle<T>::operator=(unique_ptr) Record failed.");
713 * @brief Make an alias.
714 * @param key Alternate key by which the referenced object should be known.
716 * The current handle should be valid and referencing an object
717 * (i.e., @c record should have been called on it).
719 * The object will also be known by the name given in @c key.
722StatusCode WriteHandle<T>::alias (const WriteHandleKey<T>& key)
724 return symLink_impl (this->clid(), key.key());
729 * @brief Make an explicit link.
730 * @param key Alternate clid by which the referenced object
731 * should be known. The SG key must match the key of the
734 * You should generally not be using this!
736 * The current handle should be valid and referencing an object
737 * (i.e., @c record should have been called on it).
739 * This makes a symlink: the object will be retrievable
740 * as a different type.
742 * Note that if @c T and @c @U are related via @c SG_BASE and/or
743 * @c DATAVECTOR_BASE, then you shouldn't need to explicitly make a symlink;
744 * that should happen automatically.
746 * If a @c U* is not convertable to a @c T* via C++ rules, then you likely
747 * will be, at best, relying on undefined behavior. You will probably
748 * get warnings from the undefined behavior sanitizer when if you try
749 * to dereference the @c U*.
751 * This usage is here mainly to assist in migrating some existing
752 * patterns to MT. You should think several times before using
757StatusCode WriteHandle<T>::symLink (const WriteHandleKey<U>& other)
759 if (this->key() != other.key()) {
760 REPORT_ERROR (StatusCode::FAILURE)
761 << "symLink: SG keys do not match: " << other.key() << " vs "
763 return StatusCode::FAILURE;
765 return symLink_impl (other.clid(), other.key());
770 * @brief Return the cached pointer directly.
772 * If it is null, throw ExcNullWriteHandle.
775typename WriteHandle<T>::pointer_type
776WriteHandle<T>::checkedCachedPtr()
779 throwExcNullWriteHandle (clid(), key(), store());
785 * @brief Helper for record.
786 * @param data The object to record.
787 * @param isConst If true, record the object as const.
788 * @param returnExisting Allow an existing object.
792StatusCode WriteHandle<T>::doRecord (U data,
796 typedef typename U::element_type elt_t;
798 // make sure the BaseInfo(Base) structure is initialized
799 SG::BaseInfo<elt_t>::baseinfo();
801 // If s_isConst is set for this type, then we want to automatically
802 // make it const when recorded.
803 bool allowMods = !isConst;
804 if (ClassID_traits<elt_t>::s_isConst)
807 void* dataPtr(data.get());
808 std::unique_ptr<DataObject> dobj (SG::asStorable (std::move (data)));
809 return this->record_impl (std::move(dobj), dataPtr, allowMods, returnExisting);
814 * @brief Helper for put.
815 * @param ctx The event context, or nullptr to use the current context.
816 * @param data The object to record.
817 * @param returnExisting Allow an existing object.
818 * @param[out] store The store being used.
820 * Unlike record(), this does not change the handle object.
821 * That means that will not be able to get the object back
822 * by dereferencing the handle.
823 * Returns the object placed in the store, or nullptr if there
825 * If there was already an object in the store with the given key,
826 * then return null, unless @c returnExisting is true, in which case
827 * return success. In either case, @c data is destroyed.
831typename WriteHandle<T>::const_pointer_type
832WriteHandle<T>::doPut (const EventContext* ctx,
835 IProxyDict* & store) const
837 //typedef typename U::element_type elt_t;
840 // make sure the BaseInfo(Base) structure is initialized
841 SG::BaseInfo<elt_t>::baseinfo();
843 const void* dataPtr = data.get();
844 std::unique_ptr<DataObject> dobj (SG::asStorable (std::move (data)));
845 return reinterpret_cast<const T*>
846 (this->put_impl (ctx, std::move(dobj), dataPtr, false, returnExisting, store));
851 * @brief Helper for recording an object and its auxiliary store to the store.
852 * @param ctx The event context, or nullptr to use the current context.
853 * @param data The object to record.
854 * @param auxstore Auxiliary store object.
856 * Unlike record(), this does not change the handle object.
857 * That means that will not be able to get the object back
858 * by dereferencing the handle.
859 * Returns the object placed in the store, or nullptr if there
861 * If there was already an object in the store with the given key,
862 * then return null, and the objects passed in are destroyed.
865template <class AUXSTORE>
866typename WriteHandle<T>::const_pointer_type
867WriteHandle<T>::doPut (const EventContext* ctx,
868 std::unique_ptr<T> data,
869 std::unique_ptr<AUXSTORE> auxstore) const
873 // If there's no store association, do it now.
874 if (data->getStore() == nullptr)
875 data->setStore (auxstore.get());
877 IProxyDict* store = nullptr;
878 const T* ptr = this->doPut (ctx, std::move(data), false, store);
879 if (!ptr) return nullptr;
881 SG::DataObjectSharedPtr<DataObject> dobj
882 (SG::asStorable (std::move (auxstore)));
883 SG::DataProxy* proxy = store->recordObject (std::move(dobj),
884 this->name() + "Aux.",
888 REPORT_ERROR (StatusCode::FAILURE)
889 << "recordObject of aux store failed";
891 // If we've failed here, then the aux store object has been deleted,
892 // but not the primary object. Null out the store pointer to prevent
893 // having a dangling pointer to a deleted object.
894 dref.setStore (static_cast<SG::IConstAuxStore*>(nullptr));
903 * @brief Helper for recording an object and its auxiliary store to the store.
904 * @param ctx The event context, or nullptr to use the current context.
905 * @param data The object to record.
906 * @param auxstore Auxiliary store object.
908 * Unlike record(), this does not change the handle object.
909 * That means that will not be able to get the object back
910 * by dereferencing the handle.
911 * Returns the object placed in the store, or nullptr if there
913 * If there was already an object in the store with the given key,
914 * then return null, and the objects passed in are destroyed.
917template <class AUXSTORE>
918typename WriteHandle<T>::const_pointer_type
919WriteHandle<T>::doPut (const EventContext* ctx,
920 std::unique_ptr<const T> data,
921 std::unique_ptr<const AUXSTORE> auxstore) const
923 IProxyDict* store = nullptr;
924 const T* ptr = this->doPut (ctx, std::move(data), false, store);
925 if (!ptr) return nullptr;
927 SG::DataObjectSharedPtr<DataObject> dobj
928 (SG::asStorable (std::move (auxstore)));
929 SG::DataProxy* proxy = store->recordObject (std::move(dobj),
930 this->name() + "Aux.",
934 REPORT_ERROR (StatusCode::FAILURE)
935 << "recordObject of aux store failed";
944 * @brief Record an object and its auxiliary store to the store.
945 * @param data The object to record.
946 * @param auxstore Auxiliary store object.
947 * @param isConst If true, record the objects as const.
950template <class AUXSTORE>
952WriteHandle<T>::record (std::unique_ptr<T> data,
953 std::unique_ptr<AUXSTORE> auxstore,
958 // If there's no store association, do it now.
959 if (data->getStore() == nullptr)
960 data->setStore (auxstore.get());
963 // Temporarily clear the store association, in order to prevent
964 // the aux store from being locked at this point.
965 IAuxStore* store = dref.getStore();
967 dref.setStore (static_cast<SG::IAuxStore*>(nullptr));
968 CHECK (this->record(std::move(data)));
969 // Deliberately not using RAII here. If there is an error,
970 // then the object referenced by data will be deleted.
971 dref.setStore (store);
974 CHECK (this->recordNonConst(std::move(data)));
976 // Store and proxy must be valid if we get to this point.
978 SG::DataObjectSharedPtr<DataObject> dobj
979 (SG::asStorable (std::move (auxstore)));
980 SG::DataProxy* proxy = m_store->recordObject (std::move(dobj),
981 this->name() + "Aux.",
985 REPORT_ERROR (StatusCode::FAILURE)
986 << "recordObject of aux store failed";
988 // If we've failed here, then the aux store object has been deleted,
989 // but not the primary object. Null out the store pointer to prevent
990 // having a dangling pointer to a deleted object.
991 dref.setStore (static_cast<SG::IConstAuxStore*>(nullptr));
992 return StatusCode::FAILURE;
995 if (m_proxy->isConst())
996 m_lockAuxPending = proxy;
998 return StatusCode::SUCCESS;
1003 * @brief Return a @c WriteHandle referencing @c key.
1004 * @param key The key object holding the clid/key/store.
1006 * This will raise an exception if the StoreGate key is blank,
1007 * or if the event store cannot be found.
1010WriteHandle<T> makeHandle (const WriteHandleKey<T>& key)
1012 return WriteHandle<T> (key);
1017 * @brief Return a @c WriteHandle referencing @c key for an explicit context.
1018 * @param key The key object holding the clid/key/store.
1019 * @param ctx The event context.
1021 * This will raise an exception if the StoreGate key is blank,
1022 * or if the event store cannot be found.
1024 * If the default event store has been requested, then the thread-specific
1025 * store from the event context will be used.
1028WriteHandle<T> makeHandle (const WriteHandleKey<T>& key,
1029 const EventContext& ctx)
1031 return WriteHandle<T> (key, ctx);
1038#endif //> !STOREGATE_SG_WRITEHANDLE_ICC