|
||||
File indexing completed on 2024-11-15 09:38:33
0001 /***********************************************************************************\ 0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * 0003 * * 0004 * This software is distributed under the terms of the Apache version 2 licence, * 0005 * copied verbatim in the file "LICENSE". * 0006 * * 0007 * In applying this licence, CERN does not waive the privileges and immunities * 0008 * granted to it by virtue of its status as an Intergovernmental Organization * 0009 * or submit itself to any jurisdiction. * 0010 \***********************************************************************************/ 0011 #ifndef GAUDIKERNEL_IALGMANAGER_H 0012 #define GAUDIKERNEL_IALGMANAGER_H 0013 0014 // Include files 0015 #include "GaudiKernel/IComponentManager.h" 0016 #include "GaudiKernel/SmartIF.h" 0017 #include "GaudiKernel/TypeNameString.h" 0018 #include <list> 0019 #include <string> 0020 0021 // Forward class declaration 0022 class IService; 0023 class IAlgorithm; 0024 class ISvcLocator; 0025 0026 /** @class IAlgManager IAlgManager.h GaudiKernel/IAlgManager.h 0027 0028 The IAlgManager is the interface implemented by the Algorithm Factory in the 0029 Application Manager to support management functions. Clients use this 0030 interface to declare abstract algorithm factories, and to create concrete 0031 instances of algorithms. There are currently 3 methods for the declaration: 0032 static creator method (creator), an abstract factory (factory) or a sharable 0033 library (module). 0034 0035 @author Pere Mato 0036 */ 0037 class GAUDI_API IAlgManager : virtual public IComponentManager { 0038 public: 0039 /// InterfaceID 0040 DeclareInterfaceID( IAlgManager, 6, 0 ); 0041 0042 /// Add an algorithm to the list of known algorithms 0043 virtual StatusCode addAlgorithm( IAlgorithm* alg // Pointer to the Algorithm 0044 ) = 0; 0045 /// Remove an algorithm from the list of known algorithms 0046 virtual StatusCode removeAlgorithm( IAlgorithm* alg // Pointer to the Algorithm 0047 ) = 0; 0048 /// Create an instance of a algorithm type that has been declared beforehand and assigns to it a name. 0049 /// It returns a pointer to an IAlgorithm. 0050 virtual StatusCode createAlgorithm( std::string algtype, // Algorithm type name 0051 std::string algname, // Algorithm name to be assigned 0052 IAlgorithm*& alg, // Returned algorithm 0053 bool managed = false, // Flag to indicate if the algorithm is managed 0054 bool checkIfExists = true // Flag to indicate if clones of existing algorithms can 0055 // be created 0056 ) = 0; 0057 #if !defined( GAUDI_V22_API ) || defined( G22_NEW_SVCLOCATOR ) 0058 /// Find an algorithm with given name in the list of known algorithms 0059 virtual StatusCode getAlgorithm( std::string_view name, // Algorithm name to be searched 0060 IAlgorithm*& alg // Returned algorithm 0061 ) const { 0062 SmartIF<IAlgorithm>& si = const_cast<IAlgManager*>( this )->algorithm( name, false ); 0063 alg = si.get(); 0064 return si ? StatusCode::SUCCESS : StatusCode::FAILURE; 0065 } 0066 #endif 0067 /// Check the existence of an algorithm with a given name in the list of known algorithms 0068 virtual bool existsAlgorithm( std::string_view name // Algorithm name to be searched 0069 ) const = 0; 0070 /// Return the list of Algorithms 0071 virtual const std::vector<IAlgorithm*>& getAlgorithms() const = 0; 0072 0073 /// Returns a smart pointer to a service. 0074 virtual SmartIF<IAlgorithm>& algorithm( const Gaudi::Utils::TypeNameString& typeName, 0075 const bool createIf = true ) = 0; 0076 0077 /// Returns a smart pointer to the requested interface of a service. 0078 template <typename T> 0079 inline SmartIF<T> algorithm( const Gaudi::Utils::TypeNameString& typeName, const bool createIf = true ) { 0080 return SmartIF<T>( algorithm( typeName, createIf ) ); 0081 } 0082 }; 0083 0084 #endif // GAUDI_IALGMANAGER_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |