IAlgManager.h
Go to the documentation of this file.00001
00002 #ifndef GAUDIKERNEL_IALGMANAGER_H
00003 #define GAUDIKERNEL_IALGMANAGER_H
00004
00005
00006 #include "GaudiKernel/IComponentManager.h"
00007 #include "GaudiKernel/SmartIF.h"
00008 #include "GaudiKernel/TypeNameString.h"
00009 #include <string>
00010 #include <list>
00011
00012
00013 class IService;
00014 class IAlgorithm;
00015 class ISvcLocator;
00016
00028 class GAUDI_API IAlgManager: virtual public IComponentManager {
00029 public:
00031 DeclareInterfaceID(IAlgManager,5,0);
00032
00034 virtual StatusCode addAlgorithm( IAlgorithm* alg
00035 ) = 0;
00037 virtual StatusCode removeAlgorithm( IAlgorithm* alg
00038 ) = 0;
00041 virtual StatusCode createAlgorithm( const std::string& algtype,
00042 const std::string& algname,
00043 IAlgorithm*& alg,
00044 bool managed = false
00045 ) = 0;
00046 #if !defined(GAUDI_V22_API) || defined(G22_NEW_SVCLOCATOR)
00048 virtual StatusCode getAlgorithm( const std::string& name, // Algorithm name to be searched
00049 IAlgorithm*& alg
00050 ) const {
00051 SmartIF<IAlgorithm> &si = const_cast<IAlgManager*>(this)->algorithm(name, false);
00052 alg = si.get();
00053 return si.isValid() ? StatusCode::SUCCESS : StatusCode::FAILURE;
00054 }
00055 #endif
00057 virtual bool existsAlgorithm( const std::string& name // Algorithm name to be searched
00058 ) const = 0;
00060 virtual const std::list<IAlgorithm*>& getAlgorithms() const = 0;
00061
00062 #if !defined(GAUDI_V22_API) || defined(G22_NEW_SVCLOCATOR)
00064 virtual StatusCode initializeAlgorithms() { return initialize(); }
00065
00067 virtual StatusCode startAlgorithms() { return start(); }
00068
00070 virtual StatusCode stopAlgorithms() { return stop(); }
00071
00073 virtual StatusCode finalizeAlgorithms() { return finalize(); }
00074
00076 virtual StatusCode reinitializeAlgorithms() { return reinitialize(); }
00077
00079 virtual StatusCode restartAlgorithms() { return restart(); }
00080 #endif
00081
00083 virtual SmartIF<IAlgorithm> &algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf = true) = 0;
00084
00086 template <typename T>
00087 inline SmartIF<T> algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf = true) {
00088 return SmartIF<T>(algorithm(typeName, createIf));
00089 }
00090
00091 };
00092
00093
00094 #endif // GAUDI_IALGMANAGER_H