Skip to content
Snippets Groups Projects
Commit c1d7111d authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Merge branch 'dev-stateful' into 'master'

make IStateful baseclass of IAlgTool, IAlgorithm and IService

IAlgTool, IAlgorithm and IService all declare the following pure
virtual functions:
      configure,initialize,start,stop,finalize,terminate,reinitialize
      restart and FSMState
which, presumable not by coincidence, also happens to be the
functions which IStateful declares.

This commit removes those declarations from IAlgTool, IAlgorithm
and IService, and instead makes them inherit from IStateful

Fixes GAUDI-1092

See merge request !23
parents 35dd00c0 e6c4f19c
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// Include files // Include files
#include "GaudiKernel/INamedInterface.h" #include "GaudiKernel/INamedInterface.h"
#include "GaudiKernel/StateMachine.h" #include "GaudiKernel/IStateful.h"
#include <string> #include <string>
// Forward declarations // Forward declarations
...@@ -19,10 +19,10 @@ class IAlgorithm; ...@@ -19,10 +19,10 @@ class IAlgorithm;
@author Pere Mato @author Pere Mato
@date 15/11/01 version 2 introduced @date 15/11/01 version 2 introduced
*/ */
class GAUDI_API IAlgTool: virtual public INamedInterface { class GAUDI_API IAlgTool: virtual public extend_interfaces2<INamedInterface,IStateful> {
public: public:
/// InterfaceID /// InterfaceID
DeclareInterfaceID(IAlgTool,3,0); DeclareInterfaceID(IAlgTool,4,0);
/// Virtual destructor /// Virtual destructor
~IAlgTool() override = default; ~IAlgTool() override = default;
...@@ -35,44 +35,6 @@ public: ...@@ -35,44 +35,6 @@ public:
*/ */
virtual const IInterface* parent() const = 0; virtual const IInterface* parent() const = 0;
// --- Methods from IStateful ---
/** Configuration (from OFFLINE to CONFIGURED).
*/
virtual StatusCode configure() = 0;
/** Initialization (from CONFIGURED to INITIALIZED).
*/
virtual StatusCode initialize() = 0;
/** Start (from INITIALIZED to RUNNING).
*/
virtual StatusCode start() = 0;
/** Stop (from RUNNING to INITIALIZED).
*/
virtual StatusCode stop() = 0;
/** Finalize (from INITIALIZED to CONFIGURED).
*/
virtual StatusCode finalize() = 0;
/** Initialization (from CONFIGURED to OFFLINE).
*/
virtual StatusCode terminate() = 0;
/** Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
*/
virtual StatusCode reinitialize() = 0;
/** Initialization (from RUNNING to RUNNING, via INITIALIZED).
*/
virtual StatusCode restart() = 0;
/** Get the current state.
*/
virtual Gaudi::StateMachine::State FSMState() const = 0;
/** Initialization of the Tool. This method is called typically /** Initialization of the Tool. This method is called typically
* by the ToolSvc. It allows to complete the initialization that * by the ToolSvc. It allows to complete the initialization that
* could not be done with a simply a constructor. * could not be done with a simply a constructor.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// Include files // Include files
#include "GaudiKernel/INamedInterface.h" #include "GaudiKernel/INamedInterface.h"
#include "GaudiKernel/StateMachine.h" #include "GaudiKernel/IStateful.h"
#include <string> #include <string>
/** @class IAlgorithm IAlgorithm.h GaudiKernel/IAlgorithm.h /** @class IAlgorithm IAlgorithm.h GaudiKernel/IAlgorithm.h
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
@author D.Quarrie @author D.Quarrie
@author Marco Clemencic @author Marco Clemencic
*/ */
class GAUDI_API IAlgorithm : virtual public INamedInterface { class GAUDI_API IAlgorithm : virtual public extend_interfaces2<INamedInterface, IStateful> {
public: public:
/// InterfaceID /// InterfaceID
DeclareInterfaceID(IAlgorithm,4,0); DeclareInterfaceID(IAlgorithm,5,0);
/** The version of the algorithm /** The version of the algorithm
*/ */
...@@ -37,43 +37,6 @@ public: ...@@ -37,43 +37,6 @@ public:
/// check if the algorithm is already executed for the current event /// check if the algorithm is already executed for the current event
virtual bool isExecuted() const = 0; virtual bool isExecuted() const = 0;
// --- Methods from IStateful ---
/** Configuration (from OFFLINE to CONFIGURED).
*/
virtual StatusCode configure() = 0;
/** Initialization (from CONFIGURED to INITIALIZED).
*/
virtual StatusCode initialize() = 0;
/** Start (from INITIALIZED to RUNNING).
*/
virtual StatusCode start() = 0;
/** Stop (from RUNNING to INITIALIZED).
*/
virtual StatusCode stop() = 0;
/** Finalize (from INITIALIZED to CONFIGURED).
*/
virtual StatusCode finalize() = 0;
/** Initialization (from CONFIGURED to OFFLINE).
*/
virtual StatusCode terminate() = 0;
/** Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
*/
virtual StatusCode reinitialize() = 0;
/** Initialization (from RUNNING to RUNNING, via INITIALIZED).
*/
virtual StatusCode restart() = 0;
/** Get the current state.
*/
virtual Gaudi::StateMachine::State FSMState() const = 0;
/** Initialization method invoked by the framework. This method is responsible /** Initialization method invoked by the framework. This method is responsible
for any bookkeeping of initialization required by the framework itself. for any bookkeeping of initialization required by the framework itself.
It will in turn invoke the initialize() method of the derived algorithm, It will in turn invoke the initialize() method of the derived algorithm,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// Include files // Include files
#include "GaudiKernel/INamedInterface.h" #include "GaudiKernel/INamedInterface.h"
#include "GaudiKernel/StateMachine.h" #include "GaudiKernel/IStateful.h"
#include <string> #include <string>
/** @class IService IService.h GaudiKernel/IService.h /** @class IService IService.h GaudiKernel/IService.h
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
class ISvcManager; class ISvcManager;
class ServiceManager; class ServiceManager;
class GAUDI_API IService: virtual public INamedInterface { class GAUDI_API IService: virtual public extend_interfaces2<INamedInterface,IStateful> {
friend class ServiceManager; friend class ServiceManager;
public: public:
/// InterfaceID /// InterfaceID
DeclareInterfaceID(IService,3,0); DeclareInterfaceID(IService,4,0);
/// Initialize Service /// Initialize Service
virtual StatusCode sysInitialize() = 0; virtual StatusCode sysInitialize() = 0;
...@@ -34,49 +34,6 @@ public: ...@@ -34,49 +34,6 @@ public:
/// Re-start the Service /// Re-start the Service
virtual StatusCode sysRestart() = 0; virtual StatusCode sysRestart() = 0;
// --- Methods from IStateful ---
/** Configuration (from OFFLINE to CONFIGURED).
*/
virtual StatusCode configure() = 0;
/** Initialization (from CONFIGURED to INITIALIZED).
*/
virtual StatusCode initialize() = 0;
/** Start (from INITIALIZED to RUNNING).
*/
virtual StatusCode start() = 0;
/** Stop (from RUNNING to INITIALIZED).
*/
virtual StatusCode stop() = 0;
/** Finalize (from INITIALIZED to CONFIGURED).
*/
virtual StatusCode finalize() = 0;
/** Initialization (from CONFIGURED to OFFLINE).
*/
virtual StatusCode terminate() = 0;
/** Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
*/
virtual StatusCode reinitialize() = 0;
/** Initialization (from RUNNING to RUNNING, via INITIALIZED).
*/
virtual StatusCode restart() = 0;
/** Get the current state.
*/
virtual Gaudi::StateMachine::State FSMState() const = 0;
/** When we are in the middle of a transition, get the state where the
* transition is leading us. Otherwise it returns the same state as state().
*/
virtual Gaudi::StateMachine::State targetFSMState() const = 0;
/// virtual destructor /// virtual destructor
virtual ~IService() = default; virtual ~IService() = default;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment