#include <serviceprovider.h>
Inheritance diagram for kore::ServiceProvider::

Public Methods | |
| virtual const Service ** | services () const |
| Gets the list services provided by this ServiceProvider. More... | |
| virtual const Service * | service (const Service *srv) const |
| Checks whether this SP provides a service who's name matches the given srv->name(). More... | |
| virtual const Service * | service (const char *srv) const |
| Checks whether this SP provides a service who's name matches the given srv->name(). More... | |
| virtual void | registeringProvider (ServiceManager *sm) |
| Callback method triggered right BEFORE REGISTERING this ServiceProvider to a ServiceManager. More... | |
| virtual void | providerRegistered (ServiceManager *sm) |
| Callback method triggered right AFTER REGISTERING this ServiceProvider to a ServiceManager. More... | |
| virtual void | unregisteringProvider (ServiceManager *sm) |
| Callback method triggered right BEFORE UNREGISTERING this ServiceProvider from a ServiceManager. More... | |
| virtual void | providerUnregistered (ServiceManager *sm) |
| Callback method triggered right AFTER UNREGISTERING this ServiceProvider from a ServiceManager. More... | |
| virtual void | registeringService (ServiceManager *sm, const Service *srv) |
| Callback method triggered right BEFORE REGISTERING to a ServiceManager one of the Services provided by this SP. More... | |
| virtual void | serviceRegistered (ServiceManager *sm, const Service *srv) |
| Callback method triggered right AFTER REGISTERING to a ServiceManager one of the Services provided by this SP. More... | |
| virtual void | unregisteringService (ServiceManager *sm, const Service *srv) |
| Callback method triggered right BEFORE UNREGISTERING from a ServiceManager one of the Services provided by this SP. More... | |
| virtual void | serviceUnregistered (ServiceManager *sm, const Service *srv) |
| Callback method triggered right AFTER UNREGISTERING from a ServiceManager one of the Services provided by this SP. More... | |
Protected Methods | |
| ServiceProvider () | |
| Default constructor. More... | |
| ServiceProvider (const Info *info) | |
| Creates a ServiceProvider and sets its Info. More... | |
| virtual | ~ServiceProvider () |
| Destructor. More... | |
| virtual void | addService (const Service *service) |
| Convenience method for adding a Service to this SP services list. More... | |
| virtual const Service * | passiveService (const Service *service) const |
| Searches for a passive service who's name matches service->name(). More... | |
| virtual const Service * | activeService (const Service *service) const |
| Searches for an active service who's name matches service->name(). More... | |
Private Attributes | |
| vector< const Service *> | _services |
Definition at line 20 of file serviceprovider.h.
|
|
Default constructor. Creates an empty ServiceProvider. Definition at line 54 of file serviceprovider.cpp. Referenced by kore::ServiceProvider::Service::provider(), kore::ServiceManager::registeredProviders(), and kore::ServiceManager::unregisterProviders().
00055 {
00056 }
|
|
|
Creates a ServiceProvider and sets its Info.
Definition at line 57 of file serviceprovider.cpp.
|
|
|
Destructor.
Definition at line 60 of file serviceprovider.cpp.
00061 {
00062 }
|
|
|
Searches for an active service who's name matches service->name(). This function gets called by ServiceProvider::service(const Service*) functions, only when ServiceProvider::passiveService() returns NULL. Subclasses may override this function in order to tell whether a given service name mathces or not on of the active services this SP provides.
Definition at line 117 of file serviceprovider.cpp. Referenced by service().
00118 {
00119 return 0;
00120 }
|
|
|
Convenience method for adding a Service to this SP services list.
Definition at line 64 of file serviceprovider.cpp. References _services, and service(). Referenced by kore::Kernel::Kernel(), kore::ModuleManager::ModuleManager(), kore::PluginLoader::PluginLoader(), kore::PluginManager::PluginManager(), and kore::ServiceManager::ServiceManager().
|
|
|
Searches for a passive service who's name matches service->name(). This function gets called by ServiceProvider::service(const Service*) function.
Definition at line 100 of file serviceprovider.cpp. References services(). Referenced by service().
00101 {
00102 // paranoia
00103 if( !srv )
00104 return 0;
00105 const Service* res = 0;
00106 const Service** srvs = services();
00107 for(int i=0; srvs[i]; i++)
00108 if( (srvs[i] == srv) || ( strcmp(srvs[i]->name(),srv->name()) == 0 ) )
00109 {
00110 res = srvs[i];
00111 break;
00112 }
00113 delete[] srvs;
00114 return res;
00115 }
|
|
|
Callback method triggered right AFTER REGISTERING this ServiceProvider to a ServiceManager.
Definition at line 126 of file serviceprovider.cpp.
00127 {
00128 //cout << info()->name() << " " << (const char*)*(info()->version()) << " : registered to " << sm->info()->name() << " " << (const char*)*(sm->info()->version()) << endl;
00129 }
|
|
|
Callback method triggered right AFTER UNREGISTERING this ServiceProvider from a ServiceManager.
Definition at line 134 of file serviceprovider.cpp.
00135 {
00136 //cout << info()->name() << " " << (const char*)*(info()->version()) << " : unregistered from " << sm->info()->name() << " " << (const char*)*(sm->info()->version()) << endl;
00137 }
|
|
|
Callback method triggered right BEFORE REGISTERING this ServiceProvider to a ServiceManager.
Definition at line 122 of file serviceprovider.cpp.
00123 {
00124 //cout << info()->name() << " " << (const char*)*(info()->version()) << " : registering to " << sm->info()->name() << " " << (const char*)*(sm->info()->version()) << endl;
00125 }
|
|
||||||||||||
|
Callback method triggered right BEFORE REGISTERING to a ServiceManager one of the Services provided by this SP.
Definition at line 139 of file serviceprovider.cpp.
00140 {
00141 //cout << info()->name() << " " << (const char*)*(info()->version()) << " : registering service " << srv->name() << " (" << srv->description() << ") to " << sm->info()->name() << " " << (const char*)*(sm->info()->version()) << endl;
00142 }
|
|
|
Checks whether this SP provides a service who's name matches the given srv->name(). The default implementation creates a temporary Service object, sets its name to srv, and calls ServiceProvider::service(const Service*).
Definition at line 80 of file serviceprovider.cpp. References service().
00081 {
00082 if( !srv )
00083 return 0;
00084 Service serv(0, srv, 0);
00085 return service(&serv);
00086 }
|
|
|
Checks whether this SP provides a service who's name matches the given srv->name(). The default implementation returns ServiceProvider::activeService(...), or if the activeService()'s result is NULL, it returns ServiceProvider::passiveService(...).
Definition at line 88 of file serviceprovider.cpp. References activeService(), and passiveService(). Referenced by addService(), kore::ServiceManager::registeredProvider(), kore::ServiceManager::registeredProviders(), kore::ServiceManager::registeredService(), kore::ServiceManager::registeredServices(), and service().
00089 {
00090 if( !srv )
00091 return 0;
00092 const Service* serv = 0;
00093 serv = passiveService(srv);
00094 if( serv )
00095 return serv;
00096 else
00097 return activeService(srv);
00098 }
|
|
||||||||||||
|
Callback method triggered right AFTER REGISTERING to a ServiceManager one of the Services provided by this SP.
Definition at line 143 of file serviceprovider.cpp.
00144 {
00145 //cout << info()->name() << " " << (const char*)*(info()->version()) << " : registered service " << srv->name() << " (" << srv->description() << ") to " << sm->info()->name() << " " << (const char*)*(sm->info()->version()) << endl;
00146 }
|
|
|
Gets the list services provided by this ServiceProvider.
Definition at line 69 of file serviceprovider.cpp. References _services. Referenced by passiveService().
|
|
||||||||||||
|
Callback method triggered right AFTER UNREGISTERING from a ServiceManager one of the Services provided by this SP.
Definition at line 151 of file serviceprovider.cpp.
00152 {
00153 //cout << info()->name() << " " << (const char*)*(info()->version()) << " : unregistered service " << srv->name() << " (" << srv->description() << ") from " << sm->info()->name() << " " << (const char*)*(sm->info()->version()) << endl;
00154 }
|
|
|
Callback method triggered right BEFORE UNREGISTERING this ServiceProvider from a ServiceManager.
Definition at line 130 of file serviceprovider.cpp.
00131 {
00132 //cout << info()->name() << " " << (const char*)*(info()->version()) << " : unregistering from " << sm->info()->name() << " " << (const char*)*(sm->info()->version()) << endl;
00133 }
|
|
||||||||||||
|
Callback method triggered right BEFORE UNREGISTERING from a ServiceManager one of the Services provided by this SP.
Definition at line 147 of file serviceprovider.cpp.
00148 {
00149 //cout << info()->name() << " " << (const char*)*(info()->version()) << " : unregistering service " << srv->name() << " (" << srv->description() << ") from " << sm->info()->name() << " " << (const char*)*(sm->info()->version()) << endl;
00150 }
|
|
|
Reimplemented in kore::ServiceManager. Definition at line 204 of file serviceprovider.h. Referenced by addService(), and services(). |
1.2.12 written by Dimitri van Heesch,
© 1997-2001