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, auto-discovery, and lifecycle manager. More...

#include <string>
#include <vector>
#include <unordered_map>
#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 plugin discovery, loading, and lifecycle for one engine instance. More...
 
struct  openswmm::PluginFactory::ComponentEntry
 List all discovered component info entries. More...
 

Namespaces

namespace  openswmm
 

Detailed Description

Plugin loader, auto-discovery, and lifecycle manager.

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

  1. Auto-discovery — On construction, scans the engine library directory and subdirectories (plugins/, components/) for compatible shared libraries that export openswmm_plugin_info. Discovered libraries are registered in a component registry keyed by "id:version".
  2. Resolution — Given a string that is either a file path or an "id" / "id:version" identifier, resolves it to an IPluginComponentInfo.
  3. Instantiation — Creates IInputPlugin, IOutputPlugin, or IReportPlugin instances via factory methods on IPluginComponentInfo.
  4. Lifecycle dispatch — Calls initialize(), validate(), prepare(), finalize(), and write_summary() on all loaded plugin instances.
  5. 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).

See also
IPluginComponentInfo.hpp
IInputPlugin.hpp
IOutputPlugin.hpp
IReportPlugin.hpp
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n MIT License