| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- File List
- File Members

# ServiceManager.h

Go to the documentation of this file.

    00001 // $Id: ServiceManager.h,v 1.8 2008/06/02 14:21:35 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
    00032 class ServiceManager : virtual public ISvcManager,
    00033                        virtual public ISvcLocator {
    00034   public:
    00035   // typedefs and classes
    00036   typedef std::list<IService*> ListSvc;
    00037   typedef std::list<std::pair<IService*,int> > PListSvc;
    00038   typedef std::map<std::string, std::string > MapType;
    00039   typedef std::map<std::string, ISvcFactory*> MapFactory;
    00040
    00042   ServiceManager(IInterface* iface);
    00044   virtual ~ServiceManager();
    00045
    00047   virtual unsigned long addRef();
    00049   virtual unsigned long release();
    00051   virtual StatusCode queryInterface(const InterfaceID& iid, void** pinterface);
    00052
    00054   virtual StatusCode getService( const std::string& name, IService*& svc);
    00056   virtual StatusCode getService( const std::string& name, const InterfaceID& iid, IInterface*& pinterface);
    00058   virtual StatusCode getService( const std::string& name, IService*& svc, bool createIf);
    00060   virtual const std::list<IService*>& getServices( ) const;
    00061   virtual std::list<IService*> getActiveServices( ) const;
    00063   virtual bool existsService( const std::string& name) const;
    00064
    00066   virtual StatusCode addService( IService* svc, int prio );
    00068   virtual StatusCode addService( const std::string& typ, const std::string& nam, int prio );
    00070   virtual StatusCode removeService( IService* svc);
    00072   virtual StatusCode removeService( const std::string& nam );
    00074   virtual StatusCode declareSvcFactory( const ISvcFactory& factory, const std::string& svctype );
    00076   virtual StatusCode declareSvcType( const std::string& svcname, const std::string& svctype );
    00078   virtual StatusCode createService( const std::string& svctype, const std::string& svcname, IService*& svc);
    00080   virtual StatusCode getFactory(const std::string& svctype, const ISvcFactory*& fac) const;
    00082   virtual StatusCode initializeServices();
    00084   virtual StatusCode startServices();
    00086   virtual StatusCode stopServices();
    00088   virtual StatusCode finalizeServices();
    00090   virtual StatusCode reinitializeServices();
    00092   virtual StatusCode restartServices();
    00093
    00095   virtual int getPriority(const std::string& name) const;
    00096   virtual StatusCode setPriority(const std::string& name, int pri);
    00097
    00098 private:
    00100   IMessageSvc* msgSvc();
    00102   StatusCode makeService( const std::string& name, IService*& svc);
    00103   StatusCode removeActiveService( IService* svc);
    00104   StatusCode removeListService( IService* svc);
    00105
    00106 private:
    00107   unsigned long m_refcount;
    00108   ListSvc       m_listsvc;
    00109   PListSvc      m_activesvc;
    00110   MapType       m_maptype;
    00111   MapFactory    m_mapfactory;
    00112   IInterface*   m_pOuter;
    00113   ISvcLocator*  m_svclocator;
    00114   IMessageSvc*  m_msgsvc;
    00115   SmartIF<IStateful> m_statemgr;
    00116 };
    00117 #endif  // GAUDISVC_ServiceManager_H
    00118