From fe7a7e058695ebcd5ac959792d144ea9f9c216ca Mon Sep 17 00:00:00 2001 From: Tamara Vazquez Schroeder <tamara.vazquez.schroeder@cern.ch> Date: Tue, 20 Mar 2018 20:11:56 +0000 Subject: [PATCH] Merge branch 'IMagFieldSvcDropQueryInterface_21.0' into '21.0' Update interface declaration syntax in IMagFieldSvc implementations See merge request atlas/athena!9646 --- .../src/ForwardRegionFieldSvc.cxx | 23 +------------------ .../src/ForwardRegionFieldSvc.h | 3 +-- .../MagFieldInterfaces/IMagFieldSvc.h | 12 ++++------ .../MagFieldServices/AtlasFieldSvc.h | 5 +--- .../MagFieldServices/H8FieldSvc.h | 5 +--- .../MagFieldServices/src/AtlasFieldSvc.cxx | 18 +-------------- .../MagFieldServices/src/H8FieldSvc.cxx | 17 +------------- 7 files changed, 10 insertions(+), 73 deletions(-) diff --git a/ForwardDetectors/ForwardSimulation/ForwardRegionMgField/src/ForwardRegionFieldSvc.cxx b/ForwardDetectors/ForwardSimulation/ForwardRegionMgField/src/ForwardRegionFieldSvc.cxx index b281adcb6909..2a213beae3d0 100644 --- a/ForwardDetectors/ForwardSimulation/ForwardRegionMgField/src/ForwardRegionFieldSvc.cxx +++ b/ForwardDetectors/ForwardSimulation/ForwardRegionMgField/src/ForwardRegionFieldSvc.cxx @@ -34,8 +34,7 @@ // static ForwardRegionMgField q6vkick("Q6VKick",ForwardRegionField::Q6VKick); MagField::ForwardRegionFieldSvc::ForwardRegionFieldSvc(const std::string& name,ISvcLocator* svc) : - AthService(name,svc), - IMagFieldSvc(), + base_class(name,svc), m_magnet(-1), m_magDataType(0), m_MQXA_DataFile(""), //"MQXA_NOMINAL.dat" if name = Q1 or Q3 @@ -104,26 +103,6 @@ StatusCode MagField::ForwardRegionFieldSvc::initialize() return StatusCode::SUCCESS; } -// Query the interfaces -StatusCode MagField::ForwardRegionFieldSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) -{ - if(IIncidentListener::interfaceID().versionMatch(riid)) - { - *ppvInterface = dynamic_cast<IIncidentListener*>(this); - } - else if(IMagFieldSvc::interfaceID().versionMatch(riid)) - { - *ppvInterface = dynamic_cast<IMagFieldSvc*>(this); - } - else - { - // Interface is not directly available: try out a base class - return AthService::queryInterface(riid, ppvInterface); - } - addRef(); - return StatusCode::SUCCESS; -} - // Handle incident function - if BeginRun happens, initialize mag. fields void MagField::ForwardRegionFieldSvc::handle(const Incident& runIncident) { diff --git a/ForwardDetectors/ForwardSimulation/ForwardRegionMgField/src/ForwardRegionFieldSvc.h b/ForwardDetectors/ForwardSimulation/ForwardRegionMgField/src/ForwardRegionFieldSvc.h index 5ebd1551076f..90e6ee08f432 100644 --- a/ForwardDetectors/ForwardSimulation/ForwardRegionMgField/src/ForwardRegionFieldSvc.h +++ b/ForwardDetectors/ForwardSimulation/ForwardRegionMgField/src/ForwardRegionFieldSvc.h @@ -26,7 +26,7 @@ namespace MagField { - class ForwardRegionFieldSvc : public IMagFieldSvc, virtual public IIncidentListener, virtual public AthService { + class ForwardRegionFieldSvc : public extends<AthService, IMagFieldSvc, IIncidentListener> { /////////////////////////////////////////////////////////////////// // Public methods: /////////////////////////////////////////////////////////////////// @@ -36,7 +36,6 @@ namespace MagField { /** AthService interface methods */ StatusCode initialize() override final; - StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ) override final; /** IIncidentListener interface methods **/ void handle(const Incident& runIncident) override final; diff --git a/MagneticField/MagFieldInterfaces/MagFieldInterfaces/IMagFieldSvc.h b/MagneticField/MagFieldInterfaces/MagFieldInterfaces/IMagFieldSvc.h index 376bb026e073..a287d7da212f 100644 --- a/MagneticField/MagFieldInterfaces/MagFieldInterfaces/IMagFieldSvc.h +++ b/MagneticField/MagFieldInterfaces/MagFieldInterfaces/IMagFieldSvc.h @@ -17,9 +17,6 @@ // Amg classes #include "GeoPrimitives/GeoPrimitives.h" -/** Declaration of the interface ID ( interface id, major version, minor version) */ -static const InterfaceID IID_IMagFieldSvc("IMagFieldSvc", 1, 0); - namespace MagField { /** @ class IMagFieldSvc @@ -32,14 +29,13 @@ namespace MagField { // Public methods: /////////////////////////////////////////////////////////////////// public: + + /** Creates the InterfaceID and interfaceID() method */ + DeclareInterfaceID(IMagFieldSvc, 1, 0); + /** constructor */ IMagFieldSvc() : m_solenoidCurrent(0.0), m_toroidCurrent(0.0) {;} - /** Retrieve interface ID */ - static const InterfaceID& interfaceID() { - return IID_IMagFieldSvc; - } - /** get B field value at given position */ /** xyz[3] is in mm, bxyz[3] is in kT */ /** if deriv[9] is given, field derivatives are returned in kT/mm */ diff --git a/MagneticField/MagFieldServices/MagFieldServices/AtlasFieldSvc.h b/MagneticField/MagFieldServices/MagFieldServices/AtlasFieldSvc.h index c1d4cd025e02..8d57bf92d763 100644 --- a/MagneticField/MagFieldServices/MagFieldServices/AtlasFieldSvc.h +++ b/MagneticField/MagFieldServices/MagFieldServices/AtlasFieldSvc.h @@ -40,7 +40,7 @@ namespace MagField { @author Elmar.Ritsch -at- cern.ch */ - class AtlasFieldSvc : public IMagFieldSvc, virtual public IIncidentListener, virtual public AthService { + class AtlasFieldSvc : public extends<AthService, IMagFieldSvc, IIncidentListener> { public: //** Constructor with parameters */ @@ -56,9 +56,6 @@ namespace MagField { /** Read **/ virtual void handle(const Incident& runIncident) override; - /** Query the interfaces **/ - virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ) override; - /** Call back for possible magnet current update **/ StatusCode updateCurrent(IOVSVC_CALLBACK_ARGS); diff --git a/MagneticField/MagFieldServices/MagFieldServices/H8FieldSvc.h b/MagneticField/MagFieldServices/MagFieldServices/H8FieldSvc.h index cbd86810941a..dd525f5fee94 100644 --- a/MagneticField/MagFieldServices/MagFieldServices/H8FieldSvc.h +++ b/MagneticField/MagFieldServices/MagFieldServices/H8FieldSvc.h @@ -28,7 +28,7 @@ class CondAttrListCollection; namespace MagField { - class H8FieldSvc : public IMagFieldSvc, virtual public AthService { + class H8FieldSvc : public extends<AthService, IMagFieldSvc> { public: //** Constructor with parameters */ @@ -42,9 +42,6 @@ namespace MagField { StatusCode start(); StatusCode finalize(); - /** Query the interfaces **/ - StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ); - /** get B field value at given position */ /** xyz[3] is in mm, bxyz[3] is in kT */ /** if deriv[9] is given, field derivatives are returned in kT/mm */ diff --git a/MagneticField/MagFieldServices/src/AtlasFieldSvc.cxx b/MagneticField/MagFieldServices/src/AtlasFieldSvc.cxx index 37c2e3046213..12ac78bc9248 100644 --- a/MagneticField/MagFieldServices/src/AtlasFieldSvc.cxx +++ b/MagneticField/MagFieldServices/src/AtlasFieldSvc.cxx @@ -33,8 +33,7 @@ /** Constructor **/ MagField::AtlasFieldSvc::AtlasFieldSvc(const std::string& name,ISvcLocator* svc) : - AthService(name,svc), - IMagFieldSvc(), + base_class(name,svc), m_fullMapFilename("MagneticFieldMaps/bfieldmap_7730_20400_14m.root"), m_soleMapFilename("MagneticFieldMaps/bfieldmap_7730_0_14m.root"), m_toroMapFilename("MagneticFieldMaps/bfieldmap_0_20400_14m.root"), @@ -553,21 +552,6 @@ void MagField::AtlasFieldSvc::getFieldZR(const double *xyz, double *bxyz, double cacheZR.getB(xyz, r, bxyz, deriv); } -/** Query the interfaces. */ -StatusCode MagField::AtlasFieldSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) -{ - if ( IIncidentListener::interfaceID().versionMatch(riid) ) { - *ppvInterface = dynamic_cast<IIncidentListener*>(this); - } else if ( MagField::IMagFieldSvc::interfaceID().versionMatch(riid) ) { - *ppvInterface = dynamic_cast<MagField::IMagFieldSvc*>(this); - } else { - // Interface is not directly available: try out a base class - return Service::queryInterface(riid, ppvInterface); - } - addRef(); - return StatusCode::SUCCESS; -} - // // Clear the map. // Subsequent call should return zero magnetic field. diff --git a/MagneticField/MagFieldServices/src/H8FieldSvc.cxx b/MagneticField/MagFieldServices/src/H8FieldSvc.cxx index 6c69bf0b84cb..cb8700a180bf 100644 --- a/MagneticField/MagFieldServices/src/H8FieldSvc.cxx +++ b/MagneticField/MagFieldServices/src/H8FieldSvc.cxx @@ -28,8 +28,7 @@ /** Constructor **/ MagField::H8FieldSvc::H8FieldSvc( const std::string& name,ISvcLocator* svc ) : - AthService(name,svc), - IMagFieldSvc(), + base_class(name,svc), m_H8MapFilename("MagneticFieldMaps/mbps1-all-id-800-mbps2-muons-800x4.data"), m_dx1(0), m_dy1(0), @@ -157,17 +156,3 @@ void MagField::H8FieldSvc::getFieldZR( const double *xyz, double *B, double *der getField( xyz, B, deriv ); return; } - -/** Query the interfaces. */ -StatusCode MagField::H8FieldSvc::queryInterface( const InterfaceID& riid, void** ppvInterface ) -{ - if ( IID_IMagFieldSvc == riid ) { - *ppvInterface = (MagField::IMagFieldSvc*)this; - } else { - // Interface is not directly available: try out a base class - return Service::queryInterface(riid, ppvInterface); - } - addRef(); - return StatusCode::SUCCESS; -} - -- GitLab