diff --git a/Control/AthToolSupport/AsgDataHandles/AsgDataHandles/ReadHandleKeyArray.h b/Control/AthToolSupport/AsgDataHandles/AsgDataHandles/ReadHandleKeyArray.h index 8f7ae624f1c8c353f001ad90a85c62e859f533b2..217824acc2b183a2372b97f52610b5fb1b337626 100644 --- a/Control/AthToolSupport/AsgDataHandles/AsgDataHandles/ReadHandleKeyArray.h +++ b/Control/AthToolSupport/AsgDataHandles/AsgDataHandles/ReadHandleKeyArray.h @@ -21,6 +21,12 @@ namespace SG { * @brief class to hold an array of ReadHandleKeys * * See StoreGate/ReadHandleKeyArray for details. + * + * This currently (13 Aug 20) contains a commented out template + * argument that was part of the original handle implementation, but + * has not yet been implemented in the standalone version. The plan + * is to either implement or remove them, depending on what is + * needed in AnalysisBase as we add more packages. */ template <class T> using ReadHandleKeyArray = HandleKeyArray<ReadHandle<T>, ReadHandleKey<T>/*, Gaudi::DataHandle::Reader*/ >; diff --git a/Control/AthToolSupport/AsgDataHandles/AsgDataHandles/WriteHandle.h b/Control/AthToolSupport/AsgDataHandles/AsgDataHandles/WriteHandle.h index 7a3f0d726d476a173d2d63e380973f38155e7858..09cdf8b738dc88b38f2fb8badfa9d2b20bf476cf 100644 --- a/Control/AthToolSupport/AsgDataHandles/AsgDataHandles/WriteHandle.h +++ b/Control/AthToolSupport/AsgDataHandles/AsgDataHandles/WriteHandle.h @@ -231,22 +231,22 @@ public: // StatusCode recordNonConst (SG::DataObjectSharedPtr<T> data); - // /** - // * @brief Record an object to the store. - // * @param data The object to record. - // * @param returnExisting Allow an existing object? - // * - // * Unlike record(), this does not change the handle object. - // * That means that one will not be able to get the object back - // * by dereferencing the handle. - // * Returns the object placed in the store, or nullptr if there - // * was an error. - // * If there was already an object in the store with the given key, - // * then return null, unless @c returnExisting is true, in which case - // * return success. In either case, @c data is destroyed. - // */ - // const_pointer_type put (std::unique_ptr<T> data, - // bool returnExisting = false) const; + /** + * @brief Record an object to the store. + * @param data The object to record. + * @param returnExisting Allow an existing object? + * + * Unlike record(), this does not change the handle object. + * That means that one will not be able to get the object back + * by dereferencing the handle. + * Returns the object placed in the store, or nullptr if there + * was an error. + * If there was already an object in the store with the given key, + * then return null, unless @c returnExisting is true, in which case + * return success. In either case, @c data is destroyed. + */ + const_pointer_type put (std::unique_ptr<T> data/*, + bool returnExisting = false*/) const; // /** diff --git a/Control/AthToolSupport/AsgDataHandles/AsgDataHandles/WriteHandle.icc b/Control/AthToolSupport/AsgDataHandles/AsgDataHandles/WriteHandle.icc index 798c2311c81a2ab45417ef6258b79fa090e3af51..16a98097c0a9efed69f5432334dd7c5aaceb5a5a 100644 --- a/Control/AthToolSupport/AsgDataHandles/AsgDataHandles/WriteHandle.icc +++ b/Control/AthToolSupport/AsgDataHandles/AsgDataHandles/WriteHandle.icc @@ -336,29 +336,31 @@ WriteHandle<T>::WriteHandle::record (std::unique_ptr<T> data, // } -// /** -// * @brief Record an object to the store. -// * @param data The object to record. -// * @param returnExisting Allow an existing object? -// * -// * Unlike record(), this does not change the handle object. -// * That means that one will not be able to get the object back -// * by dereferencing the handle. -// * Returns the object placed in the store, or nullptr if there -// * was an error. -// * If there was already an object in the store with the given key, -// * then return null, unless @c returnExisting is true, in which case -// * return success. In either case, @c data is destroyed. -// */ -// template <class T> -// inline -// typename WriteHandle<T>::const_pointer_type -// WriteHandle<T>::put (std::unique_ptr<T> data, -// bool returnExisting /*= false*/) const -// { -// IProxyDict* store = nullptr; -// return doPut (nullptr, std::move(data), returnExisting, store); -// } +/** + * @brief Record an object to the store. + * @param data The object to record. + * @param returnExisting Allow an existing object? + * + * Unlike record(), this does not change the handle object. + * That means that one will not be able to get the object back + * by dereferencing the handle. + * Returns the object placed in the store, or nullptr if there + * was an error. + * If there was already an object in the store with the given key, + * then return null, unless @c returnExisting is true, in which case + * return success. In either case, @c data is destroyed. + */ +template <class T> +inline +typename WriteHandle<T>::const_pointer_type +WriteHandle<T>::put (std::unique_ptr<T> data/*, + bool returnExisting / *= false*/) const +{ + const_pointer_type result = data.get(); + if (xAOD::TActiveStore::store()->record (std::move (data), key()).isFailure()) + throw std::runtime_error ("failed to record object: " + key()); + return result; +} // /**