|
The Pedigree Project 0.1
|
#include <ServiceManager.h>
Collaboration diagram for ServiceManager:Classes | |
| class | InternalService |
Public Member Functions | |
| ServiceFeatures * | enumerateOperations (const String &serviceName) |
| void | addService (const String &serviceName, Service *s, ServiceFeatures *feats) |
| void | removeService (const String &serviceName) |
| Service * | getService (const String &serviceName) |
| bool | tryGetService (const String &serviceName, Service *&service, ServiceFeatures *&features) |
| bool | serve (const String &serviceName, ServiceFeatures::Type type, void *data, size_t dataLen) |
Static Public Member Functions | |
| static ServiceManager & | instance () |
Private Attributes | |
| Mutex | m_Lock |
| RadixTree< InternalService * > | m_Services |
Static Private Attributes | |
| static ServiceManager | m_Instance |
Service Manager
The service manager controls Services in a central location, by allowing them to be referred to by name.
It also provides services such as enumeration of Service operations.
Definition at line 41 of file ServiceManager.h.
| ServiceManager::ServiceManager | ( | ) |
Definition at line 30 of file ServiceManager.cc.
|
virtual |
Definition at line 32 of file ServiceManager.cc.
| void ServiceManager::addService | ( | const String & | serviceName, |
| Service * | s, | ||
| ServiceFeatures * | feats | ||
| ) |
Adds a service to the manager
Definition at line 58 of file ServiceManager.cc.
References OperationBarrier::close(), m_Lock, ServiceManager::InternalService::pFeatures, ServiceManager::InternalService::pService, and OperationBarrier::wait().
| ServiceFeatures * ServiceManager::enumerateOperations | ( | const String & | serviceName | ) |
Enumerates all possible operations that can be performed for a given Service. The caller must externally pin the service lifetime.
Definition at line 48 of file ServiceManager.cc.
References m_Lock.
Referenced by ScsiDisk::initialise().
Here is the caller graph for this function:Gets a Service pointer whose lifetime the caller must externally pin.
Definition at line 100 of file ServiceManager.cc.
References m_Lock.
Referenced by ScsiDisk::initialise(), and UsbDeviceContainer::replaceUsbDevice().
Here is the caller graph for this function:
|
inlinestatic |
Definition at line 46 of file ServiceManager.h.
| void ServiceManager::removeService | ( | const String & | serviceName | ) |
Removes a service and drains admitted calls before its owner deletes it. A service callback must not remove or replace its own registration.
Definition at line 84 of file ServiceManager.cc.
References OperationBarrier::close(), m_Lock, and OperationBarrier::wait().
| bool ServiceManager::serve | ( | const String & | serviceName, |
| ServiceFeatures::Type | type, | ||
| void * | data, | ||
| size_t | dataLen | ||
| ) |
Invokes a supported operation while retaining the registered service.
Definition at line 127 of file ServiceManager.cc.
References m_Lock, ServiceFeatures::provides(), and Service::serve().
Referenced by UsbDeviceContainer::replaceUsbDevice().
Here is the caller graph for this function:| bool ServiceManager::tryGetService | ( | const String & | serviceName, |
| Service *& | service, | ||
| ServiceFeatures *& | features | ||
| ) |
Nonblocking lookup for diagnostics. Returned objects require an external lifetime guarantee; unavailable or contended lookup resets both outputs.
Definition at line 110 of file ServiceManager.cc.
References ProcessorBase::getInterrupts(), m_Lock, Semaphore::release(), and Semaphore::tryAcquire().
|
staticprivate |
Definition at line 76 of file ServiceManager.h.
|
private |
Services we know about
Definition at line 91 of file ServiceManager.h.
Referenced by addService(), enumerateOperations(), getService(), removeService(), serve(), and tryGetService().
|
private |
Definition at line 92 of file ServiceManager.h.