OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
IInputPlugin.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
42
43#ifndef OPENSWMM_IINPUT_PLUGIN_HPP
44#define OPENSWMM_IINPUT_PLUGIN_HPP
45
46#include <string>
47#include <vector>
48#include "PluginState.hpp"
49
50namespace openswmm {
51
54
60public:
61 virtual ~IInputPlugin() = default;
62
64 virtual PluginState state() const noexcept = 0;
65
73 virtual int initialize(
74 const std::vector<std::string>& init_args,
75 const IPluginComponentInfo* info
76 ) = 0;
77
84 virtual int validate(const SimulationContext& ctx) = 0;
85
106 virtual int read(const std::string& path, SimulationContext& ctx) = 0;
107
118 virtual int write(const std::string& path, const SimulationContext& ctx) = 0;
119
130 virtual std::vector<std::string> skipped_sections() const { return {}; }
131
138 virtual int finalize(const SimulationContext& ctx) = 0;
139
141 virtual const char* last_error_message() const noexcept { return ""; }
142};
143
144} /* namespace openswmm */
145
146#endif /* OPENSWMM_IINPUT_PLUGIN_HPP */
Plugin lifecycle state enumerator.
Interface for input file reader/writer plugins.
Definition IInputPlugin.hpp:59
virtual int finalize(const SimulationContext &ctx)=0
Finalize and release resources.
virtual int validate(const SimulationContext &ctx)=0
Validate configuration against the loaded model.
virtual ~IInputPlugin()=default
virtual const char * last_error_message() const noexcept
Get the last error message.
Definition IInputPlugin.hpp:141
virtual std::vector< std::string > skipped_sections() const
Sections or elements that were skipped during the last read().
Definition IInputPlugin.hpp:130
virtual int initialize(const std::vector< std::string > &init_args, const IPluginComponentInfo *info)=0
Initialize from [PLUGINS] arguments.
virtual PluginState state() const noexcept=0
Query the current plugin state.
virtual int read(const std::string &path, SimulationContext &ctx)=0
Read model data from a file into the simulation context.
virtual int write(const std::string &path, const SimulationContext &ctx)=0
Write model data from the simulation context to a file.
Describes a plugin component: metadata, capabilities, and factory methods.
Definition IPluginComponentInfo.hpp:195
PluginState
Plugin lifecycle states.
Definition PluginState.hpp:83
Definition NodeCoupling.cpp:16
Central, reentrant simulation context.
Definition SimulationContext.hpp:353