23#ifndef OPENSWMM_ENGINE_DEFAULT_OUTPUT_PLUGIN_HPP
24#define OPENSWMM_ENGINE_DEFAULT_OUTPUT_PLUGIN_HPP
26#include "../../../include/openswmm/plugin_sdk/IOutputPlugin.hpp"
58 int initialize(
const std::vector<std::string>& init_args,
70 return last_error_.c_str();
74 std::string out_path_;
76 std::string last_error_;
79 FILE* out_file_ =
nullptr;
84 int n_subcatch_vars_ = 0;
87 int flow_units_code_ = 0;
88 long id_start_pos_ = 0;
89 long input_start_pos_ = 0;
90 long output_start_pos_ = 0;
94 double ucf_rainfall_ = 1.0;
95 double ucf_raindepth_ = 1.0;
96 double ucf_evaprate_ = 1.0;
97 double ucf_length_ = 1.0;
98 double ucf_landarea_ = 1.0;
99 double ucf_volume_ = 1.0;
100 double ucf_flow_ = 1.0;
101 int unit_system_ = 0;
104 std::vector<char> subcatch_rpt_flag_;
105 std::vector<char> node_rpt_flag_;
106 std::vector<char> link_rpt_flag_;
108 static constexpr int MAGIC_NUMBER = 516114522;
109 static constexpr int VERSION = 60000;
110 static constexpr int MAX_SYS_RESULTS = 15;
113 void writeID(
const char*
id);
114 void writeInt4(
int value);
115 void writeReal4(
float value);
116 void writeReal8(
double value);
Default output plugin: writes SWMM 5.x compatible binary .out file.
Definition DefaultOutputPlugin.hpp:43
int update(const SimulationSnapshot &snapshot) override
Write one output snapshot. Called from the IO thread.
Definition DefaultOutputPlugin.cpp:80
const char * last_error_message() const noexcept override
Get the last error message from this plugin instance.
Definition DefaultOutputPlugin.hpp:69
~DefaultOutputPlugin() override=default
int initialize(const std::vector< std::string > &init_args, const IPluginComponentInfo *info) override
Definition DefaultOutputPlugin.cpp:39
PluginState state() const noexcept override
Query the current plugin state.
Definition DefaultOutputPlugin.hpp:56
int prepare(const SimulationContext &ctx) override
Open output file(s) and write headers.
Definition DefaultOutputPlugin.cpp:52
int finalize(const SimulationContext &ctx) override
Flush and close output file(s). Called from main thread.
Definition DefaultOutputPlugin.cpp:257
int validate(const SimulationContext &ctx) override
Validate plugin configuration against the simulation model.
Definition DefaultOutputPlugin.cpp:47
Interface for output-writing plugins.
Definition IOutputPlugin.hpp:57
Describes a plugin component: metadata, capabilities, and factory methods.
Definition IPluginComponentInfo.hpp:179
PluginState
Plugin lifecycle states.
Definition PluginState.hpp:67
@ UNLOADED
Library not yet loaded (or was closed).
Definition NodeCoupling.cpp:15
Central, reentrant simulation context.
Definition SimulationContext.hpp:274
Complete simulation state snapshot at one output time step.
Definition SimulationSnapshot.hpp:92