Customizes the starting and stopping of a CppMicroServices module. More...
Public Member Functions | |
virtual | ~ModuleActivator () |
virtual void | Load (ModuleContext *context)=0 |
Called when this module is loaded. More... | |
virtual void | Unload (ModuleContext *context)=0 |
Called when this module is unloaded. More... | |
Customizes the starting and stopping of a CppMicroServices module.
ModuleActivator
is an interface that can be implemented by CppMicroServices modules. The CppMicroServices library can create instances of a module's ModuleActivator
as required. If an instance's ModuleActivator::Load
method executes successfully, it is guaranteed that the same instance's ModuleActivator::Unload
method will be called when the module is to be unloaded. The CppMicroServices library does not concurrently call a ModuleActivator
object.
ModuleActivator
is an abstract class interface whose implementations must be exported via a special macro. Implementations are usually declared and defined directly in .cpp files.
The class implementing the ModuleActivator
interface must have a public default constructor so that a ModuleActivator
object can be created by the CppMicroServices library.
|
inlinevirtual |
|
pure virtual |
Called when this module is loaded.
This method can be used to register services or to allocate any resources that this module may need globally (during the whole module lifetime).
This method must complete and return to its caller in a timely manner.
context | The execution context of the module being loaded. |
std::exception | If this method throws an exception, this module is marked as stopped and the framework will remove this module's listeners, unregister all services registered by this module, and release all services used by this module. |
|
pure virtual |
Called when this module is unloaded.
In general, this method should undo the work that the ModuleActivator::Load
method started. There should be no active threads that were started by this module when this method returns.
This method must complete and return to its caller in a timely manner.
context | The execution context of the module being unloaded. |
std::exception | If this method throws an exception, the module is still marked as unloaded, and the framework will remove the module's listeners, unregister all services registered by the module, and release all services used by the module. |