All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
IAlgManager.h
Go to the documentation of this file.
1 // $Id: IAlgManager.h,v 1.7 2008/06/02 14:20:38 marcocle Exp $
2 #ifndef GAUDIKERNEL_IALGMANAGER_H
3 #define GAUDIKERNEL_IALGMANAGER_H
4 
5 // Include files
7 #include "GaudiKernel/SmartIF.h"
9 #include <string>
10 #include <list>
11 
12 // Forward class declaration
13 class IService;
14 class IAlgorithm;
15 class ISvcLocator;
16 
28 class GAUDI_API IAlgManager: virtual public IComponentManager {
29 public:
32 
34  virtual StatusCode addAlgorithm( IAlgorithm* alg // Pointer to the Algorithm
35  ) = 0;
37  virtual StatusCode removeAlgorithm( IAlgorithm* alg // Pointer to the Algorithm
38  ) = 0;
41  virtual StatusCode createAlgorithm( const std::string& algtype, // Algorithm type name
42  const std::string& algname, // Algorithm name to be assigned
43  IAlgorithm*& alg, // Returned algorithm
44  bool managed = false // Flag to indicate if the algorithm is managed
45  ) = 0;
46 #if !defined(GAUDI_V22_API) || defined(G22_NEW_SVCLOCATOR)
47  virtual StatusCode getAlgorithm( const std::string& name, // Algorithm name to be searched
49  IAlgorithm*& alg // Returned algorithm
50  ) const {
51  SmartIF<IAlgorithm> &si = const_cast<IAlgManager*>(this)->algorithm(name, false);
52  alg = si.get();
54  }
55 #endif
56  virtual bool existsAlgorithm( const std::string& name // Algorithm name to be searched
58  ) const = 0;
60  virtual const std::vector<IAlgorithm*>& getAlgorithms() const = 0;
61 
62 #if !defined(GAUDI_V22_API) || defined(G22_NEW_SVCLOCATOR)
63  virtual StatusCode initializeAlgorithms() { return initialize(); }
65 
67  virtual StatusCode startAlgorithms() { return start(); }
68 
70  virtual StatusCode stopAlgorithms() { return stop(); }
71 
73  virtual StatusCode finalizeAlgorithms() { return finalize(); }
74 
77 
79  virtual StatusCode restartAlgorithms() { return restart(); }
80 #endif
81 
83  virtual SmartIF<IAlgorithm> &algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf = true) = 0;
84 
86  template <typename T>
87  inline SmartIF<T> algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf = true) {
88  return SmartIF<T>(algorithm(typeName, createIf));
89  }
90 
91 };
92 
93 
94 #endif // GAUDI_IALGMANAGER_H
DeclareInterfaceID(IComponentManager, 1, 0)
InterfaceID.
virtual StatusCode stopAlgorithms()
Stops the list of "managed" algorithms.
Definition: IAlgManager.h:70
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:26
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:28
virtual StatusCode start()=0
Start (from INITIALIZED to RUNNING).
virtual StatusCode startAlgorithms()
Starts the list of "managed" algorithms.
Definition: IAlgManager.h:67
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
GAUDI_API IAlgorithm * getAlgorithm(const IAlgContextSvc *svc, const AlgSelector &sel)
simple function to get the algorithm from Context Service
Definition: GetAlg.cpp:29
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
virtual StatusCode stop()=0
Stop (from RUNNING to INITIALIZED).
virtual StatusCode reinitialize()=0
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
virtual StatusCode finalizeAlgorithms()
Finalizes the list of "managed" algorithms.
Definition: IAlgManager.h:73
General service interface definition.
Definition: IService.h:19
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:62
virtual StatusCode initialize()=0
Initialization (from CONFIGURED to INITIALIZED).
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:20
virtual StatusCode restart()=0
Initialization (from RUNNING to RUNNING, via INITIALIZED).
virtual StatusCode finalize()=0
Finalize (from INITIALIZED to CONFIGURED).
virtual StatusCode reinitializeAlgorithms()
Initializes the list of "managed" algorithms.
Definition: IAlgManager.h:76
SmartIF< T > algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)
Returns a smart pointer to the requested interface of a service.
Definition: IAlgManager.h:87
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:22
#define GAUDI_API
Definition: Kernel.h:108
virtual StatusCode restartAlgorithms()
Starts the list of "managed" algorithms.
Definition: IAlgManager.h:79