| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# ServiceManager.h

Go to the documentation of this file.

    00001 // $Id: ServiceManager.h,v 1.9 2008/11/10 15:29:09 marcocle Exp $
    00002 #ifndef GAUDISVC_ServiceManager_H
    00003 #define GAUDISVC_ServiceManager_H
    00004
    00005 // Include files
    00006 #include "GaudiKernel/Kernel.h"
    00007 #include "GaudiKernel/ISvcManager.h"
    00008 #include "GaudiKernel/ISvcLocator.h"
    00009 #include "GaudiKernel/IStateful.h"
    00010 #include "GaudiKernel/SmartIF.h"
    00011 #include <string>
    00012 #include <list>
    00013 #include <map>
    00014
    00015 // Forward declarations
    00016 class IService;
    00017 class ISvcFactory;
    00018 class IMessageSvc;
    00019 class Property;
    00020
    00033 class ServiceManager : virtual public ISvcManager,
    00034                        virtual public ISvcLocator {
    00035   public:
    00036   // typedefs and classes
    00037   typedef std::list<IService*> ListSvc;
    00038   typedef std::list<std::pair<IService*,int> > PListSvc;
    00039   typedef std::map<std::string, std::string > MapType;
    00040   typedef std::map<std::string, ISvcFactory*> MapFactory;
    00041
    00043   ServiceManager(IInterface* iface);
    00045   virtual ~ServiceManager();
    00046
    00048   virtual unsigned long addRef();
    00050   virtual unsigned long release();
    00052   virtual StatusCode queryInterface(const InterfaceID& iid, void** pinterface);
    00053
    00055   virtual StatusCode getService( const std::string& name, IService*& svc);
    00057   virtual StatusCode getService( const std::string& name, const InterfaceID& iid, IInterface*& pinterface);
    00059   virtual StatusCode getService( const std::string& name, IService*& svc, bool createIf);
    00061   virtual const std::list<IService*>& getServices( ) const;
    00062   virtual std::list<IService*> getActiveServices( ) const;
    00064   virtual bool existsService( const std::string& name) const;
    00065
    00067   virtual StatusCode addService( IService* svc, int prio );
    00069   virtual StatusCode addService( const std::string& typ, const std::string& nam, int prio );
    00071   virtual StatusCode removeService( IService* svc);
    00073   virtual StatusCode removeService( const std::string& nam );
    00075   virtual StatusCode declareSvcFactory( const ISvcFactory& factory, const std::string& svctype );
    00077   virtual StatusCode declareSvcType( const std::string& svcname, const std::string& svctype );
    00079   virtual StatusCode createService( const std::string& svctype, const std::string& svcname, IService*& svc);
    00081   virtual StatusCode getFactory(const std::string& svctype, const ISvcFactory*& fac) const;
    00083   virtual StatusCode initializeServices();
    00085   virtual StatusCode startServices();
    00087   virtual StatusCode stopServices();
    00089   virtual StatusCode finalizeServices();
    00091   virtual StatusCode reinitializeServices();
    00093   virtual StatusCode restartServices();
    00094
    00096   virtual int getPriority(const std::string& name) const;
    00097   virtual StatusCode setPriority(const std::string& name, int pri);
    00098
    00100   virtual bool loopCheckEnabled() const;
    00102   virtual void setLoopCheckEnabled(bool en);
    00103
    00104 private:
    00106   IMessageSvc* msgSvc();
    00108   StatusCode makeService( const std::string& name, IService*& svc);
    00109   StatusCode removeActiveService( IService* svc);
    00110   StatusCode removeListService( IService* svc);
    00111
    00112 private:
    00113   unsigned long m_refcount;
    00114   ListSvc       m_listsvc;
    00115   PListSvc      m_activesvc;
    00116   MapType       m_maptype;
    00117   MapFactory    m_mapfactory;
    00118   IInterface*   m_pOuter;
    00119   ISvcLocator*  m_svclocator;
    00120   IMessageSvc*  m_msgsvc;
    00121   SmartIF<IStateful> m_statemgr;
    00122   bool          m_loopCheck;
    00123 };
    00124 #endif  // GAUDISVC_ServiceManager_H
    00125