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