diff --git a/Control/SGTools/SGTools/DataProxy.h b/Control/SGTools/SGTools/DataProxy.h index 40501c37695a727b765f0e7d9d3668ec5ecbcd8a..ea4bf12d65e1c8c55997591d4e1647ca83458e6b 100755 --- a/Control/SGTools/SGTools/DataProxy.h +++ b/Control/SGTools/SGTools/DataProxy.h @@ -1,7 +1,7 @@ // This file's extension implies that it's C, but it's really -*- C++ -*-. /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef SGTOOLS_DATAPROXY_H @@ -237,6 +237,22 @@ class DataStore; IConverter* loader(); + + /** + * @brief Read in a new copy of the object referenced by this proxy. + * + * If this proxy has an associated loader and address, then load + * a new copy of the object and return it. Any existing copy + * held by the proxy is unaffected. + * + * This will fail if the proxy does not refer to an object read from an + * input file. + * + * Returns a null pointer on failure. + */ + std::unique_ptr<DataObject> readData() const; + + private: /// For access to requestRelease. friend class SG::DataStore; diff --git a/Control/SGTools/src/DataProxy.cxx b/Control/SGTools/src/DataProxy.cxx index 54eddc13cac1da10061fbce472cbc5e6d31948fd..126e8bb2bb9539f0ff887735bc9be4abb251a822 100755 --- a/Control/SGTools/src/DataProxy.cxx +++ b/Control/SGTools/src/DataProxy.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include <algorithm> @@ -411,6 +411,26 @@ void DataProxy::setAddress(IOpaqueAddress* address) ////////////////////////////////////////////////////////////// +/** + * @brief Read in a new copy of the object referenced by this proxy. + * + * If this proxy has an associated loader and address, then load + * a new copy of the object and return it. Any existing copy + * held by the proxy is unaffected. + * + * This will fail if the proxy does not refer to an object read from an + * input file. + * + * Returns a null pointer on failure. + */ +std::unique_ptr<DataObject> DataProxy::readData() const +{ + // Public wrapper for readData(). + objLock_t objLock (m_objMutex); + return readData (objLock, nullptr); +} + + /** * @brief Read in a new copy of the object referenced by this proxy. * @param errNo If non-null, set to the resulting error code.