From 8b9e321b7022eda109d052d214921aae7f22f246 Mon Sep 17 00:00:00 2001
From: Frank Winklmeier <frank.winklmeier@cern.ch>
Date: Thu, 21 Feb 2019 16:10:34 +0100
Subject: [PATCH] Make ByteStream_StorageType available via
 ByteStreamAddress::storageType()

ByteStream_StorageType is an external variable referenced by all
bytestream converters. Make this available via a static constant method in
ByteStreamAddress to be used by all clients. This is more explicit and
will also allow tools like the thread checker to correctly deduce that
this is a constant value.

Once all clients are migrated remove the external variable.
---
 Event/ByteStreamCnvSvc/src/ByteStreamCnvSvc.cxx            | 7 ++++---
 .../ByteStreamCnvSvcBase/ByteStreamAddress.h               | 5 ++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamCnvSvc.cxx b/Event/ByteStreamCnvSvc/src/ByteStreamCnvSvc.cxx
index b6b9feb7e0a..1717f26c348 100644
--- a/Event/ByteStreamCnvSvc/src/ByteStreamCnvSvc.cxx
+++ b/Event/ByteStreamCnvSvc/src/ByteStreamCnvSvc.cxx
@@ -1,10 +1,11 @@
 /*
-  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 "ByteStreamCnvSvc/ByteStreamCnvSvc.h"
 #include "ByteStreamCnvSvc/ByteStreamOutputSvc.h"
 #include "ByteStreamCnvSvcBase/FullEventAssembler.h"
+#include "ByteStreamCnvSvcBase/ByteStreamAddress.h"
 
 #include "StoreGate/StoreGate.h"
 #include "EventInfo/EventInfo.h"
@@ -20,8 +21,8 @@
 
 #include <algorithm>
 
-/// External definitions
-long ByteStream_StorageType=0x43;
+/// External definitions (TODO: remove this once all "extern" references are removed)
+long ByteStream_StorageType = ByteStreamAddress::storageType();
 
 /// Standard constructor
 ByteStreamCnvSvc::ByteStreamCnvSvc(const std::string& name, ISvcLocator* pSvcLocator)
diff --git a/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ByteStreamAddress.h b/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ByteStreamAddress.h
index df1391acce4..a95bd7cf4aa 100755
--- a/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ByteStreamAddress.h
+++ b/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ByteStreamAddress.h
@@ -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
 */
 
 #ifndef BYTESTREAMCNVSVCBASE_BYTESTREAMADDRESS_H
@@ -47,6 +47,9 @@ public:
    // @brief get event id
    const EventContext& getEventContext() const;
 
+   // @brief storage type to be used by all bytestream converters
+   static constexpr long storageType() { return 0x43; }
+
 private:
    // @brief it holds a vector of rob ids
    std::vector<uint32_t> m_robIDs;
-- 
GitLab