2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
6 * @file AsgDataHandles/WriteHandle.icc
7 * @author Nils Krumnack <Nils.Erik.Krumnack@cern.h>
8 * @author S. Binet, P. Calafiura, scott snyder <snyder@bnl.gov> (for original version)
9 * @brief Handle class for recording to StoreGate.
12#include "xAODRootAccess/TActiveStore.h"
13#include "xAODRootAccess/TStore.h"
20//************************************************************************
26// * @brief Default constructor.
28// * The handle will not be usable until a non-blank key is assigned.
32// WriteHandle<T>::WriteHandle()
33// : VarHandleBase(ClassID_traits<T>::ID(), Gaudi::DataHandle::Writer)
39 * @brief Constructor with full arguments.
40 * @param sgkey StoreGate key of the referenced object.
44WriteHandle<T>::WriteHandle (const std::string& sgkey)
45 : VarHandleBase (sgkey)
51 * @brief Constructor specifying the key as a string, with context.
52 * @param sgkey StoreGate key of the referenced object.
53 * @param ctx The event context.
55 * In the standalone implementation the store is always taken from
56 * @c xAOD::TActiveStore, so the context is currently ignored.
60WriteHandle<T>::WriteHandle (const std::string& sgkey,
61 const EventContext& /*ctx*/)
62 : VarHandleBase (sgkey)
68 * @brief Constructor from a WriteHandleKey.
69 * @param key The key object holding the clid/key/store.
71 * This will raise an exception if the StoreGate key is blank,
72 * or if the event store cannot be found.
76WriteHandle<T>::WriteHandle (const WriteHandleKey<T>& key)
77 : VarHandleBase (key, nullptr)
83 * @brief Constructor from a WriteHandleKey and an explicit event context.
84 * @param key The key object holding the clid/key.
85 * @param ctx The event context.
87 * This will raise an exception if the StoreGate key is blank,
88 * or if the event store cannot be found.
90 * If the default event store has been requested, then the thread-specific
91 * store from the event context will be used.
95WriteHandle<T>::WriteHandle (const WriteHandleKey<T>& key,
96 const EventContext& ctx)
97 : VarHandleBase (key, &ctx)
103 * @brief Copy constructor.
107WriteHandle<T>::WriteHandle(const WriteHandle& h)
114 * @brief Move constructor.
117WriteHandle<T>::WriteHandle(WriteHandle&& h)
118 : VarHandleBase(std::move(h))
120 // m_lockAuxPending = h.m_lockAuxPending;
121 // h.m_lockAuxPending = nullptr;
126 * @brief Assignment operator.
131WriteHandle<T>::operator= (const WriteHandle& h)
134 this->VarHandleBase::operator=(h);
140 * @brief Move operator.
145WriteHandle<T>::operator= (WriteHandle&& h)
148 this->VarHandleBase::operator=(std::move(h));
149 // m_lockAuxPending = h.m_lockAuxPending;
150 // h.m_lockAuxPending = nullptr;
159 * Lock an aux object if m_lockAuxPending is true.
162WriteHandle<T>::~WriteHandle()
164 // if (m_lockAuxPending) {
165 // m_lockAuxPending->setConst();
170//************************************************************************
171// Deference. These all return only the cached pointer.
176// * @brief Dereference the pointer.
177// * Returns the cached pointer. Throws ExcNullWriteHandle if null.
181// typename WriteHandle<T>::pointer_type
182// WriteHandle<T>::operator->()
184// return WriteHandle<T>::checkedCachedPtr();
189 * @brief Dereference the pointer.
190 * Returns the cached pointer. Throws ExcNullWriteHandle if null.
194typename WriteHandle<T>::reference_type
195WriteHandle<T>::operator*()
197 if (m_ptr == nullptr)
198 throw std::runtime_error ("dereferenced handle is null: " + key());
204// * @brief Dereference the pointer.
205// * Returns the cached pointer.
209// typename WriteHandle<T>::const_pointer_type
210// WriteHandle<T>::cptr() const
212// return reinterpret_cast<pointer_type>(this->m_ptr);
217// * @brief Dereference the pointer.
218// * Returns the cached pointer.
222// typename WriteHandle<T>::pointer_type
223// WriteHandle<T>::ptr()
225// return cachedPtr();
230// * @brief Return the cached pointer directly; no lookup.
234// typename WriteHandle<T>::pointer_type
235// WriteHandle<T>::cachedPtr()
237// return reinterpret_cast<pointer_type>(this->m_ptr);
242 * @brief Can the handle be successfully dereferenced?
246bool WriteHandle<T>::isValid()
248 return this->m_ptr != nullptr;
252//************************************************************************
257 * @brief Record a const object to the store.
258 * @param data The object to record.
263WriteHandle<T>::WriteHandle::record (std::unique_ptr<T> data)
266 if (xAOD::TActiveStore::store()->record (std::move (data), key()).isFailure())
267 return StatusCode::FAILURE;
268 return StatusCode::SUCCESS;
273 * @brief Record a non-const object to the store.
274 * @param data The object to record.
279WriteHandle<T>::WriteHandle::recordNonConst (std::unique_ptr<T> data)
281 // In standalone there is no const/non-const distinction for the store, so
282 // this simply forwards to @ref record.
283 return record (std::move (data));
288 * @brief Record a const object and its auxiliary store to the store.
289 * @param data The object to record.
290 * @param auxstore Auxiliary store object.
293template <class AUXSTORE>
296WriteHandle<T>::WriteHandle::record (std::unique_ptr<T> data,
297 std::unique_ptr<AUXSTORE> auxstore)
299 // If there's no store association, do it now.
300 if (data->getStore() == nullptr)
301 data->setStore (auxstore.get());
304 if (xAOD::TActiveStore::store()->record (std::move (auxstore), key() + "Aux.").isFailure())
305 return StatusCode::FAILURE;
306 if (xAOD::TActiveStore::store()->record (std::move (data), key()).isFailure())
307 return StatusCode::FAILURE;
308 return StatusCode::SUCCESS;
313 * @brief Record a non-const object and its auxiliary store to the store.
314 * @param data The object to record.
315 * @param auxstore Auxiliary store object.
318template <class AUXSTORE>
321WriteHandle<T>::WriteHandle::recordNonConst (std::unique_ptr<T> data,
322 std::unique_ptr<AUXSTORE> auxstore)
324 // In standalone there is no const/non-const distinction for the store, so
325 // this simply forwards to @ref record.
326 return record (std::move (data), std::move (auxstore));
331// * @brief Record a const shared DataObject to the store.
332// * @param data The object to record.
334// * The event store takes shared ownership of the object.
339// WriteHandle<T>::record (SG::DataObjectSharedPtr<T> data)
341// return this->doRecord (std::move(data), true, false);
346// * @brief Record a non-const shared DataObject to the store.
347// * @param data The object to record.
349// * The event store takes shared ownership of the object.
354// WriteHandle<T>::recordNonConst (SG::DataObjectSharedPtr<T> data)
356// return this->doRecord (std::move(data), false, false);
361 * @brief Record an object to the store.
362 * @param data The object to record.
363 * @param returnExisting Allow an existing object?
365 * Unlike record(), this does not change the handle object.
366 * That means that one will not be able to get the object back
367 * by dereferencing the handle.
368 * Returns the object placed in the store, or nullptr if there
370 * If there was already an object in the store with the given key,
371 * then return null, unless @c returnExisting is true, in which case
372 * return success. In either case, @c data is destroyed.
376typename WriteHandle<T>::const_pointer_type
377WriteHandle<T>::put (std::unique_ptr<T> data/*,
378 bool returnExisting / *= false*/) const
380 const_pointer_type result = data.get();
381 if (xAOD::TActiveStore::store()->record (std::move (data), key()).isFailure())
382 throw std::runtime_error ("failed to record object: " + key());
388// * @brief Record an object to the store.
389// * @param data The object to record.
390// * @param returnExisting Allow an existing object?
392// * Unlike record(), this does not change the handle object.
393// * That means that one will not be able to get the object back
394// * by dereferencing the handle.
395// * Returns the object placed in the store, or nullptr if there
397// * If there was already an object in the store with the given key,
398// * then return null, unless @c returnExisting is true, in which case
399// * return success. In either case, @c data is destroyed.
403// typename WriteHandle<T>::const_pointer_type
404// WriteHandle<T>::put (std::unique_ptr<const T> data,
405// bool returnExisting /*= false*/) const
407// IProxyDict* store = nullptr;
408// return doPut (nullptr, std::move(data), returnExisting, store);
413// * @brief Record an object to the store.
414// * @param data The object to record.
415// * @param returnExisting Allow an existing object?
417// * Unlike record(), this does not change the handle object.
418// * That means that one will not be able to get the object back
419// * by dereferencing the handle.
420// * Returns the object placed in the store, or nullptr if there
422// * If there was already an object in the store with the given key,
423// * then return null, unless @c returnExisting is true, in which case
424// * return success. In either case, @c data is destroyed.
428// typename WriteHandle<T>::const_pointer_type
429// WriteHandle<T>::put (std::unique_ptr<const ConstDataVector<T> > data,
430// bool returnExisting /*= false*/) const
432// IProxyDict* store = nullptr;
433// std::unique_ptr<const T> coll (data.release()->asDataVector());
434// return doPut (nullptr, std::move(coll), returnExisting, store);
439// * @brief Record an object to the store.
440// * @param ctx The event context to use.
441// * @param data The object to record.
442// * @param returnExisting Allow an existing object?
444// * Unlike record(), this does not change the handle object.
445// * That means that one will not be able to get the object back
446// * by dereferencing the handle.
447// * Returns the object placed in the store, or nullptr if there
449// * If there was already an object in the store with the given key,
450// * then return null, unless @c returnExisting is true, in which case
451// * return success. In either case, @c data is destroyed.
455// typename WriteHandle<T>::const_pointer_type
456// WriteHandle<T>::put (const EventContext& ctx,
457// std::unique_ptr<const ConstDataVector<T> > data,
458// bool returnExisting /*= false*/) const
460// IProxyDict* store = nullptr;
461// std::unique_ptr<const T> coll (data.release()->asDataVector());
462// return doPut (&ctx, std::move(coll), returnExisting, store);
467// * @brief Record an object to the store.
468// * @param ctx The event context to use.
469// * @param data The object to record.
470// * @param returnExisting Allow an existing object?
472// * Unlike record(), this does not change the handle object.
473// * That means that one will not be able to get the object back
474// * by dereferencing the handle.
475// * Returns the object placed in the store, or nullptr if there
477// * If there was already an object in the store with the given key,
478// * then return null, unless @c returnExisting is true, in which case
479// * return success. In either case, @c data is destroyed.
483// typename WriteHandle<T>::const_pointer_type
484// WriteHandle<T>::put (const EventContext& ctx,
485// std::unique_ptr<T> data,
486// bool returnExisting /*= false*/) const
488// IProxyDict* store = nullptr;
489// return doPut (&ctx, std::move(data), returnExisting, store);
494// * @brief Record an object to the store.
495// * @param ctx The event context to use.
496// * @param data The object to record.
497// * @param returnExisting Allow an existing object?
499// * Unlike record(), this does not change the handle object.
500// * That means that one will not be able to get the object back
501// * by dereferencing the handle.
502// * Returns the object placed in the store, or nullptr if there
504// * If there was already an object in the store with the given key,
505// * then return null, unless @c returnExisting is true, in which case
506// * return success. In either case, @c data is destroyed.
510// typename WriteHandle<T>::const_pointer_type
511// WriteHandle<T>::put (const EventContext& ctx,
512// std::unique_ptr<const T> data,
513// bool returnExisting /*= false*/) const
515// IProxyDict* store = nullptr;
516// return doPut (&ctx, std::move(data), returnExisting, store);
521// * @brief Record an object to the store.
522// * @param data The object to record.
524// * Unlike record(), this does not change the handle object.
525// * That means that one will not be able to get the object back
526// * by dereferencing the handle.
527// * Returns the object placed in the store, or nullptr if there
530// * The event store takes shared ownership of the object.
534// typename WriteHandle<T>::const_pointer_type
535// WriteHandle<T>::put (SG::DataObjectSharedPtr<T> data) const
537// IProxyDict* store = nullptr;
538// return doPut (nullptr, std::move(data), false, store);
543// * @brief Record an object to the store.
544// * @param ctx The event context to use.
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.
557// typename WriteHandle<T>::const_pointer_type
558// WriteHandle<T>::put (const EventContext& ctx,
559// SG::DataObjectSharedPtr<T> data) const
561// IProxyDict* store = nullptr;
562// return doPut (&ctx, std::move(data), false, store);
567// * @brief Record an object and its auxiliary store to the store.
568// * @param data The object to record.
569// * @param auxstore Auxiliary store object.
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
576// * If there was already an object in the store with the given key,
577// * then return null, and the objects passed in are destroyed.
580// template <class AUXSTORE>
581// typename WriteHandle<T>::const_pointer_type
582// WriteHandle<T>::put (std::unique_ptr<T> data,
583// std::unique_ptr<AUXSTORE> auxstore) const
585// return doPut (nullptr, std::move(data), std::move(auxstore));
591// * @brief Record an object and its auxiliary store to the store.
592// * @param data The object to record.
593// * @param auxstore Auxiliary store object.
595// * Unlike record(), this does not change the handle object.
596// * That means that one will not be able to get the object back
597// * by dereferencing the handle.
598// * Returns the object placed in the store, or nullptr if there
600// * If there was already an object in the store with the given key,
601// * then return null, and the objects passed in are destroyed.
603// * Unlike the version taking unique_ptr<T>, this does not alter the
604// * store pointer of @c data.
607// template <class AUXSTORE>
608// typename WriteHandle<T>::const_pointer_type
609// WriteHandle<T>::put (std::unique_ptr<const T> data,
610// std::unique_ptr<const AUXSTORE> auxstore) const
612// return doPut (nullptr, std::move(data), std::move(auxstore));
617// * @brief Record an object and its auxiliary store to the store.
618// * @param ctx The event context to use.
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.
631// template <class AUXSTORE>
632// typename WriteHandle<T>::const_pointer_type
633// WriteHandle<T>::put (const EventContext& ctx,
634// std::unique_ptr<T> data,
635// std::unique_ptr<AUXSTORE> auxstore) const
637// return doPut (&ctx, std::move(data), std::move(auxstore));
642// * @brief Record an object and its auxiliary store to the store.
643// * @param ctx The event context to use.
644// * @param data The object to record.
645// * @param auxstore Auxiliary store object.
647// * Unlike record(), this does not change the handle object.
648// * That means that one will not be able to get the object back
649// * by dereferencing the handle.
650// * Returns the object placed in the store, or nullptr if there
652// * If there was already an object in the store with the given key,
653// * then return null, and the objects passed in are destroyed.
655// * Unlike the version taking unique_ptr<T>, this does not alter the
656// * store pointer of @c data.
659// template <class AUXSTORE>
660// typename WriteHandle<T>::const_pointer_type
661// WriteHandle<T>::put (const EventContext& ctx,
662// std::unique_ptr<const T> data,
663// std::unique_ptr<const AUXSTORE> auxstore) const
665// return doPut (&ctx, std::move(data), std::move(auxstore));
670 * @brief Alternate notation for record. Records a non-const object.
671 * @param data Object to record.
673 * Throws an exception on failure.
677WriteHandle<T>::operator= (std::unique_ptr<T> data)
679 if (recordNonConst (std::move(data)).isFailure()) {
680 throw std::runtime_error ("WriteHandle<T>::operator=(unique_ptr) Record failed.");
687// * @brief Make an alias.
688// * @param key Alternate key by which the referenced object should be known.
690// * The current handle should be valid and referencing an object
691// * (i.e., @c record should have been called on it).
693// * The object will also be known by the name given in @c key.
696// StatusCode WriteHandle<T>::alias (const WriteHandleKey<T>& key)
698// return symLink_impl (this->clid(), key.key());
703// * @brief Make an explicit link.
704// * @param key Alternate clid by which the referenced object
705// * should be known. The SG key must match the key of the
708// * You should generally not be using this!
710// * The current handle should be valid and referencing an object
711// * (i.e., @c record should have been called on it).
713// * This makes a symlink: the object will be retrievable
714// * as a different type.
716// * Note that if @c T and @c @U are related via @c SG_BASE and/or
717// * @c DATAVECTOR_BASE, then you shouldn't need to explicitly make a symlink;
718// * that should happen automatically.
720// * If a @c U* is not convertable to a @c T* via C++ rules, then you likely
721// * will be, at best, relying on undefined behavior. You will probably
722// * get warnings from the undefined behavior sanitizer when if you try
723// * to dereference the @c U*.
725// * This usage is here mainly to assist in migrating some existing
726// * patterns to MT. You should think several times before using
731// StatusCode WriteHandle<T>::symLink (const WriteHandleKey<U>& other)
733// if (this->key() != other.key()) {
734// REPORT_ERROR (StatusCode::FAILURE)
735// << "symLink: SG keys do not match: " << other.key() << " vs "
737// return StatusCode::FAILURE;
739// return symLink_impl (other.clid(), other.key());
744// * @brief Return the cached pointer directly.
746// * If it is null, throw ExcNullWriteHandle.
749// typename WriteHandle<T>::pointer_type
750// WriteHandle<T>::checkedCachedPtr()
753// throwExcNullWriteHandle (clid(), key(), store());
754// return cachedPtr();
759// * @brief Helper for record.
760// * @param data The object to record.
761// * @param isConst If true, record the object as const.
762// * @param returnExisting Allow an existing object.
766// StatusCode WriteHandle<T>::doRecord (U data,
768// bool returnExisting)
770// typedef typename U::element_type elt_t;
772// // make sure the BaseInfo(Base) structure is initialized
773// SG::BaseInfo<elt_t>::baseinfo();
775// // If s_isConst is set for this type, then we want to automatically
776// // make it const when recorded.
777// bool allowMods = !isConst;
778// if (ClassID_traits<elt_t>::s_isConst)
781// void* dataPtr(data.get());
782// std::unique_ptr<DataObject> dobj (SG::asStorable (std::move (data)));
783// return this->record_impl (std::move(dobj), dataPtr, allowMods, returnExisting);
788// * @brief Helper for put.
789// * @param ctx The event context, or nullptr to use the current context.
790// * @param data The object to record.
791// * @param returnExisting Allow an existing object.
792// * @param[out] store The store being used.
794// * Unlike record(), this does not change the handle object.
795// * That means that will not be able to get the object back
796// * by dereferencing the handle.
797// * Returns the object placed in the store, or nullptr if there
799// * If there was already an object in the store with the given key,
800// * then return null, unless @c returnExisting is true, in which case
801// * return success. In either case, @c data is destroyed.
805// typename WriteHandle<T>::const_pointer_type
806// WriteHandle<T>::doPut (const EventContext* ctx,
808// bool returnExisting,
809// IProxyDict* & store) const
811// //typedef typename U::element_type elt_t;
814// // make sure the BaseInfo(Base) structure is initialized
815// SG::BaseInfo<elt_t>::baseinfo();
817// const void* dataPtr = data.get();
818// std::unique_ptr<DataObject> dobj (SG::asStorable (std::move (data)));
819// return reinterpret_cast<const T*>
820// (this->put_impl (ctx, std::move(dobj), dataPtr, false, returnExisting, store));
825// * @brief Helper for recording an object and its auxiliary store to the store.
826// * @param ctx The event context, or nullptr to use the current context.
827// * @param data The object to record.
828// * @param auxstore Auxiliary store object.
830// * Unlike record(), this does not change the handle object.
831// * That means that will not be able to get the object back
832// * by dereferencing the handle.
833// * Returns the object placed in the store, or nullptr if there
835// * If there was already an object in the store with the given key,
836// * then return null, and the objects passed in are destroyed.
839// template <class AUXSTORE>
840// typename WriteHandle<T>::const_pointer_type
841// WriteHandle<T>::doPut (const EventContext* ctx,
842// std::unique_ptr<T> data,
843// std::unique_ptr<AUXSTORE> auxstore) const
847// // If there's no store association, do it now.
848// if (data->getStore() == nullptr)
849// data->setStore (auxstore.get());
851// IProxyDict* store = nullptr;
852// const T* ptr = this->doPut (ctx, std::move(data), false, store);
853// if (!ptr) return nullptr;
855// SG::DataObjectSharedPtr<DataObject> dobj
856// (SG::asStorable (std::move (auxstore)));
857// SG::DataProxy* proxy = store->recordObject (std::move(dobj),
858// this->name() + "Aux.",
862// REPORT_ERROR (StatusCode::FAILURE)
863// << "recordObject of aux store failed";
865// // If we've failed here, then the aux store object has been deleted,
866// // but not the primary object. Null out the store pointer to prevent
867// // having a dangling pointer to a deleted object.
868// dref.setStore (static_cast<SG::IConstAuxStore*>(nullptr));
877// * @brief Helper for recording an object and its auxiliary store to the store.
878// * @param ctx The event context, or nullptr to use the current context.
879// * @param data The object to record.
880// * @param auxstore Auxiliary store object.
882// * Unlike record(), this does not change the handle object.
883// * That means that will not be able to get the object back
884// * by dereferencing the handle.
885// * Returns the object placed in the store, or nullptr if there
887// * If there was already an object in the store with the given key,
888// * then return null, and the objects passed in are destroyed.
891// template <class AUXSTORE>
892// typename WriteHandle<T>::const_pointer_type
893// WriteHandle<T>::doPut (const EventContext* ctx,
894// std::unique_ptr<const T> data,
895// std::unique_ptr<const AUXSTORE> auxstore) const
897// IProxyDict* store = nullptr;
898// const T* ptr = this->doPut (ctx, std::move(data), false, store);
899// if (!ptr) return nullptr;
901// SG::DataObjectSharedPtr<DataObject> dobj
902// (SG::asStorable (std::move (auxstore)));
903// SG::DataProxy* proxy = store->recordObject (std::move(dobj),
904// this->name() + "Aux.",
908// REPORT_ERROR (StatusCode::FAILURE)
909// << "recordObject of aux store failed";
918// * @brief Record an object and its auxiliary store to the store.
919// * @param data The object to record.
920// * @param auxstore Auxiliary store object.
921// * @param isConst If true, record the objects as const.
924// template <class AUXSTORE>
926// WriteHandle<T>::record (std::unique_ptr<T> data,
927// std::unique_ptr<AUXSTORE> auxstore,
932// // If there's no store association, do it now.
933// if (data->getStore() == nullptr)
934// data->setStore (auxstore.get());
937// // Temporarily clear the store association, in order to prevent
938// // the aux store from being locked at this point.
939// IAuxStore* store = dref.getStore();
941// dref.setStore (static_cast<SG::IAuxStore*>(nullptr));
942// CHECK (this->record(std::move(data)));
943// // Deliberately not using RAII here. If there is an error,
944// // then the object referenced by data will be deleted.
945// dref.setStore (store);
948// CHECK (this->recordNonConst(std::move(data)));
950// // Store and proxy must be valid if we get to this point.
952// SG::DataObjectSharedPtr<DataObject> dobj
953// (SG::asStorable (std::move (auxstore)));
954// SG::DataProxy* proxy = m_store->recordObject (std::move(dobj),
955// this->name() + "Aux.",
959// REPORT_ERROR (StatusCode::FAILURE)
960// << "recordObject of aux store failed";
962// // If we've failed here, then the aux store object has been deleted,
963// // but not the primary object. Null out the store pointer to prevent
964// // having a dangling pointer to a deleted object.
965// dref.setStore (static_cast<SG::IConstAuxStore*>(nullptr));
966// return StatusCode::FAILURE;
969// if (m_proxy->isConst())
970// m_lockAuxPending = proxy;
972// return StatusCode::SUCCESS;
977 * @brief Return a @c WriteHandle referencing @c key.
978 * @param key The key object holding the clid/key/store.
980 * This will raise an exception if the StoreGate key is blank,
981 * or if the event store cannot be found.
984WriteHandle<T> makeHandle (const WriteHandleKey<T>& key)
986 return WriteHandle<T> (key);
991 * @brief Return a @c WriteHandle referencing @c key for an explicit context.
992 * @param key The key object holding the clid/key/store.
993 * @param ctx The event context.
995 * This will raise an exception if the StoreGate key is blank,
996 * or if the event store cannot be found.
998 * If the default event store has been requested, then the thread-specific
999 * store from the event context will be used.
1002WriteHandle<T> makeHandle (const WriteHandleKey<T>& key,
1003 const EventContext& ctx)
1005 return WriteHandle<T> (key, ctx);