OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
IReportPlugin.hpp
Go to the documentation of this file.
1
29#ifndef OPENSWMM_IREPORT_PLUGIN_HPP
30#define OPENSWMM_IREPORT_PLUGIN_HPP
31
32#include <string>
33#include <vector>
34#include "PluginState.hpp"
36
37namespace openswmm {
38
39struct SimulationContext;
40
46public:
47 virtual ~IReportPlugin() = default;
48
50 virtual PluginState state() const noexcept = 0;
51
59 virtual int initialize(
60 const std::vector<std::string>& init_args,
61 const class IPluginComponentInfo* info
62 ) = 0;
63
70 virtual int validate(const SimulationContext& ctx) = 0;
71
78 virtual int prepare(const SimulationContext& ctx) = 0;
79
89 virtual int update(const SimulationSnapshot& snapshot) { (void)snapshot; return 0; }
90
101 virtual int write_summary(const SimulationContext& ctx) = 0;
102
109 virtual int finalize(const SimulationContext& ctx) = 0;
110
112 virtual const char* last_error_message() const noexcept { return ""; }
113};
114
115} /* namespace openswmm */
116
117#endif /* OPENSWMM_IREPORT_PLUGIN_HPP */
Plugin lifecycle state enumerator.
Read-only snapshot of simulation state passed to plugins.
Describes a plugin component: metadata, capabilities, and factory methods.
Definition IPluginComponentInfo.hpp:57
Interface for report-writing plugins.
Definition IReportPlugin.hpp:45
virtual PluginState state() const noexcept=0
Query the current plugin state.
virtual int finalize(const SimulationContext &ctx)=0
Flush and close report file(s).
virtual int update(const SimulationSnapshot &snapshot)
Accumulate data from one output step. Called from IO thread.
Definition IReportPlugin.hpp:89
virtual ~IReportPlugin()=default
virtual int write_summary(const SimulationContext &ctx)=0
Write the final summary report. Called from main thread.
virtual int prepare(const SimulationContext &ctx)=0
Open report file(s) and write any headers.
virtual int validate(const SimulationContext &ctx)=0
Validate configuration against the loaded model.
virtual const char * last_error_message() const noexcept
Get the last error message.
Definition IReportPlugin.hpp:112
virtual int initialize(const std::vector< std::string > &init_args, const class IPluginComponentInfo *info)=0
Initialize from [PLUGINS] arguments.
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