xentara-plugin v1.2.1
The Xentara Plugin Framework
Loading...
Searching...
No Matches
xentara::process::ServiceProvider::Environment Class Referenceabstract

#include <process/ServiceProvider.hpp>

+ Inheritance diagram for xentara::process::ServiceProvider::Environment:

Public Member Functions

virtual ~Environment ()=0
 Virtual destructor.
 
virtual auto createMicroservice (const MicroserviceClass &microserviceClass, plugin::SharedFactory< Microservice > &factory) -> std::shared_ptr< Microservice >=0
 Called by the framework to create a new microservice.
 
- Public Member Functions inherited from xentara::utils::tools::DisableCopy
constexpr DisableCopy () noexcept=default
 
 DisableCopy (const DisableCopy &)=delete
 
DisableCopyoperator= (const DisableCopy &)=delete
 

Constructor & Destructor Documentation

◆ ~Environment()

xentara::process::ServiceProvider::Environment::~Environment ( )
pure virtualdefault

Virtual destructor.

Member Function Documentation

◆ createMicroservice()

virtual auto xentara::process::ServiceProvider::Environment::createMicroservice ( const MicroserviceClass microserviceClass,
plugin::SharedFactory< Microservice > &  factory 
) -> std::shared_ptr< Microservice >
pure virtual

Called by the framework to create a new microservice.

The implementation for this method must use the given factory to create a new microservice of the given microservice class:

return factory.makeShared<MyService>();

If your service provider requires access to the microservice later, you must store an std::weak_ptr to it somewhere.

The framework will call loadConfig() on the newly created microservice.

Parameters
microserviceClassThe class for the new microservice
factoryThe factory that must be used to create the microservice
Returns
The newly created microservice, or nullptr if the provider does not support microservices of the given class
Exceptions
std::runtime_errorThe function must throw this exception (or a suitable subclass) if an error occurs
See also
Creating Plugin Element Objects