endstone::ServiceManager
Represent a service manager that manages services and service providers.
Functions:
Name | Description |
---|---|
get | Queries for a provider. This may return null if no provider has been registered for a service. The highest priority provider is returned. |
load | |
registerService | Register a provider of a service. |
unregister | Unregister a particular provider for a particular service. |
unregister | Unregister a particular provider. |
unregisterAll | Unregister all the services registered by a particular plugin. |
get
std::shared_ptr<Service> get(std::string name) const
Queries for a provider. This may return null if no provider has been registered for a service. The highest priority provider is returned.
Parameters:
name
The service name
Returns:
provider or null
load
template <typename T> std::shared_ptr<T> load(std::string name) const
registerService
void registerService(std::string name, std::shared_ptr<Service> provider,
const Plugin &plugin, ServicePriority priority)
Register a provider of a service.
Parameters:
name
service nameprovider
service provider to registerplugin
plugin associated with the servicepriority
priority of the provider
unregister
void unregister(std::string name, const Service &provider)
Unregister a particular provider for a particular service.
Parameters:
name
The service nameprovider
The service provider implementation
void unregister(const Service &provider)
Unregister a particular provider.
Parameters:
provider
The service provider implementation
unregisterAll
void unregisterAll(const Plugin &plugin)
Unregister all the services registered by a particular plugin.
Parameters:
plugin
The plugin
Last updated on