Manages all dynamically loaded plugins for one engine instance.
More...
#include <PluginFactory.hpp>
Manages all dynamically loaded plugins for one engine instance.
One PluginFactory per SWMMEngine instance (NOT a singleton). This allows multiple concurrent engine instances (e.g. Monte Carlo runs) to each have their own independent plugin set.
◆ PluginFactory() [1/3]
| openswmm::PluginFactory::PluginFactory |
( |
| ) |
|
|
default |
◆ ~PluginFactory()
| openswmm::PluginFactory::~PluginFactory |
( |
| ) |
|
◆ PluginFactory() [2/3]
◆ PluginFactory() [3/3]
◆ add_output_plugin()
| void openswmm::PluginFactory::add_output_plugin |
( |
IOutputPlugin * |
plugin, |
|
|
std::vector< std::string > |
args = {} |
|
) |
| |
Inject a pre-created output plugin instance (takes ownership).
Used by SWMMEngine to register the DefaultOutputPlugin without going through the [PLUGINS] / dlopen path.
- Parameters
-
| plugin | Heap-allocated instance; PluginFactory will delete it. |
| args | Init args (empty for built-in plugins). |
◆ add_report_plugin()
| void openswmm::PluginFactory::add_report_plugin |
( |
IReportPlugin * |
plugin | ) |
|
Inject a pre-created report plugin instance (takes ownership).
◆ empty()
| bool openswmm::PluginFactory::empty |
( |
| ) |
const |
|
inlinenoexcept |
True if no plugins have been loaded.
◆ finalize_all()
Call finalize() on all plugins.
Called from the main thread after the IO thread has been joined.
◆ initialize_all()
Call initialize() on all output and report plugins.
- Parameters
-
| ctx | Simulation context (for metadata). |
- Returns
- 0 on success; last non-zero error code if any plugin failed.
◆ load_plugins()
| int openswmm::PluginFactory::load_plugins |
( |
const std::vector< PluginSpec > & |
specs, |
|
|
std::function< void(const std::string &)> |
warn_cb = {} |
|
) |
| |
Load all plugins listed in the given specs.
For each spec: dlopen(spec.path), resolve openswmm_plugin_info, call create_output_plugin() / create_report_plugin(). Specs with load errors are skipped with a warning; they do not abort the whole load.
- Parameters
-
| specs | Plugin specs parsed from [PLUGINS]. |
| warn_cb | Optional callback to report per-plugin load errors. Signature: void(const std::string& message). |
- Returns
- Number of successfully loaded plugins.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ output_plugins()
| const std::vector< IOutputPlugin * > & openswmm::PluginFactory::output_plugins |
( |
| ) |
const |
|
inlinenoexcept |
All loaded output plugin instances.
◆ plugin_count()
| int openswmm::PluginFactory::plugin_count |
( |
| ) |
const |
|
inlinenoexcept |
Total number of loaded plugins (output + report).
◆ prepare_all()
Call prepare() on all plugins (open output files, write headers).
◆ report_plugins()
| const std::vector< IReportPlugin * > & openswmm::PluginFactory::report_plugins |
( |
| ) |
const |
|
inlinenoexcept |
All loaded report plugin instances.
◆ unload_all()
| void openswmm::PluginFactory::unload_all |
( |
| ) |
|
Unload all plugins and close library handles.
◆ update_all()
Deliver a snapshot to all output AND report plugins.
Called from the IO thread at each output boundary. Only plugins in PREPARED or UPDATING state receive the update.
- Parameters
-
| snapshot | Read-only simulation state snapshot. |
- Returns
- 0 on success; last non-zero error code if any plugin failed.
◆ validate_all()
Call validate() on all plugins.
◆ write_summary_all()
Call write_summary() on all report plugins.
Called after finalize_all(), during SWMMEngine::report().
The documentation for this class was generated from the following files:
- /home/runner/work/openswmm.engine/openswmm.engine/src/engine/plugins/PluginFactory.hpp
- /home/runner/work/openswmm.engine/openswmm.engine/src/engine/plugins/PluginFactory.cpp