The Gaudi Framework  v33r1 (b1225454)
IAlgManager.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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( std::string algtype, // Algorithm type name
51  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;
57 #if !defined( GAUDI_V22_API ) || defined( G22_NEW_SVCLOCATOR )
58  virtual StatusCode getAlgorithm( std::string_view name, // Algorithm name to be searched
60  IAlgorithm*& alg // Returned algorithm
61  ) const {
62  SmartIF<IAlgorithm>& si = const_cast<IAlgManager*>( this )->algorithm( name, false );
63  alg = si.get();
65  }
66 #endif
67  virtual bool existsAlgorithm( std::string_view name // Algorithm name to be searched
69  ) const = 0;
71  virtual const std::vector<IAlgorithm*>& getAlgorithms() const = 0;
72 
75  const bool createIf = true ) = 0;
76 
78  template <typename T>
79  inline SmartIF<T> algorithm( const Gaudi::Utils::TypeNameString& typeName, const bool createIf = true ) {
80  return SmartIF<T>( algorithm( typeName, createIf ) );
81  }
82 };
83 
84 #endif // GAUDI_IALGMANAGER_H
DeclareInterfaceID(IComponentManager, 1, 0)
InterfaceID.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:35
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:37
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:86
STL class.
Helper class to parse a string of format "type/name".
GAUDI_API IAlgorithm * getAlgorithm(const IAlgContextSvc *svc, const AlgSelector &sel)
simple function to get the algorithm from Context Service
Definition: GetAlg.cpp:34
General service interface definition.
Definition: IService.h:28
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:38
constexpr static const auto FAILURE
Definition: StatusCode.h:101
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:79
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:31
#define GAUDI_API
Definition: Kernel.h:81