NDEVR
API Documentation
ModuleManager

Logic for the program-wide storage and execution of Modules. More...

Inheritance diagram for ModuleManager:
[legend]
Collaboration diagram for ModuleManager:
[legend]

Static Public Member Functions

static void AddModule (const File &module_file)
 Adds a single module by loading it from the specified library file.
static void AddModule (const Module &module)
 Registers a pre-constructed Module into the module system.
static void CallModuleFunction (const StringView &function)
 Invokes a named hook function on all registered modules.
static void CallModuleFunction (const StringView &function, QTModelManager *model_manager, QTWindowManager *window_manager)
 Invokes a named UI hook function on all registered modules.
static void DefineModuleResources (const StringView &module_name, ModuleResourceManager *resources)
 Asks a specific module to declare its required resources.
static void FindModules (const Buffer< String > &module_list, const File &module_folder)
 Discovers and loads modules from an explicit list of names within the given folder.
static void FindModules (const File &module_folder)
 Discovers and loads all modules found in the given folder.
static void FindModules (const File &module_list, const File &module_folder)
 Discovers and loads modules listed in a ModuleList file within the given folder.
static bool HasActiveModule (const StringView &module_name)
 Checks whether a module with the given name exists and is active.
static bool IsInitialized ()
 Checks whether the module system has completed its initial setup sequence.
static bool IsModuleActive (const StringView &module_name)
 Checks whether a specific module is currently marked as active.
static void * LoadDynamicLibrary (const StringView &library)
 Loads a dynamic library by name or path and returns an opaque handle.
static void * LoadFromDynamicLibrary (const StringView &library, const StringView &function)
 Loads a dynamic library and resolves a function symbol from it in one step.
static void * LoadFromDynamicLibrary (void *library, const StringView &function)
 Resolves a function symbol from a previously loaded dynamic library.
static File MainModuleFolder ()
 Returns the primary folder where module libraries are located.
static void OnExit ()
 Invokes the exit cleanup hook on all modules and releases resources.
static void ReadModuleSettings ()
 Reads module active/inactive states from persistent settings storage.
static void SaveModuleSettings ()
 Persists the current module active/inactive states to settings storage.
static void SetErrorCallback (const std::function< void(const Exception &e)> &callback)
 Sets a callback to be invoked when a module hook function throws an exception.
static void SetInitialized (QTModelManager *model_manager, QTWindowManager *window_manager)
 Marks the module system as fully initialized and stores the manager pointers for use when late-loaded modules need to run SetupUIForNDEVR.
static void SetMainProgramModuleName (const StringView &name)
 Sets the name of the main program module used as the application entry-point.
static void SetupModuleRegistration ()
 Runs the registration setup hook on all modules to configure licensing.

Static Public Attributes

static Dictionary< String, Dictionary< String, void * > > functions
 Cached map of library names to their resolved function tables.
static String main_program_module_name
 The name of the module designated as the main application entry-point.
static Dictionary< String, bool > module_active_list
 Map of module names to their active/inactive state.
static Dictionary< String, Modulemodules
 Map of module names to their Module instances.
static Buffer< Stringordered_modules
 Module names in their load/execution order.

Detailed Description

Logic for the program-wide storage and execution of Modules.


Called in software setup to allow modules to perform actions to modify or enhance the software.

Definition at line 155 of file ModuleManager.h.

Member Function Documentation

◆ AddModule() [1/2]

void ModuleManager::AddModule ( const File & module_file)
static

Adds a single module by loading it from the specified library file.

Parameters
[in]module_fileThe dynamic library file to load as a module.

◆ AddModule() [2/2]

void ModuleManager::AddModule ( const Module & module)
static

Registers a pre-constructed Module into the module system.

Parameters
[in]moduleThe module to add.

◆ CallModuleFunction() [1/2]

void ModuleManager::CallModuleFunction ( const StringView & function)
static

Invokes a named hook function on all registered modules.

Parameters
[in]functionThe name of the hook function to call.

◆ CallModuleFunction() [2/2]

void ModuleManager::CallModuleFunction ( const StringView & function,
QTModelManager * model_manager,
QTWindowManager * window_manager )
static

Invokes a named UI hook function on all registered modules.

Parameters
[in]functionThe name of the hook function to call.
[in]model_managerThe application model manager.
[in]window_managerThe application window manager.

◆ DefineModuleResources()

void ModuleManager::DefineModuleResources ( const StringView & module_name,
ModuleResourceManager * resources )
static

Asks a specific module to declare its required resources.

Parameters
[in]module_nameThe internal name of the module.
[in]resourcesThe resource manager to populate.

◆ FindModules() [1/3]

void ModuleManager::FindModules ( const Buffer< String > & module_list,
const File & module_folder )
static

Discovers and loads modules from an explicit list of names within the given folder.

Parameters
[in]module_listA buffer of module names to load.
[in]module_folderThe directory containing the module libraries.

◆ FindModules() [2/3]

void ModuleManager::FindModules ( const File & module_folder)
static

Discovers and loads all modules found in the given folder.

Parameters
[in]module_folderThe directory to scan for module libraries.

◆ FindModules() [3/3]

void ModuleManager::FindModules ( const File & module_list,
const File & module_folder )
static

Discovers and loads modules listed in a ModuleList file within the given folder.

Parameters
[in]module_listA file containing one module name per line.
[in]module_folderThe directory containing the module libraries.

◆ HasActiveModule()

bool ModuleManager::HasActiveModule ( const StringView & module_name)
static

Checks whether a module with the given name exists and is active.

Parameters
[in]module_nameThe internal name of the module.
Returns
True if the module exists and is currently active.

◆ IsInitialized()

bool ModuleManager::IsInitialized ( )
static

Checks whether the module system has completed its initial setup sequence.

Returns
True if SetInitialized() has been called.

◆ IsModuleActive()

bool ModuleManager::IsModuleActive ( const StringView & module_name)
static

Checks whether a specific module is currently marked as active.

Parameters
[in]module_nameThe internal name of the module.
Returns
True if the module is active, false otherwise.

◆ LoadDynamicLibrary()

void * ModuleManager::LoadDynamicLibrary ( const StringView & library)
static

Loads a dynamic library by name or path and returns an opaque handle.

Parameters
[in]libraryThe name or path of the dynamic library to load.
Returns
An opaque pointer to the loaded library, or nullptr on failure.

◆ LoadFromDynamicLibrary() [1/2]

void * ModuleManager::LoadFromDynamicLibrary ( const StringView & library,
const StringView & function )
static

Loads a dynamic library and resolves a function symbol from it in one step.

Parameters
[in]libraryThe name or path of the dynamic library.
[in]functionThe name of the function to resolve.
Returns
A pointer to the resolved function, or nullptr if not found.

◆ LoadFromDynamicLibrary() [2/2]

void * ModuleManager::LoadFromDynamicLibrary ( void * library,
const StringView & function )
static

Resolves a function symbol from a previously loaded dynamic library.

Parameters
[in]libraryAn opaque handle returned by LoadDynamicLibrary.
[in]functionThe name of the function to resolve.
Returns
A pointer to the resolved function, or nullptr if not found.

◆ MainModuleFolder()

File ModuleManager::MainModuleFolder ( )
static

Returns the primary folder where module libraries are located.

Returns
The directory containing the main module DLLs.

◆ SetErrorCallback()

void ModuleManager::SetErrorCallback ( const std::function< void(const Exception &e)> & callback)
static

Sets a callback to be invoked when a module hook function throws an exception.

Parameters
[in]callbackThe error handler function.

◆ SetInitialized()

void ModuleManager::SetInitialized ( QTModelManager * model_manager,
QTWindowManager * window_manager )
static

Marks the module system as fully initialized and stores the manager pointers for use when late-loaded modules need to run SetupUIForNDEVR.

Parameters
[in]model_managerThe application model manager.
[in]window_managerThe application window manager.

◆ SetMainProgramModuleName()

void ModuleManager::SetMainProgramModuleName ( const StringView & name)
static

Sets the name of the main program module used as the application entry-point.

Parameters
[in]nameThe internal name of the main program module.

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