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
37
38#ifndef OPENSWMM_GEOPACKAGE_PLUGIN_INFO_HPP
39#define OPENSWMM_GEOPACKAGE_PLUGIN_INFO_HPP
40
42#include <string>
43#include <vector>
44
45namespace openswmm::gpkg {
46
56class GeoPackagePluginInfo : public IPluginComponentInfo {
57public:
58
62 static GeoPackagePluginInfo& instance() {
63 static GeoPackagePluginInfo inst;
64 return inst;
65 }
66
67 // -----------------------------------------------------------------------
68 // Identity & metadata (IPluginComponentInfo)
69 // -----------------------------------------------------------------------
70
71 std::string id() const override {
72 return "org.hydrocouple.openswmm.plugins.geopackage";
73 }
74
75 std::string caption() const override {
76 return "GeoPackage I/O Plugin";
77 }
78
79 std::string description() const override {
80 return "Reads and writes SWMM model definitions, simulation results, "
81 "and observed data using the OGC GeoPackage format (SQLite with "
82 "spatial extensions). Supports multi-run storage, network topology "
83 "queries, and calibration workflows in a single .gpkg file.";
84 }
85
86 std::string version() const override {
87 return "1.0.0";
88 }
89
90 std::string vendor() const override {
91 return "HydroCouple";
92 }
93
94 std::string url() const override {
95 return "https://hydrocouple.org/projects/openswmm/plugins/geopackage";
96 }
97
98 std::vector<std::string> tags() const override {
99 return {"geopackage", "sqlite", "spatial", "input", "output", "report",
100 "ogc", "gis", "calibration"};
101 }
102
103 // -----------------------------------------------------------------------
104 // Licensing (IPluginComponentInfo)
105 // -----------------------------------------------------------------------
106
107 std::string license_type() const override {
108 return "Apache-2.0";
109 }
110
111 std::string license_text() const override {
112 return "Copyright (c) 2026 Caleb Buahin. All rights reserved.\n"
113 "Licensed under the Apache License, Version 2.0 — see the\n"
114 "LICENSE and NOTICE files for full text.";
115 }
116
117 // -----------------------------------------------------------------------
118 // Capability queries (IPluginComponentInfo)
119 // -----------------------------------------------------------------------
120
121 bool has_input() const noexcept override { return true; }
122 bool has_output() const noexcept override { return true; }
123 bool has_report() const noexcept override { return true; }
124
125 // -----------------------------------------------------------------------
126 // File-filter advertisement (IPluginComponentInfo)
127 // -----------------------------------------------------------------------
128
129 std::vector<FileFilter> file_filters() const override {
130 const std::string desc = "OGC GeoPackage";
131 const std::vector<std::string> patterns = {"*.gpkg"};
132 const std::vector<std::string> mimes = {"application/geopackage+sqlite3"};
133 return {
134 FileFilter{ desc, patterns, PluginRole::INPUT_READ, mimes },
135 FileFilter{ desc, patterns, PluginRole::OUTPUT_WRITE, mimes },
136 FileFilter{ desc, patterns, PluginRole::REPORT_WRITE, mimes },
137 };
138 }
139
140 // -----------------------------------------------------------------------
141 // Factory methods (IPluginComponentInfo)
142 // -----------------------------------------------------------------------
143
144 IInputPlugin* create_input_plugin() const override;
145 IOutputPlugin* create_output_plugin() const override;
146 IReportPlugin* create_report_plugin() const override;
147
148 // -----------------------------------------------------------------------
149 // Registration (IPluginComponentInfo overrides)
150 // -----------------------------------------------------------------------
151
152 bool register_plugin(const RegistrationInfo& info) override;
153 bool registered() const noexcept override { return registered_; }
154 RegistrationInfo registration_info() const override { return reg_info_; }
155
156private:
157 GeoPackagePluginInfo() = default;
159 GeoPackagePluginInfo& operator=(const GeoPackagePluginInfo&) = delete;
160
161 bool registered_ = false;
162 RegistrationInfo reg_info_;
163};
164
165} // namespace openswmm::gpkg
166
167// ============================================================================
168// Slice RC.2 — `openswmm_plugin_info` is no longer a public symbol.
169// ============================================================================
170//
171// The C factory function in GeoPackagePluginInfo.cpp is annotated with
172// __attribute__((visibility("hidden"))) and the GeoPackage CMake target
173// ships with CXX_VISIBILITY_PRESET=hidden / VISIBILITY_INLINES_HIDDEN=ON.
174// Together these prevent the dlsym leak that PluginFactory::discover()
175// was picking up on the engine's SHARED binary.
176//
177// Hosts that need the GeoPackage plugin should obtain it via the
178// PluginFactory (it is now registered as a built-in in
179// register_builtin_infos when OPENSWMM_HAS_GEOPACKAGE is defined) or via
180// openswmm::discover_plugins_by_id() — NOT via dlsym on the engine
181// library. See §R.3 of GUI_IMPLEMENTATION_PLAN.md (in the
182// openswmm.gui repo) for the full rationale.
183
184#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:59
Interface for output-writing plugins.
Definition IOutputPlugin.hpp:73
Describes a plugin component: metadata, capabilities, and factory methods.
Definition IPluginComponentInfo.hpp:195
Interface for report-writing plugins.
Definition IReportPlugin.hpp:61
IPluginComponentInfo for the GeoPackage I/O plugin.
Definition GeoPackagePluginInfo.hpp:56
bool register_plugin(const RegistrationInfo &info) override
Register the plugin with the provided registration information.
Definition GeoPackagePluginInfo.cpp:26
bool has_report() const noexcept override
True if this plugin can create an IReportPlugin.
Definition GeoPackagePluginInfo.hpp:123
std::string caption() const override
Human-readable display name of the plugin.
Definition GeoPackagePluginInfo.hpp:75
std::string version() const override
Plugin version string (Semantic Versioning recommended).
Definition GeoPackagePluginInfo.hpp:86
std::string license_type() const override
SPDX license identifier for this plugin.
Definition GeoPackagePluginInfo.hpp:107
std::vector< FileFilter > file_filters() const override
File-format filters this plugin handles.
Definition GeoPackagePluginInfo.hpp:129
std::string url() const override
URL to the plugin's home page or documentation.
Definition GeoPackagePluginInfo.hpp:94
bool has_input() const noexcept override
True if this plugin can create an IInputPlugin.
Definition GeoPackagePluginInfo.hpp:121
IReportPlugin * create_report_plugin() const override
Create a new IReportPlugin instance.
Definition GeoPackagePluginInfo.cpp:22
IOutputPlugin * create_output_plugin() const override
Create a new IOutputPlugin instance.
Definition GeoPackagePluginInfo.cpp:18
std::string description() const override
Detailed description of what this plugin does.
Definition GeoPackagePluginInfo.hpp:79
std::string vendor() const override
Vendor / author name.
Definition GeoPackagePluginInfo.hpp:90
bool registered() const noexcept override
Check whether the plugin is currently registered.
Definition GeoPackagePluginInfo.hpp:153
std::string license_text() const override
Full license text for this plugin.
Definition GeoPackagePluginInfo.hpp:111
bool has_output() const noexcept override
True if this plugin can create an IOutputPlugin.
Definition GeoPackagePluginInfo.hpp:122
static GeoPackagePluginInfo & instance()
Get the singleton instance.
Definition GeoPackagePluginInfo.hpp:62
std::string id() const override
Unique plugin identifier in reverse-DNS notation.
Definition GeoPackagePluginInfo.hpp:71
RegistrationInfo registration_info() const override
Get the current registration information.
Definition GeoPackagePluginInfo.hpp:154
std::vector< std::string > tags() const override
Additional tags or keywords for discovery.
Definition GeoPackagePluginInfo.hpp:98
IInputPlugin * create_input_plugin() const override
Create a new IInputPlugin instance.
Definition GeoPackagePluginInfo.cpp:14
@ OUTPUT_WRITE
Plugin writes a time-series results file (e.g. *.out).
Definition IPluginComponentInfo.hpp:95
@ REPORT_WRITE
Plugin writes a summary report file (e.g. *.rpt).
Definition IPluginComponentInfo.hpp:96
@ INPUT_READ
Plugin reads a model input file (e.g. *.inp).
Definition IPluginComponentInfo.hpp:94
Definition ExternalContentReader.cpp:49
A file-format filter advertised by a plugin.
Definition IPluginComponentInfo.hpp:131
Registration information for plugin activation.
Definition IPluginComponentInfo.hpp:177