Skip to content

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.

virtual std::shared_ptr< Service > endstone::ServiceManager::get (
    std::string name
) const = 0

Parameters:

  • name The 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:

  • name service name
  • provider service provider to register
  • plugin plugin associated with the service
  • priority priority 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:

  • name The service name
  • provider The service provider implementation

function unregister [2/2]

Unregister a particular provider.

virtual void endstone::ServiceManager::unregister (
    const  Service & provider
) = 0

Parameters:

  • provider The service provider implementation

function unregisterAll

Unregister all the services registered by a particular plugin.

virtual void endstone::ServiceManager::unregisterAll (
    const  Plugin & plugin
) = 0

Parameters:

  • plugin The plugin

function ~ServiceManager

virtual endstone::ServiceManager::~ServiceManager () = default


The documentation for this class was generated from the following file include/endstone/plugin/service_manager.h