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
Branches
Tags
No related merge requests found
......@@ -3,7 +3,7 @@
// Include files
#include "GaudiKernel/INamedInterface.h"
#include "GaudiKernel/StateMachine.h"
#include "GaudiKernel/IStateful.h"
#include <string>
// Forward declarations
......@@ -19,10 +19,10 @@ class IAlgorithm;
@author Pere Mato
@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:
/// InterfaceID
DeclareInterfaceID(IAlgTool,3,0);
DeclareInterfaceID(IAlgTool,4,0);
/// Virtual destructor
~IAlgTool() override = default;
......@@ -35,44 +35,6 @@ public:
*/
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
* by the ToolSvc. It allows to complete the initialization that
* could not be done with a simply a constructor.
......
......@@ -3,7 +3,7 @@
// Include files
#include "GaudiKernel/INamedInterface.h"
#include "GaudiKernel/StateMachine.h"
#include "GaudiKernel/IStateful.h"
#include <string>
/** @class IAlgorithm IAlgorithm.h GaudiKernel/IAlgorithm.h
......@@ -16,10 +16,10 @@
@author D.Quarrie
@author Marco Clemencic
*/
class GAUDI_API IAlgorithm : virtual public INamedInterface {
class GAUDI_API IAlgorithm : virtual public extend_interfaces2<INamedInterface, IStateful> {
public:
/// InterfaceID
DeclareInterfaceID(IAlgorithm,4,0);
DeclareInterfaceID(IAlgorithm,5,0);
/** The version of the algorithm
*/
......@@ -37,43 +37,6 @@ public:
/// check if the algorithm is already executed for the current event
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
for any bookkeeping of initialization required by the framework itself.
It will in turn invoke the initialize() method of the derived algorithm,
......
......@@ -3,7 +3,7 @@
// Include files
#include "GaudiKernel/INamedInterface.h"
#include "GaudiKernel/StateMachine.h"
#include "GaudiKernel/IStateful.h"
#include <string>
/** @class IService IService.h GaudiKernel/IService.h
......@@ -15,11 +15,11 @@
class ISvcManager;
class ServiceManager;
class GAUDI_API IService: virtual public INamedInterface {
class GAUDI_API IService: virtual public extend_interfaces2<INamedInterface,IStateful> {
friend class ServiceManager;
public:
/// InterfaceID
DeclareInterfaceID(IService,3,0);
DeclareInterfaceID(IService,4,0);
/// Initialize Service
virtual StatusCode sysInitialize() = 0;
......@@ -34,49 +34,6 @@ public:
/// Re-start the Service
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 ~IService() = default;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment