The Gaudi Framework  master (42b00024)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
IAlgManager.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIKERNEL_IALGMANAGER_H
12 #define GAUDIKERNEL_IALGMANAGER_H
13 
14 // Include files
16 #include <GaudiKernel/SmartIF.h>
18 #include <list>
19 #include <string>
20 
21 // Forward class declaration
22 class IService;
23 class IAlgorithm;
24 class ISvcLocator;
25 
37 class GAUDI_API IAlgManager : virtual public IComponentManager {
38 public:
41 
43  virtual StatusCode addAlgorithm( IAlgorithm* alg // Pointer to the Algorithm
44  ) = 0;
46  virtual StatusCode removeAlgorithm( IAlgorithm* alg // Pointer to the Algorithm
47  ) = 0;
50  virtual StatusCode createAlgorithm( const std::string& algtype, // Algorithm type name
51  const std::string& algname, // Algorithm name to be assigned
52  IAlgorithm*& alg, // Returned algorithm
53  bool managed = false, // Flag to indicate if the algorithm is managed
54  bool checkIfExists = true // Flag to indicate if clones of existing algorithms can
55  // be created
56  ) = 0;
58  virtual bool existsAlgorithm( std::string_view name // Algorithm name to be searched
59  ) const = 0;
61  virtual std::vector<IAlgorithm*> getAlgorithms() const = 0;
62 
65  const bool createIf = true ) = 0;
66 
68  template <typename T>
69  inline SmartIF<T> algorithm( const Gaudi::Utils::TypeNameString& typeName, const bool createIf = true ) {
70  return SmartIF<T>( algorithm( typeName, createIf ) );
71  }
72 };
73 
74 #endif // GAUDI_IALGMANAGER_H
IService
Definition: IService.h:28
IAlgManager::addAlgorithm
virtual StatusCode addAlgorithm(IAlgorithm *alg)=0
Add an algorithm to the list of known algorithms.
ISvcLocator
Definition: ISvcLocator.h:46
IAlgManager::algorithm
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:69
IAlgManager::removeAlgorithm
virtual StatusCode removeAlgorithm(IAlgorithm *alg)=0
Remove an algorithm from the list of known algorithms.
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:81
IAlgManager::getAlgorithms
virtual std::vector< IAlgorithm * > getAlgorithms() const =0
Return the list of Algorithms.
IAlgManager
Definition: IAlgManager.h:37
SmartIF.h
IAlgManager::algorithm
virtual SmartIF< IAlgorithm > & algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:20
StatusCode
Definition: StatusCode.h:65
IAlgorithm
Definition: IAlgorithm.h:38
SmartIF< IAlgorithm >
TypeNameString.h
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
IAlgManager::DeclareInterfaceID
DeclareInterfaceID(IAlgManager, 6, 0)
InterfaceID.
GaudiDict::typeName
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:31
IComponentManager.h
IAlgManager::createAlgorithm
virtual StatusCode createAlgorithm(const std::string &algtype, const std::string &algname, IAlgorithm *&alg, bool managed=false, bool checkIfExists=true)=0
Create an instance of a algorithm type that has been declared beforehand and assigns to it a name.
IComponentManager
Definition: IComponentManager.h:21
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:84
IAlgManager::existsAlgorithm
virtual bool existsAlgorithm(std::string_view name) const =0
Check the existence of an algorithm with a given name in the list of known algorithms.