OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
IReportPlugin.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2//
3// Copyright 2026 Caleb Buahin
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
44
45#ifndef OPENSWMM_IREPORT_PLUGIN_HPP
46#define OPENSWMM_IREPORT_PLUGIN_HPP
47
48#include <string>
49#include <vector>
50#include "PluginState.hpp"
52
53namespace openswmm {
54
56
62public:
63 virtual ~IReportPlugin() = default;
64
66 virtual PluginState state() const noexcept = 0;
67
75 virtual int initialize(
76 const std::vector<std::string>& init_args,
77 const class IPluginComponentInfo* info
78 ) = 0;
79
86 virtual int validate(const SimulationContext& ctx) = 0;
87
94 virtual int prepare(const SimulationContext& ctx) = 0;
95
105 virtual int update(const SimulationSnapshot& snapshot) { (void)snapshot; return 0; }
106
117 virtual int write_summary(const SimulationContext& ctx) = 0;
118
125 virtual int finalize(const SimulationContext& ctx) = 0;
126
128 virtual const char* last_error_message() const noexcept { return ""; }
129};
130
131} /* namespace openswmm */
132
133#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:195
Interface for report-writing plugins.
Definition IReportPlugin.hpp:61
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:105
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:128
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:83
Definition NodeCoupling.cpp:16
Central, reentrant simulation context.
Definition SimulationContext.hpp:353
Complete simulation state snapshot at one output time step.
Definition SimulationSnapshot.hpp:117