Class endstone::ServiceManager¶
ClassList > endstone > ServiceManager
Represent a service manager that manages services and service providers. More...
- #include <endstone/plugin/service_manager.h>
Public Functions¶
| Type | Name | 
|---|---|
| virtual std::shared_ptr< Service > | get (std::string name) const = 0 Queries for a provider. This may return null if no provider has been registered for a service. The highest priority provider is returned. | 
| std::shared_ptr< T > | load (std::string name) const | 
| virtual void | registerService (std::string name, std::shared_ptr< Service > provider, const Plugin & plugin, ServicePriority priority) = 0 Register a provider of a service. | 
| virtual void | unregister (std::string name, const Service & provider) = 0 Unregister a particular provider for a particular service. | 
| virtual void | unregister (const Service & provider) = 0 Unregister a particular provider. | 
| virtual void | unregisterAll (const Plugin & plugin) = 0 Unregister all the services registered by a particular plugin. | 
| virtual | ~ServiceManager () = default | 
Detailed Description¶
Services are an interface specifying a list of methods that a provider must implement. Providers are implementations of these services.
Public Functions Documentation¶
function get¶
Queries for a provider. This may return null if no provider has been registered for a service. The highest priority provider is returned.
Parameters:
- nameThe service name
Returns:
provider or null
function load¶
template<typename T>
inline std::shared_ptr< T > endstone::ServiceManager::load (
    std::string name
) const
function registerService¶
Register a provider of a service.
virtual void endstone::ServiceManager::registerService (
    std::string name,
    std::shared_ptr< Service > provider,
    const Plugin & plugin,
    ServicePriority priority
) = 0
Parameters:
- nameservice name
- providerservice provider to register
- pluginplugin associated with the service
- prioritypriority of the provider
function unregister [½]¶
Unregister a particular provider for a particular service.
virtual void endstone::ServiceManager::unregister (
    std::string name,
    const Service & provider
) = 0
Parameters:
- nameThe service name
- providerThe service provider implementation
function unregister [2/2]¶
Unregister a particular provider.
Parameters:
- providerThe service provider implementation
function unregisterAll¶
Unregister all the services registered by a particular plugin.
Parameters:
- pluginThe plugin
function ~ServiceManager¶
The documentation for this class was generated from the following file include/endstone/plugin/service_manager.h