| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

AlgorithmManager.h
Go to the documentation of this file.
1 #ifndef GAUDISVC_ALGORITHMMANAGER_H
2 #define GAUDISVC_ALGORITHMMANAGER_H
3
4 // Include files
5 #include "GaudiKernel/Kernel.h"
6 #include "GaudiKernel/IAlgManager.h"
7 #include "GaudiKernel/IStateful.h"
8 #include "GaudiKernel/ComponentManager.h"
9 #include "GaudiKernel/SmartIF.h"
10 #include "GaudiKernel/IAlgorithm.h"
11 #include <string>
12 #include <vector>
13 #include <map>
14
15 // Forward declarations
16 class ISvcLocator;
17 class IMessageSvc;
18
31 class AlgorithmManager : public extends<ComponentManager,
32 IAlgManager> {
33 public:
34
35 struct AlgorithmItem final {
36 AlgorithmItem(IAlgorithm *s, bool managed = false):
37 algorithm(s), managed(managed) {}
38 SmartIF<IAlgorithm> algorithm;
39 bool managed;
40 inline bool operator==(const std::string &name) const {
41 return algorithm->name() == name;
42 }
43 inline bool operator==(const IAlgorithm *ptr) const {
44 return algorithm.get() == ptr;
45 }
46 };
47
49 typedef std::map<std::string, std::string> AlgTypeAliasesMap;
50
52 AlgorithmManager( IInterface* iface );
54 ~AlgorithmManager() override = default;
55
57 StatusCode addAlgorithm(IAlgorithm* alg) override;
59 StatusCode removeAlgorithm(IAlgorithm* alg) override;
61 StatusCode createAlgorithm(const std::string& algtype, const std::string& algname,
62 IAlgorithm*& algorithm, bool managed = false, bool checkIfExists = true) override;
63
65 bool existsAlgorithm(const std::string& name) const override;
67 const std::vector<IAlgorithm*>& getAlgorithms() const override;
68
70 StatusCode initialize() override;
72 StatusCode start() override;
74 StatusCode stop() override;
76 StatusCode finalize() override;
77
79 StatusCode reinitialize() override;
81 StatusCode restart() override;
82
84 const std::string &name() const override {
85 static const std::string _name = "AlgorithmManager";
86 return _name;
87 }
88
89 SmartIF<IAlgorithm> &algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf = true) override;
90
91 AlgTypeAliasesMap& typeAliases() { return m_algTypeAliases; }
92 const AlgTypeAliasesMap& typeAliases() const { return m_algTypeAliases; }
93
94 private:
95 std::vector<AlgorithmItem> m_algs;
96
98 mutable std::vector<IAlgorithm*> m_listOfPtrs;
99
100 AlgTypeAliasesMap m_algTypeAliases;
101
102 };
103 #endif // GAUDISVC_ALGORITHMFACTORY_H
AlgorithmManager
The AlgorithmManager class is in charge of the creation of concrete instances of Algorithms.
Definition: AlgorithmManager.h:31
AlgorithmManager::initialize
StatusCode initialize() override
Initialization (from CONFIGURED to INITIALIZED).
Definition: AlgorithmManager.cpp:136
AlgorithmManager::AlgorithmItem::AlgorithmItem
AlgorithmItem(IAlgorithm *s, bool managed=false)
Definition: AlgorithmManager.h:36
SmartIF< IAlgorithm >
Kernel.h
AlgorithmManager::addAlgorithm
StatusCode addAlgorithm(IAlgorithm *alg) override
implementation of IAlgManager::addAlgorithm
Definition: AlgorithmManager.cpp:26
AlgorithmManager::start
StatusCode start() override
Start (from INITIALIZED to RUNNING).
Definition: AlgorithmManager.cpp:146
AlgorithmManager::typeAliases
const AlgTypeAliasesMap & typeAliases() const
Definition: AlgorithmManager.h:92
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
AlgorithmManager::name
const std::string & name() const override
Return the name of the manager (implementation of INamedInterface)
Definition: AlgorithmManager.h:84
AlgorithmManager::getAlgorithms
const std::vector< IAlgorithm * > & getAlgorithms() const override
implementation of IAlgManager::getAlgorithms
Definition: AlgorithmManager.cpp:124
AlgorithmManager::m_algTypeAliases
AlgTypeAliasesMap m_algTypeAliases
Definition: AlgorithmManager.h:100
AlgorithmManager::m_algs
std::vector< AlgorithmItem > m_algs
algorithms maintained by AlgorithmManager
Definition: AlgorithmManager.h:95
IAlgorithm.h
AlgorithmManager::AlgorithmItem::managed
bool managed
Definition: AlgorithmManager.h:39
AlgorithmManager::m_listOfPtrs
std::vector< IAlgorithm * > m_listOfPtrs
List of pointers to the know services used to implement getAlgorithms()
Definition: AlgorithmManager.h:98
AlgorithmManager::AlgorithmItem
Definition: AlgorithmManager.h:35
AlgorithmManager::reinitialize
StatusCode reinitialize() override
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
Definition: AlgorithmManager.cpp:181
AlgorithmManager::typeAliases
AlgTypeAliasesMap & typeAliases()
Definition: AlgorithmManager.h:91
std::map< std::string, std::string >
AlgorithmManager::stop
StatusCode stop() override
Stop (from RUNNING to INITIALIZED).
Definition: AlgorithmManager.cpp:156
AlgorithmManager::finalize
StatusCode finalize() override
Finalize (from INITIALIZED to CONFIGURED).
Definition: AlgorithmManager.cpp:166
std::string
STL class.
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:12
AlgorithmManager::existsAlgorithm
bool existsAlgorithm(const std::string &name) const override
implementation of IAlgManager::existsAlgorithm
Definition: AlgorithmManager.cpp:119
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
AlgorithmManager::removeAlgorithm
StatusCode removeAlgorithm(IAlgorithm *alg) override
implementation of IAlgManager::removeAlgorithm
Definition: AlgorithmManager.cpp:32
SmartIF.h
IMessageSvc
The IMessage is the interface implemented by the message service.
Definition: IMessageSvc.h:57
IStateful.h
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:27
AlgorithmManager::AlgTypeAliasesMap
std::map< std::string, std::string > AlgTypeAliasesMap
typedefs and classes
Definition: AlgorithmManager.h:49
std::vector< IAlgorithm * >
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
gaudirun.s
string s
Definition: gaudirun.py:245
AlgorithmManager::AlgorithmItem::operator==
bool operator==(const std::string &name) const
Definition: AlgorithmManager.h:40
IAlgManager.h
AlgorithmManager::AlgorithmManager
AlgorithmManager(IInterface *iface)
default creator
Definition: AlgorithmManager.cpp:19
ComponentManager.h
GaudiDict::typeName
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:21
AlgorithmManager::AlgorithmItem::operator==
bool operator==(const IAlgorithm *ptr) const
Definition: AlgorithmManager.h:43
AlgorithmManager::~AlgorithmManager
~AlgorithmManager() override=default
virtual destructor
AlgorithmManager::createAlgorithm
StatusCode createAlgorithm(const std::string &algtype, const std::string &algname, IAlgorithm *&algorithm, bool managed=false, bool checkIfExists=true) override
implementation of IAlgManager::createAlgorithm
Definition: AlgorithmManager.cpp:42
AlgorithmManager::AlgorithmItem::algorithm
SmartIF< IAlgorithm > algorithm
Definition: AlgorithmManager.h:38
AlgorithmManager::restart
StatusCode restart() override
Initialization (from RUNNING to RUNNING, via INITIALIZED).
Definition: AlgorithmManager.cpp:194