OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
GeoPackageInputPlugin.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
31
32#ifndef OPENSWMM_GEOPACKAGE_INPUT_PLUGIN_HPP
33#define OPENSWMM_GEOPACKAGE_INPUT_PLUGIN_HPP
34
36#include <string>
37#include <vector>
38
39namespace openswmm::gpkg {
40
42public:
44
45 PluginState state() const noexcept override { return state_; }
46
47 int initialize(const std::vector<std::string>& init_args,
48 const IPluginComponentInfo* info) override;
49
50 int validate(const SimulationContext& ctx) override;
51
62 int read(const std::string& path, SimulationContext& ctx) override;
63
71 int write(const std::string& path, const SimulationContext& ctx) override;
72
73 std::vector<std::string> skipped_sections() const override { return {}; }
74
75 int finalize(const SimulationContext& ctx) override;
76
77 const char* last_error_message() const noexcept override {
78 return error_msg_.c_str();
79 }
80
81private:
83 std::string error_msg_;
84 std::string simulation_id_ = "default";
85 int srs_id_ = 0;
86};
87
88} // namespace openswmm::gpkg
89
90#endif // OPENSWMM_GEOPACKAGE_INPUT_PLUGIN_HPP
Interface for input file reader/writer plugins.
Interface for input file reader/writer plugins.
Definition IInputPlugin.hpp:59
Describes a plugin component: metadata, capabilities, and factory methods.
Definition IPluginComponentInfo.hpp:195
PluginState state() const noexcept override
Query the current plugin state.
Definition GeoPackageInputPlugin.hpp:45
std::vector< std::string > skipped_sections() const override
Sections or elements that were skipped during the last read().
Definition GeoPackageInputPlugin.hpp:73
int finalize(const SimulationContext &ctx) override
Finalize and release resources.
Definition GeoPackageInputPlugin.cpp:96
const char * last_error_message() const noexcept override
Get the last error message.
Definition GeoPackageInputPlugin.hpp:77
int write(const std::string &path, const SimulationContext &ctx) override
Write a SWMM model to a GeoPackage file.
Definition GeoPackageInputPlugin.cpp:68
int read(const std::string &path, SimulationContext &ctx) override
Read a SWMM model from a GeoPackage file.
Definition GeoPackageInputPlugin.cpp:35
int validate(const SimulationContext &ctx) override
Validate configuration against the loaded model.
Definition GeoPackageInputPlugin.cpp:30
int initialize(const std::vector< std::string > &init_args, const IPluginComponentInfo *info) override
Initialize from [PLUGINS] arguments.
Definition GeoPackageInputPlugin.cpp:17
PluginState
Plugin lifecycle states.
Definition PluginState.hpp:83
@ UNLOADED
Library not yet loaded (or was closed).
Definition PluginState.hpp:84
Definition ExternalContentReader.cpp:49
Central, reentrant simulation context.
Definition SimulationContext.hpp:353