Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:00:28

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #ifndef COMPONENTMANAGER_H_
0012 #define COMPONENTMANAGER_H_
0013 
0014 #include "GaudiKernel/CommonMessaging.h"
0015 #include "GaudiKernel/IComponentManager.h"
0016 
0017 class ApplicationMgr;
0018 
0019 /** @class ComponentManager ComponentManager.h
0020  *
0021  * Base class for a component manager.
0022  *
0023  * @author Marco Clemencic
0024  */
0025 class GAUDI_API ComponentManager : public CommonMessaging<implements<IComponentManager>> {
0026 public:
0027   /// Constructor.
0028   /// @param application    the manager of managers
0029   ComponentManager( IInterface* application, const InterfaceID& baseIID );
0030 
0031   /// Basic interface id of the managed components.
0032   const InterfaceID& componentBaseInterface() const override;
0033 
0034   /// Specialized queryInterface implementation.
0035   /// If an interface is not fount in the implemented ones, we fall back on the
0036   /// owner.
0037   StatusCode queryInterface( const InterfaceID& iid, void** pinterface ) override;
0038 
0039   SmartIF<ISvcLocator>& serviceLocator() const override {
0040     if ( !m_svcLocator ) m_svcLocator = m_application;
0041     return m_svcLocator;
0042   }
0043 
0044   /// Configuration (from OFFLINE to CONFIGURED).
0045   StatusCode configure() override { return StatusCode::SUCCESS; }
0046 
0047   /// Initialization (from CONFIGURED to INITIALIZED).
0048   StatusCode initialize() override { return StatusCode::SUCCESS; }
0049 
0050   /// Start (from INITIALIZED to RUNNING).
0051   StatusCode start() override { return StatusCode::SUCCESS; }
0052 
0053   /// Stop (from RUNNING to INITIALIZED).
0054   StatusCode stop() override { return StatusCode::SUCCESS; }
0055 
0056   /// Finalize (from INITIALIZED to CONFIGURED).
0057   StatusCode finalize() override { return StatusCode::SUCCESS; }
0058 
0059   /// Initialization (from CONFIGURED to OFFLINE).
0060   StatusCode terminate() override { return StatusCode::SUCCESS; }
0061 
0062   /// Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
0063   StatusCode reinitialize() override { return StatusCode::SUCCESS; }
0064 
0065   /// Initialization (from RUNNING to RUNNING, via INITIALIZED).
0066   StatusCode restart() override { return StatusCode::SUCCESS; }
0067 
0068   /// Get the current state.
0069   Gaudi::StateMachine::State FSMState() const override { return m_stateful->FSMState(); }
0070 
0071   /// When we are in the middle of a transition, get the state where the
0072   /// transition is leading us. Otherwise it returns the same state as state().
0073   Gaudi::StateMachine::State targetFSMState() const override { return m_stateful->targetFSMState(); }
0074 
0075 protected:
0076   /// Pointer to the owner of the manager
0077   SmartIF<IInterface> m_application;
0078 
0079   /// Pointer to the IStateful interface of the owner
0080   SmartIF<IStateful> m_stateful;
0081 
0082   /// Basic interface id of the managed components.
0083   InterfaceID m_basicInterfaceId;
0084 
0085   /// Service locator (needed to access the MessageSvc)
0086   mutable SmartIF<ISvcLocator> m_svcLocator;
0087 
0088   friend ApplicationMgr;
0089 };
0090 
0091 #endif /* COMPONENTMANAGER_H_ */