| # Gaudi Framework, version v21r8 |

Home |  | Generated: 17 Mar 2010

# AlgorithmManager.h

Go to the documentation of this file.

    00001 // $Id: AlgorithmManager.h,v 1.4 2008/06/02 14:21:35 marcocle Exp $     //
    00002 #ifndef GAUDISVC_ALGORITHMMANAGER_H
    00003 #define GAUDISVC_ALGORITHMMANAGER_H
    00004
    00005 // Include files
    00006 #include "GaudiKernel/Kernel.h"
    00007 #include "GaudiKernel/IAlgManager.h"
    00008 #include "GaudiKernel/IStateful.h"
    00009 #include "GaudiKernel/ComponentManager.h"
    00010 #include "GaudiKernel/SmartIF.h"
    00011 #include "GaudiKernel/IAlgorithm.h"
    00012 #include <string>
    00013 #include <list>
    00014 #include <map>
    00015
    00016 // Forward declarations
    00017 class ISvcLocator;
    00018 class IMessageSvc;
    00019
    00032 class AlgorithmManager : public extends1<ComponentManager, IAlgManager>{
    00033 public:
    00034
    00035   struct AlgorithmItem {
    00036     AlgorithmItem(IAlgorithm *s, bool managed = false):
    00037       algorithm(s), managed(managed) {}
    00038     SmartIF<IAlgorithm> algorithm;
    00039     bool managed;
    00040     inline bool operator==(const std::string &name) const {
    00041       return algorithm->name() == name;
    00042     }
    00043     inline bool operator==(const IAlgorithm *ptr) const {
    00044       return algorithm.get() == ptr;
    00045     }
    00046   };
    00047
    00049   typedef std::list<AlgorithmItem> ListAlg;
    00050
    00052   AlgorithmManager( IInterface* iface );
    00054   virtual ~AlgorithmManager();
    00055
    00057   virtual StatusCode addAlgorithm(IAlgorithm* alg);
    00059   virtual StatusCode removeAlgorithm(IAlgorithm* alg);
    00061   virtual StatusCode createAlgorithm(const std::string& algtype, const std::string& algname,
    00062                                      IAlgorithm*& algorithm, bool managed = false);
    00063
    00065   virtual bool existsAlgorithm(const std::string& name) const;
    00067   virtual const std::list<IAlgorithm*>& getAlgorithms() const;
    00068
    00070   virtual StatusCode initialize();
    00072   virtual StatusCode start();
    00074   virtual StatusCode stop();
    00076   virtual StatusCode finalize();
    00077
    00079   virtual StatusCode reinitialize();
    00081   virtual StatusCode restart();
    00082
    00084   const std::string &name() const {
    00085     static std::string _name = "AlgorithmManager";
    00086     return _name;
    00087   }
    00088
    00089   virtual SmartIF<IAlgorithm> &algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf = true);
    00090
    00091 private:
    00092   ListAlg      m_listalg;
    00093
    00095   mutable std::list<IAlgorithm*> m_listOfPtrs;
    00096
    00097 };
    00098 #endif  // GAUDISVC_ALGORITHMFACTORY_H
    00099