Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
us::ModuleActivator Struct Referenceabstract

Customizes the starting and stopping of a CppMicroServices module. More...

#include <usModuleActivator.h>

Inheritance diagram for us::ModuleActivator:

Public Member Functions

virtual ~ModuleActivator ()
 Virtual destructor. More...
 
virtual void Load (ModuleContext *context)=0
 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). More...
 
virtual void Unload (ModuleContext *context)=0
 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. More...
 

Detailed Description

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.

class MyActivator : public ModuleActivator
{
public:
void Load(ModuleContext* /*context*/) override
{ /* register stuff */ }
void Unload(ModuleContext* /*context*/) override
{ /* cleanup */ }
};
#define US_EXPORT_MODULE_ACTIVATOR(_activator_type)
Export a module activator class.
virtual void Unload(ModuleContext *context)=0
Called when this module is unloaded. In general, this method should undo the work that the ModuleActi...
virtual void Load(ModuleContext *context)=0
Called when this module is loaded. This method can be used to register services or to allocate any re...

The class implementing the ModuleActivator interface must have a public default constructor so that a ModuleActivator object can be created by the CppMicroServices library.

Definition at line 54 of file usModuleActivator.h.

Constructor & Destructor Documentation

◆ ~ModuleActivator()

virtual us::ModuleActivator::~ModuleActivator ( )
inlinevirtual

Virtual destructor.

Reimplemented in mitk::Forms::UI::ModuleActivator, and mitk::Forms::ModuleActivator.

Definition at line 58 of file usModuleActivator.h.

Member Function Documentation

◆ Load()

virtual void us::ModuleActivator::Load ( ModuleContext *  context)
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.

Parameters
[in]contextThe execution context of the module being loaded.
Exceptions
std::exceptionIf 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.

Implemented in mitk::ROIIOModuleActivator, MitkQtWidgetsActivator, mitk::PersistenceActivator, mitk::IOExtActivator, mitk::Forms::UI::ModuleActivator, mitk::Forms::ModuleActivator, mitk::DICOMImageIOActivator, MitkCoreActivator, and mitk::CESTIOActivator.

◆ Unload()

virtual void us::ModuleActivator::Unload ( ModuleContext *  context)
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.

Parameters
[in]contextThe execution context of the module being unloaded.
Exceptions
std::exceptionIf 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.

Implemented in mitk::PersistenceActivator, mitk::IOExtActivator, mitk::Forms::UI::ModuleActivator, mitk::Forms::ModuleActivator, mitk::DICOMImageIOActivator, mitk::CESTIOActivator, mitk::ROIIOModuleActivator, MitkQtWidgetsActivator, and MitkCoreActivator.


The documentation for this struct was generated from the following file: