OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
IOutputPlugin.hpp
Go to the documentation of this file.
1
40#ifndef OPENSWMM_IOUTPUT_PLUGIN_HPP
41#define OPENSWMM_IOUTPUT_PLUGIN_HPP
42
43#include <string>
44#include <vector>
45#include "PluginState.hpp"
47
48/* Forward declaration — avoid pulling in the full SimulationContext */
49namespace openswmm { struct SimulationContext; }
50
51namespace openswmm {
52
58public:
59 virtual ~IOutputPlugin() = default;
60
61 // -----------------------------------------------------------------------
62 // State query
63 // -----------------------------------------------------------------------
64
69 virtual PluginState state() const noexcept = 0;
70
71 // -----------------------------------------------------------------------
72 // Lifecycle methods (main thread)
73 // -----------------------------------------------------------------------
74
91 virtual int initialize(
92 const std::vector<std::string>& init_args,
93 const class IPluginComponentInfo* info
94 ) = 0;
95
108 virtual int validate(const SimulationContext& ctx) = 0;
109
122 virtual int prepare(const SimulationContext& ctx) = 0;
123
137 virtual int update(const SimulationSnapshot& snapshot) = 0;
138
151 virtual int finalize(const SimulationContext& ctx) = 0;
152
153 // -----------------------------------------------------------------------
154 // Optional: error message
155 // -----------------------------------------------------------------------
156
161 virtual const char* last_error_message() const noexcept { return ""; }
162};
163
164} /* namespace openswmm */
165
166#endif /* OPENSWMM_IOUTPUT_PLUGIN_HPP */
Plugin lifecycle state enumerator.
Read-only snapshot of simulation state passed to plugins.
Interface for output-writing plugins.
Definition IOutputPlugin.hpp:57
virtual ~IOutputPlugin()=default
virtual int update(const SimulationSnapshot &snapshot)=0
Write one output snapshot. Called from the IO thread.
virtual const char * last_error_message() const noexcept
Get the last error message from this plugin instance.
Definition IOutputPlugin.hpp:161
virtual int validate(const SimulationContext &ctx)=0
Validate plugin configuration against the simulation model.
virtual int initialize(const std::vector< std::string > &init_args, const class IPluginComponentInfo *info)=0
Initialize the plugin from command-line-style arguments.
virtual int finalize(const SimulationContext &ctx)=0
Flush and close output file(s). Called from main thread.
virtual int prepare(const SimulationContext &ctx)=0
Open output file(s) and write headers.
virtual PluginState state() const noexcept=0
Query the current plugin state.
Describes a plugin component: metadata, capabilities, and factory methods.
Definition IPluginComponentInfo.hpp:57
PluginState
Plugin lifecycle states.
Definition PluginState.hpp:67
Definition Controls.cpp:24
Central, reentrant simulation context.
Definition SimulationContext.hpp:141
Complete simulation state snapshot at one output time step.
Definition SimulationSnapshot.hpp:90