00001 #ifndef SERVICEPROVIDER_H
00002 #define SERVICEPROVIDER_H
00003
00004 #include <kore/kore.h>
00005 #include <kore/module.h>
00006 #include <vector>
00007 #include <string>
00008
00009
00010
00011 namespace kore
00012 {
00013
00014 class ServiceManager;
00015
00020 class KORE_API ServiceProvider : public Module
00021 {
00022 public:
00040 class KORE_API Service
00041 {
00042 public:
00049 Service(ServiceProvider* provider,const char* name,const char* description);
00050
00055 ServiceProvider* provider() const;
00060 const char* name() const;
00065 operator const char* () const;
00070 const char* description() const;
00071 private:
00072
00073 vector<string> _path;
00074
00075 string _leaf;
00076
00077 Service* _parent;
00078
00079 ServiceProvider* _provider;
00080
00081 const char* _name;
00082
00083 const char* _description;
00084 };
00085
00090 virtual const Service** services() const;
00100 virtual const Service* service(const Service* srv) const;
00109 virtual const Service* service(const char* srv) const;
00110
00116 virtual void registeringProvider(ServiceManager* sm);
00122 virtual void providerRegistered(ServiceManager* sm);
00128 virtual void unregisteringProvider(ServiceManager* sm);
00134 virtual void providerUnregistered(ServiceManager* sm);
00135
00142 virtual void registeringService(ServiceManager* sm,const Service* srv);
00149 virtual void serviceRegistered(ServiceManager* sm,const Service* srv);
00156 virtual void unregisteringService(ServiceManager* sm,const Service* srv);
00163 virtual void serviceUnregistered(ServiceManager* sm,const Service* srv);
00164
00165 protected:
00169 ServiceProvider();
00174 ServiceProvider(const Info* info);
00178 virtual ~ServiceProvider();
00179
00184 virtual void addService(const Service* service);
00191 virtual const Service* passiveService(const Service* service) const;
00201 virtual const Service* activeService(const Service* service) const;
00202 private:
00203
00204 vector<const Service*> _services;
00205 };
00206 };
00207
00208 #endif