OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
GeoPackageReportPlugin.hpp
Go to the documentation of this file.
1
11#ifndef OPENSWMM_GEOPACKAGE_REPORT_PLUGIN_HPP
12#define OPENSWMM_GEOPACKAGE_REPORT_PLUGIN_HPP
13
14#include "GpkgUtils.hpp"
16#include <string>
17#include <unordered_map>
18
19namespace openswmm::gpkg {
20
22public:
24
25 PluginState state() const noexcept override { return state_; }
26
27 int initialize(const std::vector<std::string>& init_args,
28 const IPluginComponentInfo* info) override;
29
30 int validate(const SimulationContext& ctx) override;
31 int prepare(const SimulationContext& ctx) override;
32 int update(const SimulationSnapshot& snapshot) override;
33 int write_summary(const SimulationContext& ctx) override;
34 int finalize(const SimulationContext& ctx) override;
35
36 const char* last_error_message() const noexcept override {
37 return error_msg_.c_str();
38 }
39
40private:
42 std::string error_msg_;
43 std::string db_path_;
44 std::string simulation_id_;
45 DbPtr db_;
46
47 std::unordered_map<std::string, int> variable_ids_;
48 int lookup_variable(const std::string& name, const std::string& obj_type);
49};
50
51} // namespace openswmm::gpkg
52
53#endif // OPENSWMM_GEOPACKAGE_REPORT_PLUGIN_HPP
RAII wrappers and utilities for SQLite operations in GeoPackage I/O.
Interface for report-writing plugins.
Describes a plugin component: metadata, capabilities, and factory methods.
Definition IPluginComponentInfo.hpp:179
Interface for report-writing plugins.
Definition IReportPlugin.hpp:45
Definition GeoPackageReportPlugin.hpp:21
const char * last_error_message() const noexcept override
Get the last error message.
Definition GeoPackageReportPlugin.hpp:36
int write_summary(const SimulationContext &ctx) override
Write the final summary report. Called from main thread.
Definition GeoPackageReportPlugin.cpp:58
PluginState state() const noexcept override
Query the current plugin state.
Definition GeoPackageReportPlugin.hpp:25
int validate(const SimulationContext &ctx) override
Validate configuration against the loaded model.
Definition GeoPackageReportPlugin.cpp:29
int prepare(const SimulationContext &ctx) override
Open report file(s) and write any headers.
Definition GeoPackageReportPlugin.cpp:34
int update(const SimulationSnapshot &snapshot) override
Accumulate data from one output step. Called from IO thread.
Definition GeoPackageReportPlugin.cpp:54
int initialize(const std::vector< std::string > &init_args, const IPluginComponentInfo *info) override
Definition GeoPackageReportPlugin.cpp:17
int finalize(const SimulationContext &ctx) override
Flush and close report file(s).
Definition GeoPackageReportPlugin.cpp:137
PluginState
Plugin lifecycle states.
Definition PluginState.hpp:67
@ UNLOADED
Library not yet loaded (or was closed).
Definition GeoPackageInputPlugin.cpp:15
std::unique_ptr< sqlite3, DbDeleter > DbPtr
Definition GpkgUtils.hpp:42
Central, reentrant simulation context.
Definition SimulationContext.hpp:274
Complete simulation state snapshot at one output time step.
Definition SimulationSnapshot.hpp:92