OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
GeoPackagePluginInfo.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
37#ifndef OPENSWMM_GEOPACKAGE_PLUGIN_INFO_HPP
38#define OPENSWMM_GEOPACKAGE_PLUGIN_INFO_HPP
39
41#include <string>
42#include <vector>
43
44namespace openswmm::gpkg {
45
55class GeoPackagePluginInfo : public IPluginComponentInfo {
56public:
63 static GeoPackagePluginInfo& instance() {
64 static GeoPackagePluginInfo inst;
65 return inst;
66 }
67
68 // -----------------------------------------------------------------------
69 // Identity & metadata (IPluginComponentInfo)
70 // -----------------------------------------------------------------------
71
77 std::string id() const override { return "org.hydrocouple.openswmm.plugins.geopackage"; }
78
83 std::string caption() const override { return "GeoPackage I/O Plugin"; }
84
89 std::string description() const override {
90 return "Reads and writes SWMM model definitions, simulation results, "
91 "and observed data using the OGC GeoPackage format (SQLite with "
92 "spatial extensions). Supports multi-run storage, network topology "
93 "queries, and calibration workflows in a single .gpkg file.";
94 }
95
101 std::string version() const override { return "1.0.0"; }
102
107 std::string vendor() const override { return "HydroCouple"; }
108
113 std::string url() const override {
114 return "https://hydrocouple.org/projects/openswmm/plugins/geopackage";
115 }
116
121 std::vector<std::string> tags() const override {
122 return {"geopackage", "sqlite", "spatial", "input", "output",
123 "report", "ogc", "gis", "calibration"};
124 }
125
126 // -----------------------------------------------------------------------
127 // Licensing (IPluginComponentInfo)
128 // -----------------------------------------------------------------------
129
134 std::string license_type() const override { return "Apache-2.0"; }
135
141 std::string license_text() const override {
142 return "Copyright (c) 2026 Caleb Buahin. All rights reserved.\n"
143 "Licensed under the Apache License, Version 2.0 — see the\n"
144 "LICENSE and NOTICE files for full text.";
145 }
146
147 // -----------------------------------------------------------------------
148 // Capability queries (IPluginComponentInfo)
149 // -----------------------------------------------------------------------
150
155 bool has_input() const noexcept override { return true; }
160 bool has_output() const noexcept override { return true; }
165 bool has_report() const noexcept override { return true; }
166
167 // -----------------------------------------------------------------------
168 // File-filter advertisement (IPluginComponentInfo)
169 // -----------------------------------------------------------------------
170
178 std::vector<FileFilter> file_filters() const override {
179 const std::string desc = "OGC GeoPackage";
180 const std::vector<std::string> patterns = {"*.gpkg"};
181 const std::vector<std::string> mimes = {"application/geopackage+sqlite3"};
182 return {
183 FileFilter{desc, patterns, PluginRole::INPUT_READ, mimes},
184 FileFilter{desc, patterns, PluginRole::OUTPUT_WRITE, mimes},
185 FileFilter{desc, patterns, PluginRole::REPORT_WRITE, mimes},
186 };
187 }
188
189 // -----------------------------------------------------------------------
190 // Factory methods (IPluginComponentInfo)
191 // -----------------------------------------------------------------------
192
199 IInputPlugin* create_input_plugin() const override;
206 IOutputPlugin* create_output_plugin() const override;
213 IReportPlugin* create_report_plugin() const override;
214
215 // -----------------------------------------------------------------------
216 // Registration (IPluginComponentInfo overrides)
217 // -----------------------------------------------------------------------
218
230 bool register_plugin(const RegistrationInfo& info) override;
236 bool registered() const noexcept override { return registered_; }
241 RegistrationInfo registration_info() const override { return reg_info_; }
242
243private:
247 GeoPackagePluginInfo() = default;
255 GeoPackagePluginInfo& operator=(const GeoPackagePluginInfo&) = delete;
256
257 bool registered_ = false;
258 RegistrationInfo reg_info_;
259};
260
261} // namespace openswmm::gpkg
262
263// ============================================================================
264// Slice RC.2 — `openswmm_plugin_info` is no longer a public symbol.
265// ============================================================================
266//
267// The C factory function in GeoPackagePluginInfo.cpp is annotated with
268// __attribute__((visibility("hidden"))) and the GeoPackage CMake target
269// ships with CXX_VISIBILITY_PRESET=hidden / VISIBILITY_INLINES_HIDDEN=ON.
270// Together these prevent the dlsym leak that PluginFactory::discover()
271// was picking up on the engine's SHARED binary.
272//
273// Hosts that need the GeoPackage plugin should obtain it via the
274// PluginFactory (it is now registered as a built-in in
275// register_builtin_infos when OPENSWMM_HAS_GEOPACKAGE is defined) or via
276// openswmm::discover_plugins_by_id() — NOT via dlsym on the engine
277// library. See §R.3 of GUI_IMPLEMENTATION_PLAN.md (in the
278// openswmm.gui repo) for the full rationale.
279
280#endif // OPENSWMM_GEOPACKAGE_PLUGIN_INFO_HPP
Interface that describes a plugin component — metadata and factory methods.
Interface for input file reader/writer plugins.
Definition IInputPlugin.hpp:61
Interface for output-writing plugins.
Definition IOutputPlugin.hpp:77
Describes a plugin component: metadata, capabilities, and factory methods.
Definition IPluginComponentInfo.hpp:201
Interface for report-writing plugins.
Definition IReportPlugin.hpp:63
IPluginComponentInfo for the GeoPackage I/O plugin.
Definition GeoPackagePluginInfo.hpp:55
bool register_plugin(const RegistrationInfo &info) override
Copy supplied registration metadata and mark the singleton registered.
Definition GeoPackagePluginInfo.cpp:30
bool has_report() const noexcept override
Advertise the built-in GeoPackage report factory.
Definition GeoPackagePluginInfo.hpp:165
std::string caption() const override
Copy plugin caption metadata.
Definition GeoPackagePluginInfo.hpp:83
std::string version() const override
Copy plugin version metadata.
Definition GeoPackagePluginInfo.hpp:101
std::string license_type() const override
Copy plugin license type metadata.
Definition GeoPackagePluginInfo.hpp:134
std::vector< FileFilter > file_filters() const override
Copy file-filter advertisements for all three GeoPackage IO roles.
Definition GeoPackagePluginInfo.hpp:178
std::string url() const override
Copy plugin url metadata.
Definition GeoPackagePluginInfo.hpp:113
bool has_input() const noexcept override
Advertise the built-in GeoPackage input factory.
Definition GeoPackagePluginInfo.hpp:155
IReportPlugin * create_report_plugin() const override
Allocate a fresh GeoPackage report plugin instance.
Definition GeoPackagePluginInfo.cpp:26
IOutputPlugin * create_output_plugin() const override
Allocate a fresh GeoPackage output plugin instance.
Definition GeoPackagePluginInfo.cpp:22
std::string description() const override
Copy plugin description metadata.
Definition GeoPackagePluginInfo.hpp:89
std::string vendor() const override
Copy plugin vendor metadata.
Definition GeoPackagePluginInfo.hpp:107
bool registered() const noexcept override
Read the stored metadata-registration flag.
Definition GeoPackagePluginInfo.hpp:236
std::string license_text() const override
Copy plugin license text metadata.
Definition GeoPackagePluginInfo.hpp:141
bool has_output() const noexcept override
Advertise the built-in GeoPackage output factory.
Definition GeoPackagePluginInfo.hpp:160
static GeoPackagePluginInfo & instance()
Borrow the process-local GeoPackage metadata singleton.
Definition GeoPackagePluginInfo.hpp:63
std::string id() const override
Copy plugin id metadata.
Definition GeoPackagePluginInfo.hpp:77
RegistrationInfo registration_info() const override
Copy stored registration metadata.
Definition GeoPackagePluginInfo.hpp:241
std::vector< std::string > tags() const override
Copy discovery/search tags.
Definition GeoPackagePluginInfo.hpp:121
IInputPlugin * create_input_plugin() const override
Allocate a fresh GeoPackage input plugin instance.
Definition GeoPackagePluginInfo.cpp:18
@ OUTPUT_WRITE
Plugin writes a time-series results file (e.g. *.out).
Definition IPluginComponentInfo.hpp:97
@ REPORT_WRITE
Plugin writes a summary report file (e.g. *.rpt).
Definition IPluginComponentInfo.hpp:98
@ INPUT_READ
Plugin reads a model input file (e.g. *.inp).
Definition IPluginComponentInfo.hpp:96
Definition ExternalContentReader.cpp:50
A file-format filter advertised by a plugin.
Definition IPluginComponentInfo.hpp:137
Registration information for plugin activation.
Definition IPluginComponentInfo.hpp:183