diff --git a/Control/AthenaKernel/AthenaKernel/IIOVSvc.h b/Control/AthenaKernel/AthenaKernel/IIOVSvc.h index c5c3d249089e77ad70c7badd15be0d44d401d1e1..29ded595275186df922b5fa3353fa255f61cb988 100644 --- a/Control/AthenaKernel/AthenaKernel/IIOVSvc.h +++ b/Control/AthenaKernel/AthenaKernel/IIOVSvc.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 ATHENAKERNEL_IIOVSVC_H @@ -39,8 +39,7 @@ namespace SG { class IIOVSvc : virtual public IService { public: - /// Retrieve interface ID - static const InterfaceID& interfaceID(); + DeclareInterfaceID (IIOVSvc, 1, 0); virtual StatusCode createIOVTool( const std::string& storeName ) = 0; virtual std::vector<std::string> getStoreNames() const = 0; @@ -153,11 +152,4 @@ public: }; -inline -const InterfaceID& -IIOVSvc::interfaceID() { - static const InterfaceID IID("IIOVSvc", 1, 0); - return IID; -} - #endif diff --git a/Control/IOVSvc/IOVSvc/IOVSvc.h b/Control/IOVSvc/IOVSvc/IOVSvc.h index ddd4295b7386e844d6b0e5bb105adcf51929c5c1..ebec47d72af15c9bdc9184b8fdd0a70ee5dcf637 100755 --- a/Control/IOVSvc/IOVSvc/IOVSvc.h +++ b/Control/IOVSvc/IOVSvc/IOVSvc.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 IOVSVC_IOVSVC_H @@ -18,51 +18,20 @@ *****************************************************************************/ #include "AthenaBaseComps/AthService.h" -#ifndef KERNEL_STATUSCODES_H #include "GaudiKernel/StatusCode.h" -#endif -#ifndef GAUDIKERNEL_CLASSID_H #include "GaudiKernel/ClassID.h" -#endif -#ifndef GAUDIKERNEL_MSGSTREAM_H #include "GaudiKernel/MsgStream.h" -#endif -#ifndef SGTOOLS_DATAPROXY_H #include "SGTools/DataProxy.h" -#endif - -#ifndef ATHENAKERNEL_IIOVSVC_H #include "AthenaKernel/IIOVSvc.h" -#endif - -#ifndef IOVSVC_IOVENTRY_H #include "IOVSvc/IOVEntry.h" -#endif -#ifndef SGTOOLS_CALLBACKID_H #include "SGTools/CallBackID.h" -#endif -#ifndef ATHENAKERNEL_IOVTIME_H #include "AthenaKernel/IOVTime.h" -#endif - -#ifndef ATHENAKERNEL_IOVSVCDEFS_H #include "AthenaKernel/IOVSvcDefs.h" -#endif - #include "IOVSvc/IIOVSvcTool.h" - -#ifndef _CPP_SET #include <set> -#endif -#ifndef _CPP_MAP #include <map> -#endif -#ifndef _CPP_LIST #include <list> -#endif -#ifndef _CPP_STRING #include <string> -#endif #include <mutex> #include "GaudiKernel/ServiceHandle.h" @@ -82,112 +51,110 @@ namespace SG { class DataProxy; } -class IOVSvc: virtual public AthService, - virtual public IIOVSvc { - +class IOVSvc: public extends<AthService, IIOVSvc> +{ public: IOVSvc( const std::string& name, ISvcLocator* svc ); virtual ~IOVSvc(); - virtual StatusCode initialize(); - virtual StatusCode reinitialize(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode reinitialize() override; + virtual StatusCode finalize() override; - /// Query the interfaces. - virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ); - /// static const InterfaceID& interfaceID(); - - StatusCode createIOVTool( const std::string& storeName ); - std::vector<std::string> getStoreNames() const; + virtual StatusCode createIOVTool( const std::string& storeName ) override; + virtual std::vector<std::string> getStoreNames() const override; /// register callback functions + virtual StatusCode regFcn(SG::DataProxy *dp, const CallBackID c, - const IOVSvcCallBackFcn& fcn, bool trigger=false); + const IOVSvcCallBackFcn& fcn, bool trigger=false) override; + virtual StatusCode regFcn(const CallBackID c1, const CallBackID c2, const IOVSvcCallBackFcn& fcn2, - bool trigger); + bool trigger) override; + virtual StatusCode regFcn(const std::string& toolName, const CallBackID c2, const IOVSvcCallBackFcn& fcn2, - bool trigger); + bool trigger) override; /// Update Range from dB virtual StatusCode setRange(const CLID& clid, const std::string& key, - IOVRange&); + IOVRange&) override; virtual StatusCode setRange(const CLID& clid, const std::string& key, IOVRange& io, - const std::string& storeName); + const std::string& storeName) override; virtual StatusCode getRange(const CLID& clid, const std::string& key, - IOVRange& io) const; + IOVRange& io) const override; /// Subscribe method for DataProxy. key StoreGate key virtual StatusCode regProxy( const SG::DataProxy *proxy, const std::string& key, - const std::string& storeName); + const std::string& storeName) override; /// replace a registered DataProxy with a new version virtual StatusCode replaceProxy( const SG::DataProxy *pOld, const SG::DataProxy *pNew, - const std::string& storeName); + const std::string& storeName) override; /// Another way to subscribe virtual StatusCode regProxy( const CLID& clid, const std::string& key, - const std::string& storeName ); + const std::string& storeName ) override; - virtual StatusCode deregProxy( const SG::DataProxy *proxy ); - virtual StatusCode deregProxy( const CLID& clid, const std::string& key ); + virtual StatusCode deregProxy( const SG::DataProxy *proxy ) override; + virtual StatusCode deregProxy( const CLID& clid, const std::string& key ) override; /// Get IOVRange from db for current event virtual StatusCode getRangeFromDB(const CLID& clid, const std::string& key, IOVRange& range, std::string &tag, - IOpaqueAddress*& ioa) const; + IOpaqueAddress*& ioa) const override; /// Get IOVRange from db for a particular event virtual StatusCode getRangeFromDB(const CLID& clid, const std::string& key, const IOVTime& time, IOVRange& range, std::string &tag, - IOpaqueAddress*& ioa) const; + IOpaqueAddress*& ioa) const override; /// Set a particular IOVRange in db (and memory) virtual StatusCode setRangeInDB(const CLID& clid, const std::string& key, const IOVRange& range, - const std::string &tag); + const std::string &tag) override; /// supply a list of TADs whose proxies will be preloaded virtual StatusCode preLoadTAD( const SG::TransientAddress *, - const std::string& storeName ); + const std::string& storeName ) override; /// supply a list of TADs whose data will be preloaded virtual StatusCode preLoadDataTAD( const SG::TransientAddress *, - const std::string& storeName ); + const std::string& storeName ) override; /// return list of tools (or functions) that have been triggered by key /// will return FAILURE if no tools found, or no key found virtual StatusCode getTriggeredTools(const std::string& key, std::set<std::string>& tools, - const std::string& storeName); + const std::string& storeName) override; - virtual void resetAllProxies(); + virtual void resetAllProxies() override; virtual void ignoreProxy(const CLID& clid, const std::string& key, - const std::string& storeName); + const std::string& storeName) override; virtual StatusCode createCondObj(CondContBase*, const DataObjID&, - const EventIDBase&); + const EventIDBase&) override; private: - bool createIOVTool(const std::string& storeName, IIOVSvcTool*& tool) const; + StatusCode createIOVTool(const std::string& storeName, IIOVSvcTool*& tool); IIOVSvcTool* getTool( const std::string& storeName, - bool createIF=true ) const; + bool createIF=true ); IIOVSvcTool* getTool( const CLID& clid, const std::string& key) const; IIOVSvcTool* getTool( const SG::DataProxy* proxy ) const; IIOVSvcTool* getTool( const CallBackID& c1 ) const; @@ -197,8 +164,7 @@ private: typedef std::map< std::string, IIOVSvcTool* > toolMap; - - mutable toolMap m_toolMap; + toolMap m_toolMap; BooleanProperty m_preLoadRanges, m_preLoadData, m_partialPreLoadData; diff --git a/Control/IOVSvc/src/IOVSvc.cxx b/Control/IOVSvc/src/IOVSvc.cxx index 24eedb7dc5cf5b197c4ddb4559f1f9b795772c95..c8c3dcfe2d9ce64622a92727d5d426fa6c7ad2ea 100755 --- a/Control/IOVSvc/src/IOVSvc.cxx +++ b/Control/IOVSvc/src/IOVSvc.cxx @@ -27,7 +27,6 @@ using SG::DataProxy; using SG::TransientAddress; -using namespace std; const std::string defaultStore = "StoreGateSvc"; @@ -63,7 +62,7 @@ bool eventIDMatch (const EventIDBase& e1, const EventIDBase& e2) // IOVSvc::IOVSvc( const std::string& name, ISvcLocator* svc ) - : AthService( name, svc ), + : base_class( name, svc ), p_toolSvc("ToolSvc",name), p_CLIDSvc("ClassIDSvc",name), p_sgs("StoreGateSvc",name), @@ -92,18 +91,8 @@ StatusCode IOVSvc::initialize() { StatusCode status = AthService::initialize(); msg().setLevel( m_outputLevel.value() ); -#ifndef NDEBUG - if (msgLvl(MSG::DEBUG)) { - msg() << MSG::DEBUG << "Initializing IOVSvc version " - << PACKAGE_VERSION << endmsg; - } -#endif - -#ifndef NDEBUG - if (msgLvl(MSG::DEBUG)) { - msg() << MSG::DEBUG << "AthService initialized" << endmsg; - } -#endif + ATH_MSG_DEBUG( "Initializing IOVSvc version " << PACKAGE_VERSION ); + ATH_MSG_DEBUG( "AthService initialized" ); if (!p_sgs.isValid()) { ATH_MSG_ERROR("could not get the Event Store"); @@ -125,41 +114,10 @@ StatusCode IOVSvc::initialize() { /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -StatusCode IOVSvc::finalize() { - - // cleanup - - toolMap::iterator itr = m_toolMap.begin(); - for (; itr!= m_toolMap.end(); ++itr) { - IIOVSvcTool* ist = itr->second; - p_toolSvc->releaseTool( ist ).ignore(); - } - - StatusCode status = AthService::finalize(); - -#ifndef NDEBUG - if (msgLvl(MSG::DEBUG) && status.isSuccess() ) { - msg() << MSG::DEBUG << "Service finalised successfully" << endmsg; - } -#endif - - return status; - -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -StatusCode -IOVSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) +StatusCode IOVSvc::finalize() { - if ( IIOVSvc::interfaceID().versionMatch(riid) ) { - *ppvInterface = (IIOVSvc*)this; - } - else { - // Interface is not directly available: try out a base class - return AthService::queryInterface(riid, ppvInterface); - } - addRef(); + ATH_CHECK( AthService::finalize() ); + ATH_MSG_DEBUG( "Service finalised successfully" ); return StatusCode::SUCCESS; } @@ -175,27 +133,23 @@ IOVSvc::regProxy( const DataProxy *proxy, const std::string& key, std::lock_guard<std::recursive_mutex> lock(m_lock); IIOVSvcTool *ist = getTool( storeName ); if (ist == 0) { - msg() << MSG::ERROR << "regProxy: no IOVSvcTool associated with store \"" - << storeName << "\" and failed to create one" << endmsg; + ATH_MSG_ERROR( "regProxy: no IOVSvcTool associated with store \"" + << storeName << "\" and failed to create one" ); return (StatusCode::FAILURE); } IIOVSvcTool *ist2 = getTool( proxy ); if (ist2 != 0) { if (ist2 != ist) { - msg() << MSG::ERROR << "regProxy: when registering proxy for " - << fullProxyName(proxy) << " with store \"" << storeName - << "\", it is already registered with store \"" - << ist2->getStoreName() << "\"" << endmsg; + ATH_MSG_ERROR( "regProxy: when registering proxy for " + << fullProxyName(proxy) << " with store \"" << storeName + << "\", it is already registered with store \"" + << ist2->getStoreName() << "\"" ); return StatusCode::FAILURE; } else { -#ifndef NDEBUG - if (msgLvl(MSG::DEBUG)) { - msg() << MSG::DEBUG << "regProxy: proxy for " << fullProxyName(proxy) - << " already registered with store \"" << storeName << "\"" - << endmsg; - } -#endif + ATH_MSG_DEBUG( "regProxy: proxy for " << fullProxyName(proxy) + << " already registered with store \"" << storeName << "\"" + ); return StatusCode::SUCCESS; } } @@ -216,28 +170,24 @@ IOVSvc::regProxy( const CLID& clid, const std::string& key, std::lock_guard<std::recursive_mutex> lock(m_lock); IIOVSvcTool *ist = getTool( storeName ); if (ist == 0) { - msg() << MSG::ERROR << "regProxy: no IOVSvcTool associated with store \"" - << storeName << "\" and failed to create one." << endmsg; + ATH_MSG_ERROR( "regProxy: no IOVSvcTool associated with store \"" + << storeName << "\" and failed to create one." ); return (StatusCode::FAILURE); } IIOVSvcTool *ist2 = getTool( clid, key ); if (ist2 != 0) { if (ist2 != ist) { - msg() << MSG::ERROR << "regProxy: when registering proxy for " - << fullProxyName(clid,key) - << " with store " << storeName - << ", it is already registered with store \"" - << ist2->getStoreName() << "\"" << endmsg; + ATH_MSG_ERROR( "regProxy: when registering proxy for " + << fullProxyName(clid,key) + << " with store " << storeName + << ", it is already registered with store \"" + << ist2->getStoreName() << "\"" ); return StatusCode::FAILURE; } else { -#ifndef NDEBUG - if (msgLvl(MSG::DEBUG)) { - msg() << MSG::DEBUG << "regProxy: proxy for " << fullProxyName(clid,key) - << " already registered with store \"" << storeName << "\"" - << endmsg; - } -#endif + ATH_MSG_DEBUG( "regProxy: proxy for " << fullProxyName(clid,key) + << " already registered with store \"" << storeName << "\"" + ); return StatusCode::SUCCESS; } } @@ -258,9 +208,8 @@ IOVSvc::deregProxy( const DataProxy *proxy ) { std::lock_guard<std::recursive_mutex> lock(m_lock); IIOVSvcTool *ist = getTool( proxy ); if (ist == 0) { - msg() << MSG::ERROR << "deregProxy: no IOVSvcTool found for proxy " - << fullProxyName( proxy ) - << endmsg; + ATH_MSG_ERROR( "deregProxy: no IOVSvcTool found for proxy " + << fullProxyName( proxy ) ); return (StatusCode::FAILURE); } @@ -280,9 +229,8 @@ IOVSvc::deregProxy( const CLID& clid, const std::string& key ) { std::lock_guard<std::recursive_mutex> lock(m_lock); IIOVSvcTool *ist = getTool( clid, key ); if (ist == 0) { - msg() << MSG::ERROR << "deregProxy: no IOVSvcTool found for proxy " - << fullProxyName(clid,key) - << endmsg; + ATH_MSG_ERROR( "deregProxy: no IOVSvcTool found for proxy " + << fullProxyName(clid,key) ); return StatusCode::FAILURE; } @@ -302,16 +250,15 @@ IOVSvc::ignoreProxy( const CLID& clid, const std::string& key, IIOVSvcTool *ist = getTool( storeName ); if (ist == 0) { - msg() << MSG::ERROR << "ignoreProxy: no IOVSvcTool found for store " - << storeName << " and failed to create one" - << endmsg; + ATH_MSG_ERROR( "ignoreProxy: no IOVSvcTool found for store " + << storeName << " and failed to create one" ); return; } return ist->ignoreProxy( clid, key ); - } + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /// @@ -326,8 +273,8 @@ IOVSvc::replaceProxy( const DataProxy* pOld, const DataProxy* pNew, if (0 != ist) { sc = ist->replaceProxy(pOld, pNew); } else { - msg() << MSG::ERROR << "regProxy: no IOVSvcTool associated with store \"" - << storeName << "\" and failed to create one." << endmsg; + ATH_MSG_ERROR( "regProxy: no IOVSvcTool associated with store \"" + << storeName << "\" and failed to create one." ); } return sc; } @@ -346,8 +293,8 @@ IOVSvc::preLoadTAD( const TransientAddress *tad, IIOVSvcTool *ist = getTool( storeName ); if (ist == 0) { - msg() << MSG::ERROR << "preLoadTAD: no IOVSvcTool associated with store \"" - << storeName << "\" and failed to create one." << endmsg; + ATH_MSG_ERROR( "preLoadTAD: no IOVSvcTool associated with store \"" + << storeName << "\" and failed to create one." ); return StatusCode::FAILURE; } else { return ist->preLoadTAD( tad ); @@ -366,9 +313,8 @@ IOVSvc::preLoadDataTAD( const TransientAddress *tad, IIOVSvcTool *ist = getTool( storeName ); if (ist == 0) { - msg() << MSG::ERROR - << "preLoadDataTAD: no IOVSvcTool associated with store \"" - << storeName << "\" and failed to create one." << endmsg; + ATH_MSG_ERROR( "preLoadDataTAD: no IOVSvcTool associated with store \"" + << storeName << "\" and failed to create one." ); return StatusCode::FAILURE; } else { return ist->preLoadDataTAD( tad ); @@ -390,18 +336,12 @@ IOVSvc::setRange(const CLID& clid, const std::string& key, // FIXME - this should be eliminated once the IOVDbSvc is set up to // use store names. There should be no default store for setRange - msg() << MSG::WARNING << "setRange(CLID,key,range) for unregistered proxies " - << "is deprecated - you need to specify a store! " - << "This will be an ERROR soon!" - << endmsg; + ATH_MSG_WARNING( "setRange(CLID,key,range) for unregistered proxies " + << "is deprecated - you need to specify a store! " + << "This will be an ERROR soon!" ); return setRange(clid,key,iovr, defaultStore ); - // msg() << MSG::ERROR << "setRange: proxy " << fullProxyName(clid, key) - // << " not registered in any store." - // << endmsg; - // return StatusCode::FAILURE; - } else { return ist->setRange( clid, key, iovr ); } @@ -416,24 +356,24 @@ IOVSvc::setRange(const CLID& clid, const std::string& key, IIOVSvcTool *ist = getTool( storeName ); if (ist == 0) { - msg() << MSG::ERROR << "setRange: no IOVSvcTool assocaited with store \"" - << storeName << "\" and failed to create one." << endmsg; + ATH_MSG_ERROR( "setRange: no IOVSvcTool assocaited with store \"" + << storeName << "\" and failed to create one." ); return StatusCode::FAILURE; } IIOVSvcTool *ist2 = getTool( clid, key ); if (ist2 == 0) { - msg() << MSG::INFO << "setRange: proxy for " << fullProxyName(clid,key) - << " not registered with store \"" << storeName << "\". Doing it now" - << endmsg; + ATH_MSG_INFO( "setRange: proxy for " << fullProxyName(clid,key) + << " not registered with store \"" << storeName << "\". Doing it now" + ); if (ist->regProxy(clid, key).isFailure()) { return StatusCode::FAILURE; } } else if (ist2 != ist) { - msg() << MSG::INFO << "setRange: when registering proxy (clid: " - << clid << " key: " << key << ") with store \"" << storeName - << "\" --> already registered with store \"" << ist2->getStoreName() - << "\"" << endmsg; + ATH_MSG_INFO( "setRange: when registering proxy (clid: " + << clid << " key: " << key << ") with store \"" << storeName + << "\" --> already registered with store \"" << ist2->getStoreName() + << "\"" ); return StatusCode::FAILURE; } @@ -451,8 +391,8 @@ IOVSvc::getRange(const CLID& clid, const std::string& key, IIOVSvcTool *ist = getTool( clid, key ); if (ist == 0) { - msg() << MSG::ERROR << "getRange: proxy for " << fullProxyName(clid,key) - << " not registered" << endmsg; + ATH_MSG_ERROR( "getRange: proxy for " << fullProxyName(clid,key) + << " not registered" ); return StatusCode::FAILURE; } else { return ist->getRange( clid, key, iov ); @@ -470,8 +410,8 @@ IOVSvc::getRangeFromDB(const CLID& clid, const std::string& key, IIOVSvcTool *ist = getTool( clid, key ); if (ist == 0) { - msg() << MSG::ERROR << "getRangeFromDB: proxy for " - << fullProxyName(clid,key) << " not registered" << endmsg; + ATH_MSG_ERROR( "getRangeFromDB: proxy for " + << fullProxyName(clid,key) << " not registered" ); return StatusCode::FAILURE; } else { return ist->getRangeFromDB( clid, key, range, tag, ioa ); @@ -490,8 +430,8 @@ IOVSvc::getRangeFromDB(const CLID& clid, const std::string& key, IIOVSvcTool *ist = getTool( clid, key ); if (ist == 0) { - msg() << MSG::ERROR << "getRangeFromDB: proxy for " - << fullProxyName(clid, key) << " not registered" << endmsg; + ATH_MSG_ERROR( "getRangeFromDB: proxy for " + << fullProxyName(clid, key) << " not registered" ); return StatusCode::FAILURE; } else { return ist->getRangeFromDB( clid, key, time, range, tag, ioa ); @@ -507,8 +447,8 @@ IOVSvc::setRangeInDB(const CLID& clid, const std::string& key, IIOVSvcTool *ist = getTool( clid, key ); if (ist == 0) { - msg() << MSG::ERROR << "setRangeInDB: proxy for " - << fullProxyName(clid,key) << " not registered" << endmsg; + ATH_MSG_ERROR( "setRangeInDB: proxy for " + << fullProxyName(clid,key) << " not registered" ); return StatusCode::FAILURE; } else { return ist->setRangeInDB( clid, key, range, tag ); @@ -526,9 +466,9 @@ IOVSvc::regFcn(SG::DataProxy* dp, IIOVSvcTool *ist = getTool( dp ); if (ist == 0) { - msg() << MSG::ERROR << "regFcn: no IOVSvcTool found containing DataProxy " - << fullProxyName( dp ) - << "-> Need to bind DataHandle first" << endmsg; + ATH_MSG_ERROR( "regFcn: no IOVSvcTool found containing DataProxy " + << fullProxyName( dp ) + << "-> Need to bind DataHandle first" ); return StatusCode::FAILURE; } else { return ist->regFcn( dp, c, fcn, trigger ); @@ -544,18 +484,17 @@ IOVSvc::regFcn(const CallBackID c1, if (c1 == c2) { - msg() << MSG::ERROR - << "Cannot register 2nd callback function and assocaited" - << " object with itself" << endmsg; + ATH_MSG_ERROR( "Cannot register 2nd callback function and assocaited" + << " object with itself" ); return StatusCode::FAILURE; } IIOVSvcTool *ist = getTool( c1 ); if (ist == 0) { - msg() << MSG::ERROR << "CallBack function \"" << c2.name() - << "\" cannot be registered since function \"" << c1.name() - << "\" has not been registered first" << endmsg; + ATH_MSG_ERROR( "CallBack function \"" << c2.name() + << "\" cannot be registered since function \"" << c1.name() + << "\" has not been registered first" ); return StatusCode::FAILURE; } else { return ist->regFcn(c1, c2, fcn2, trigger); @@ -572,17 +511,14 @@ IOVSvc::regFcn(const std::string& toolName, IAlgTool *ia; if ( p_toolSvc->retrieveTool(toolName, ia, 0, false).isFailure() ) { - msg() << MSG::ERROR << "AlgTool " << toolName << " has not yet been created" - << " and thus cannot be registered" - << endmsg; - + ATH_MSG_ERROR( "AlgTool " << toolName << " has not yet been created" + << " and thus cannot be registered" ); return StatusCode::FAILURE; } IIOVSvcTool *ist = getTool( ia ); if (ist == 0) { - msg() << MSG::ERROR << "No callback registered with AlgTool " << toolName - << endmsg; + ATH_MSG_ERROR( "No callback registered with AlgTool " << toolName ); return StatusCode::FAILURE; } else { return ist->regFcn(ia, c2, fcn2, trigger); @@ -599,9 +535,8 @@ IOVSvc::getTriggeredTools(const std::string& key, IIOVSvcTool *ist = getTool( storeName, false ); if (ist == 0) { - msg() << MSG::ERROR << "getTriggeredTools: no store \"" << storeName - << "\" associated with any IOVSvcTool" - << endmsg; + ATH_MSG_ERROR( "getTriggeredTools: no store \"" << storeName + << "\" associated with any IOVSvcTool" ); return StatusCode::FAILURE; } else { return ist->getTriggeredTools(key, tools); @@ -615,7 +550,7 @@ IOVSvc::getTriggeredTools(const std::string& key, StatusCode IOVSvc::reinitialize() { - // Set flad to reset all proxies + // Set flag to reset all proxies toolMap::iterator itr = m_toolMap.begin(); for ( ; itr!=m_toolMap.end(); ++itr) { @@ -630,26 +565,20 @@ IOVSvc::reinitialize() /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ StatusCode -IOVSvc::createIOVTool( const std::string& storeName ) { +IOVSvc::createIOVTool( const std::string& storeName, IIOVSvcTool*& ist ) { std::string store(storeName); if (storeName == "default") store = defaultStore; -#ifndef NDEBUG - if (msgLvl(MSG::DEBUG)) { - msg() << MSG::DEBUG - << "Creating IOVSvcTool associated with store \"" << store - << "\"" << endmsg; - } -#endif + ATH_MSG_DEBUG( "Creating IOVSvcTool associated with store \"" << store + << "\"" ); toolMap::iterator itr = m_toolMap.find( store ); if ( itr == m_toolMap.end() ) { - IIOVSvcTool *ist(0); + ist = nullptr; if (p_toolSvc->retrieveTool( "IOVSvcTool/" + store, ist, this ).isFailure()) { - msg() << MSG::ERROR - << "Unable to create IOVSvcTool assocaited with store \"" - << store << "\"" << endmsg; + ATH_MSG_ERROR( "Unable to create IOVSvcTool associated with store \"" + << store << "\"" ); return StatusCode::FAILURE; } else { m_toolMap[ store ] = ist; @@ -657,56 +586,27 @@ IOVSvc::createIOVTool( const std::string& storeName ) { return StatusCode::SUCCESS; } } else { - msg() << MSG::INFO - << "an IOVSvcTool already exists assocaited with store \"" - << store << "\"" << endmsg; + ATH_MSG_INFO( "an IOVSvcTool already exists associated with store \"" + << store << "\"" ); + ist = itr->second; return StatusCode::SUCCESS; } } -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -bool -IOVSvc::createIOVTool( const std::string& storeName, IIOVSvcTool*& ist ) const { - - std::string store(storeName); - if (storeName == "default") store = defaultStore; - -#ifndef NDEBUG - if (msgLvl(MSG::DEBUG)) { - msg() << MSG::DEBUG - << "Creating IOVSvcTool associated with store \"" << store - << "\"" << endmsg; - } -#endif - - ist = 0; - toolMap::const_iterator itr = m_toolMap.find( store ); - if ( itr == m_toolMap.end() ) { - if (p_toolSvc->retrieveTool( "IOVSvcTool/"+store, ist, this ).isFailure()) { - msg() << MSG::ERROR - << "Unable to create IOVSvcTool assocaited with store \"" - << store << "\"" << endmsg; - return false; - } else { - m_toolMap[ store ] = ist; - ist->setStoreName( store ); - } - } else { - msg() << MSG::INFO - << "an IOVSvcTool already exists assocaited with store \"" - << store << "\"" << endmsg; - ist = itr->second; - } - return true; - + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +StatusCode +IOVSvc::createIOVTool( const std::string& storeName ) +{ + IIOVSvcTool* ist = nullptr; + return createIOVTool (storeName, ist); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ IIOVSvcTool* -IOVSvc::getTool( const std::string& storeName, bool createIF ) const { +IOVSvc::getTool( const std::string& storeName, bool createIF ) { std::string store(storeName); if (storeName == "default") { @@ -716,10 +616,12 @@ IOVSvc::getTool( const std::string& storeName, bool createIF ) const { toolMap::const_iterator itr = m_toolMap.find( store ); IIOVSvcTool *ist(0); if ( itr == m_toolMap.end() ) { - msg() << MSG::INFO << "No IOVSvcTool associated with store \"" << store - << "\"" << endmsg; + ATH_MSG_INFO( "No IOVSvcTool associated with store \"" << store + << "\"" ); - if (createIF) createIOVTool(store, ist); + if (createIF) { + createIOVTool(store, ist).ignore(); + } } else { ist = itr->second; @@ -815,7 +717,7 @@ std::string IOVSvc::fullProxyName( const CLID& clid, const std::string& key ) const { std::string fullname, tname; - ostringstream ost; + std::ostringstream ost; ost << clid; if (p_CLIDSvc->getTypeNameOfID( clid, tname ).isFailure()) { fullname = "[" + ost.str() + "/" + key + "]"; @@ -850,12 +752,8 @@ IOVSvc::resetAllProxies() { toolMap::iterator itr = m_toolMap.begin(); for (; itr!= m_toolMap.end(); ++itr) { IIOVSvcTool* ist = itr->second; -#ifndef NDEBUG - if (msgLvl(MSG::DEBUG)) { - msg() << MSG::DEBUG << "resetting all proxies for store \"" - << ist->getStoreName() << "\"" << endmsg; - } -#endif + ATH_MSG_DEBUG( "resetting all proxies for store \"" + << ist->getStoreName() << "\"" ); ist->resetAllProxies(); }