| The Gaudi Framework v29r1 (5cd95fa2)

- 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/ComponentManager.h"
6 #include "GaudiKernel/IAlgManager.h"
7 #include "GaudiKernel/IAlgorithm.h"
8 #include "GaudiKernel/IStateful.h"
9 #include "GaudiKernel/Kernel.h"
10 #include "GaudiKernel/SmartIF.h"
11 #include <map>
12 #include <string>
13 #include <vector>
14
15 // Forward declarations
16 class ISvcLocator;
17 class IMessageSvc;
18
31 class AlgorithmManager : public extends<ComponentManager, IAlgManager>
32 {
33 public:
34 struct AlgorithmItem final {
35 AlgorithmItem( IAlgorithm* s, bool managed = false ) : algorithm( s ), managed( managed ) {}
36 SmartIF<IAlgorithm> algorithm;
37 bool managed;
38 inline bool operator==( const std::string& name ) const { return algorithm->name() == name; }
39 inline bool operator==( const IAlgorithm* ptr ) const { return algorithm.get() == ptr; }
40 };
41
43 typedef std::map<std::string, std::string> AlgTypeAliasesMap;
44
46 AlgorithmManager( IInterface* iface );
48 ~AlgorithmManager() override = default;
49
51 StatusCode addAlgorithm( IAlgorithm* alg ) override;
53 StatusCode removeAlgorithm( IAlgorithm* alg ) override;
55 StatusCode createAlgorithm( const std::string& algtype, const std::string& algname, IAlgorithm*& algorithm,
56 bool managed = false, bool checkIfExists = true ) override;
57
59 bool existsAlgorithm( const std::string& name ) const override;
61 const std::vector<IAlgorithm*>& getAlgorithms() const override;
62
64 StatusCode initialize() override;
66 StatusCode start() override;
68 StatusCode stop() override;
70 StatusCode finalize() override;
71
73 StatusCode reinitialize() override;
75 StatusCode restart() override;
76
78 const std::string& name() const override
79 {
80 static const std::string _name = "AlgorithmManager";
81 return _name;
82 }
83
84 SmartIF<IAlgorithm>& algorithm( const Gaudi::Utils::TypeNameString& typeName, const bool createIf = true ) override;
85
86 AlgTypeAliasesMap& typeAliases() { return m_algTypeAliases; }
87 const AlgTypeAliasesMap& typeAliases() const { return m_algTypeAliases; }
88
90 void outputLevelUpdate() override;
91
92 private:
93 std::vector<AlgorithmItem> m_algs;
94
96 mutable std::vector<IAlgorithm*> m_listOfPtrs;
97
98 AlgTypeAliasesMap m_algTypeAliases;
99 };
100 #endif // GAUDISVC_ALGORITHMFACTORY_H
AlgorithmManager
The AlgorithmManager class is in charge of the creation of concrete instances of Algorithms.
Definition: AlgorithmManager.h:31
AlgorithmManager::outputLevelUpdate
void outputLevelUpdate() override
Function to call to update the outputLevel of the components (after a change in MessageSvc).
Definition: AlgorithmManager.cpp:220
AlgorithmManager::initialize
StatusCode initialize() override
Initialization (from CONFIGURED to INITIALIZED).
Definition: AlgorithmManager.cpp:134
AlgorithmManager::AlgorithmItem::AlgorithmItem
AlgorithmItem(IAlgorithm *s, bool managed=false)
Definition: AlgorithmManager.h:35
SmartIF< IAlgorithm >
Kernel.h
AlgorithmManager::addAlgorithm
StatusCode addAlgorithm(IAlgorithm *alg) override
implementation of IAlgManager::addAlgorithm
Definition: AlgorithmManager.cpp:25
AlgorithmManager::start
StatusCode start() override
Start (from INITIALIZED to RUNNING).
Definition: AlgorithmManager.cpp:145
AlgorithmManager::typeAliases
const AlgTypeAliasesMap & typeAliases() const
Definition: AlgorithmManager.h:87
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:78
AlgorithmManager::getAlgorithms
const std::vector< IAlgorithm * > & getAlgorithms() const override
implementation of IAlgManager::getAlgorithms
Definition: AlgorithmManager.cpp:125
AlgorithmManager::m_algTypeAliases
AlgTypeAliasesMap m_algTypeAliases
Definition: AlgorithmManager.h:98
AlgorithmManager::m_algs
std::vector< AlgorithmItem > m_algs
algorithms maintained by AlgorithmManager
Definition: AlgorithmManager.h:93
IAlgorithm.h
AlgorithmManager::AlgorithmItem::managed
bool managed
Definition: AlgorithmManager.h:37
AlgorithmManager::m_listOfPtrs
std::vector< IAlgorithm * > m_listOfPtrs
List of pointers to the know services used to implement getAlgorithms()
Definition: AlgorithmManager.h:96
AlgorithmManager::AlgorithmItem
Definition: AlgorithmManager.h:34
AlgorithmManager::reinitialize
StatusCode reinitialize() override
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
Definition: AlgorithmManager.cpp:183
AlgorithmManager::typeAliases
AlgTypeAliasesMap & typeAliases()
Definition: AlgorithmManager.h:86
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:167
std::string
STL class.
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
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:28
IInterface
Definition of the basic interface.
Definition: IInterface.h:277
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:38
IStateful.h
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:28
AlgorithmManager::AlgTypeAliasesMap
std::map< std::string, std::string > AlgTypeAliasesMap
typedefs and classes
Definition: AlgorithmManager.h:43
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:253
AlgorithmManager::AlgorithmItem::operator==
bool operator==(const std::string &name) const
Definition: AlgorithmManager.h:38
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:23
AlgorithmManager::AlgorithmItem::operator==
bool operator==(const IAlgorithm *ptr) const
Definition: AlgorithmManager.h:39
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:43
AlgorithmManager::AlgorithmItem::algorithm
SmartIF< IAlgorithm > algorithm
Definition: AlgorithmManager.h:36
AlgorithmManager::restart
StatusCode restart() override
Initialization (from RUNNING to RUNNING, via INITIALIZED).
Definition: AlgorithmManager.cpp:197