SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmmvis::ExtensionManager Class Reference

#include <extensionmanager.h>

Inheritance diagram for openswmmvis::ExtensionManager:
Collaboration diagram for openswmmvis::ExtensionManager:

Classes

struct  Loaded
 One successfully initialized extension and its ordered owned lifetime resources. More...
 

Public Types

using HostFactory = std::function< std::unique_ptr< OpenSWMM::Sdk::ExtensionHost >(const QString &)>
 Factory transferring one initialized-service host to the loader for a validated plugin ID.
 

Signals

void changed ()
 Notify inventory observers after a rescan, load or enable-state change.
 

Public Member Functions

 ExtensionManager (OpenSWMM::Sdk::CompatibilityManifest manifest, QSettings *settings, QObject *parent=nullptr)
 Construct a GUI-thread loader with injectable build identity and settings.
 
 ~ExtensionManager () override
 Stop initialized extensions and destroy their hosts without unloading native code.
 
OpenSWMM::Sdk::CompatibilityManifest manifest () const
 Read the build manifest with the actual loaded engine identity applied.
 
void setEngineRuntimeAbiTag (const QString &tag)
 Supply the engine-owned runtime identity before plugin discovery/loading.
 
QList< GuiExtensionRecord > records () const
 Copy discovery and load diagnostics.
 
QStringList directories () const
 Resolve app, user-data and additional extension directories.
 
void addDirectory (const QString &path)
 Persist an existing canonical directory and rescan metadata.
 
void setEnabled (const QString &id, bool enabled)
 Persist an enable-state change for the next application launch.
 
void rescan ()
 Rebuild metadata inventory without executing plugin code; preserve this session load failures.
 
void start (HostFactory factory, bool safeMode=false)
 Load enabled compatible plugins once, recovering interrupted operations first.
 
void shutdown ()
 Join jobs, call plugin shutdown, then remove contributions in reverse load order; idempotent.
 
void refreshModels ()
 Materialize model facades before project state is restored on a newly loaded window.
 
bool safeMode () const
 Inspect startup safe mode.
 

Static Public Member Functions

static ExtensionManager * instance ()
 Obtain the application-owned GUI-thread manager.
 
static OpenSWMM::Sdk::CompatibilityManifest buildManifest ()
 Read the manifest generated by this application build.
 
static QString compatibilityError (const OpenSWMM::Sdk::CompatibilityManifest &host, const OpenSWMM::Sdk::CompatibilityManifest &plugin, bool requiresEngineAbi, QString *warning=nullptr)
 Validate native metadata before instantiating the plugin.
 

Detailed Description

Discovers metadata without executing code; retains loaded libraries until process exit.

Member Typedef Documentation

◆ HostFactory

using openswmmvis::ExtensionManager::HostFactory = std::function<std::unique_ptr<OpenSWMM::Sdk::ExtensionHost>(const QString &)>

Factory transferring one initialized-service host to the loader for a validated plugin ID.

Constructor & Destructor Documentation

◆ ExtensionManager()

openswmmvis::ExtensionManager::ExtensionManager ( OpenSWMM::Sdk::CompatibilityManifest  manifest,
QSettings *  settings,
QObject *  parent = nullptr 
)
explicit

Construct a GUI-thread loader with injectable build identity and settings.

Parameters
[in]manifestRunning host compatibility identity.
[in]settingsRequired borrowed settings; must outlive this manager.
[in]parentOptional QObject owner.
Here is the call graph for this function:

◆ ~ExtensionManager()

openswmmvis::ExtensionManager::~ExtensionManager ( )
override

Stop initialized extensions and destroy their hosts without unloading native code.

Here is the call graph for this function:

Member Function Documentation

◆ addDirectory()

void openswmmvis::ExtensionManager::addDirectory ( const QString &  path)

Persist an existing canonical directory and rescan metadata.

Parameters
[in]pathLocal directory; nonexistent paths are ignored.
Note
Rescanning never loads a newly discovered native library during this session.
Here is the call graph for this function:

◆ buildManifest()

CompatibilityManifest openswmmvis::ExtensionManager::buildManifest ( )
static

Read the manifest generated by this application build.

Returns
Owning build metadata.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ changed

void openswmmvis::ExtensionManager::changed ( )
signal

Notify inventory observers after a rescan, load or enable-state change.

Here is the caller graph for this function:

◆ compatibilityError()

QString openswmmvis::ExtensionManager::compatibilityError ( const OpenSWMM::Sdk::CompatibilityManifest &  host,
const OpenSWMM::Sdk::CompatibilityManifest &  plugin,
bool  requiresEngineAbi,
QString *  warning = nullptr 
)
static

Validate native metadata before instantiating the plugin.

Parameters
[in]hostRunning host identity.
[in]pluginPlugin's embedded builtAgainst manifest.
[in]requiresEngineAbiRefuse engine fingerprint mismatch instead of warning.
[out]warningOptional nonfatal engine-ABI warning, cleared before validation.
Returns
Empty if load is allowed; otherwise the mismatched field and both values.
Here is the caller graph for this function:

◆ directories()

QStringList openswmmvis::ExtensionManager::directories ( ) const

Resolve app, user-data and additional extension directories.

Returns
Search paths in precedence order.
Here is the caller graph for this function:

◆ instance()

ExtensionManager * openswmmvis::ExtensionManager::instance ( )
static

Obtain the application-owned GUI-thread manager.

Returns
Borrowed singleton.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ manifest()

OpenSWMM::Sdk::CompatibilityManifest openswmmvis::ExtensionManager::manifest ( ) const
inline

Read the build manifest with the actual loaded engine identity applied.

Returns
Owning manifest used for plugin compatibility checks and initialized hosts.

◆ records()

QList< GuiExtensionRecord > openswmmvis::ExtensionManager::records ( ) const
inline

Copy discovery and load diagnostics.

Returns
Owning records, including incompatible and failed extensions.

◆ refreshModels()

void openswmmvis::ExtensionManager::refreshModels ( )

Materialize model facades before project state is restored on a newly loaded window.

◆ rescan()

void openswmmvis::ExtensionManager::rescan ( )

Rebuild metadata inventory without executing plugin code; preserve this session load failures.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ safeMode()

bool openswmmvis::ExtensionManager::safeMode ( ) const
inline

Inspect startup safe mode.

Returns
True when native initialization was skipped.
Here is the caller graph for this function:

◆ setEnabled()

void openswmmvis::ExtensionManager::setEnabled ( const QString &  id,
bool  enabled 
)

Persist an enable-state change for the next application launch.

Parameters
[in]idDiscovered extension identity.
[in]enabledDesired next-launch state; loaded libraries stay resident.
Here is the call graph for this function:

◆ setEngineRuntimeAbiTag()

void openswmmvis::ExtensionManager::setEngineRuntimeAbiTag ( const QString &  tag)

Supply the engine-owned runtime identity before plugin discovery/loading.

Parameters
[in]tagActual swmm_engine_abi_tag() value; empty means unavailable.
Note
GUI-thread setup only. Calls after start() are ignored. This keeps the loader's engine dependency outside the generic Qt-only host library.

◆ shutdown()

void openswmmvis::ExtensionManager::shutdown ( )

Join jobs, call plugin shutdown, then remove contributions in reverse load order; idempotent.

Here is the caller graph for this function:

◆ start()

void openswmmvis::ExtensionManager::start ( HostFactory  factory,
bool  safeMode = false 
)

Load enabled compatible plugins once, recovering interrupted operations first.

Parameters
[in]factoryCreates an owning per-plugin SDK host for a validated identity.
[in]safeModeSkip all native plugin initialization while retaining diagnostics.
Note
Records a synchronous crash marker before initialization and cleans partial contributions on failure.
Here is the call graph for this function:

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