OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
PluginFactory.hpp File Reference

Plugin loader and lifecycle manager (Phase 4, R14). More...

#include <string>
#include <vector>
#include <functional>
Include dependency graph for PluginFactory.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  openswmm::PluginFactory
 Manages all dynamically loaded plugins for one engine instance. More...
 

Namespaces

namespace  openswmm
 

Detailed Description

Plugin loader and lifecycle manager (Phase 4, R14).

PluginFactory owns all dynamically loaded plugin libraries. It is responsible for:

  1. Loading shared libraries via dlopen/LoadLibrary and resolving the openswmm_plugin_info symbol to get an IPluginComponentInfo*.
  2. Instantiating IOutputPlugin and/or IReportPlugin via the factory methods on IPluginComponentInfo.
  3. Lifecycle dispatch — calling initialize(), validate(), prepare(), finalize(), and (for IReportPlugin) write_summary() on all loaded plugin instances in registration order.
  4. Cleanup — dlclose() on all library handles at destruction.

Threading

All lifecycle methods except update() run on the main simulation thread. update() is called from the IO thread (via IOThread). PluginFactory does NOT directly call update() — that is done by the IOThread.

Error handling

If a plugin's lifecycle method returns non-zero, the plugin is transitioned to PluginState::ERROR and a warning is emitted. Non-error plugins continue. If ALL plugins error, the factory returns the last error code.

See also
IPluginComponentInfo.hpp
IOutputPlugin.hpp
IReportPlugin.hpp
src/engine/output/IOThread.hpp
docs/MASTER_IMPLEMENTATION_PLAN.md Phase 4
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n MIT License