From fe648558d3650b7da7cf1267a05558f335d74ac7 Mon Sep 17 00:00:00 2001
From: scott snyder <sss@karma>
Date: Thu, 9 May 2019 15:33:40 +0200
Subject: [PATCH] SGTools: Add public version of DataProxy::readData().

Add a publically-callable version of DataProxy::readData.
---
 Control/SGTools/SGTools/DataProxy.h | 18 +++++++++++++++++-
 Control/SGTools/src/DataProxy.cxx   | 22 +++++++++++++++++++++-
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/Control/SGTools/SGTools/DataProxy.h b/Control/SGTools/SGTools/DataProxy.h
index 40501c37695..ea4bf12d65e 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 54eddc13cac..126e8bb2bb9 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.
-- 
GitLab