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
36
46
47#ifndef OPENSWMM_IREPORT_PLUGIN_HPP
48#define OPENSWMM_IREPORT_PLUGIN_HPP
49
50#include <string>
51#include <vector>
52#include "PluginState.hpp"
54
55namespace openswmm {
56
58
64public:
69 virtual ~IReportPlugin() = default;
70
76 virtual PluginState state() const noexcept = 0;
77
90 virtual int initialize(const std::vector<std::string>& init_args,
91 const class IPluginComponentInfo* info) = 0;
92
101 virtual int validate(const SimulationContext& ctx) = 0;
102
110 virtual int prepare(const SimulationContext& ctx) = 0;
111
123 virtual int update(const SimulationSnapshot& snapshot) {
124 (void)snapshot;
125 return 0;
126 }
127
136 virtual int write_summary(const SimulationContext& ctx) = 0;
137
146 virtual int finalize(const SimulationContext& ctx) = 0;
147
153 virtual const char* last_error_message() const noexcept { return ""; }
154};
155
156} /* namespace openswmm */
157
158#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:201
Interface for report-writing plugins.
Definition IReportPlugin.hpp:63
virtual PluginState state() const noexcept=0
Read this implementation's current plugin lifecycle state.
virtual int finalize(const SimulationContext &ctx)=0
Finish this instance after producer/update work has stopped.
virtual int update(const SimulationSnapshot &snapshot)
Consume one output-time snapshot on the serialized I/O worker.
Definition IReportPlugin.hpp:123
virtual ~IReportPlugin()=default
Destroy this polymorphic instance after its callbacks and resource lifecycle finish....
virtual int write_summary(const SimulationContext &ctx)=0
Write final accumulated/model summary after asynchronous updates finish.
virtual int prepare(const SimulationContext &ctx)=0
Allocate/open model-dependent output resources before asynchronous updates.
virtual int validate(const SimulationContext &ctx)=0
Qualify instance configuration against the loaded compatible model.
virtual const char * last_error_message() const noexcept
Borrow the latest implementation error text without clearing it.
Definition IReportPlugin.hpp:153
virtual int initialize(const std::vector< std::string > &init_args, const class IPluginComponentInfo *info)=0
Parse instance configuration before model validation/preparation.
PluginState
Plugin lifecycle states.
Definition PluginState.hpp:86
Definition ExchangeLaw.hpp:60
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
Complete simulation state snapshot at one output time step.
Definition SimulationSnapshot.hpp:123