OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
Hdf5PluginInfo.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_HDF5_PLUGIN_INFO_HPP
33#define OPENSWMM_HDF5_PLUGIN_INFO_HPP
34
36
37#include <string>
38#include <vector>
39
40namespace openswmm::h5io {
41
46class Hdf5PluginInfo : public IPluginComponentInfo {
47public:
52 static Hdf5PluginInfo& instance() {
53 static Hdf5PluginInfo inst;
54 return inst;
55 }
56
57 // --- identity -----------------------------------------------------------
58
63 std::string id() const override { return "org.hydrocouple.openswmm.plugins.hdf5"; }
64
69 std::string caption() const override { return "HDF5 Model I/O Plugin"; }
70
75 std::string description() const override {
76 return "Writes SWMM model definitions to a columnar HDF5 container: one "
77 "group per object class, one array per attribute, in AUTHORED "
78 "units. Intended for array-shaped consumers — h5py, xarray, "
79 "MATLAB, notebooks — that want the model without parsing text or "
80 "issuing SQL. See src/engine/io/hdf5/STRATEGY.md.";
81 }
82
87 std::string version() const override { return "1.0.0"; }
92 std::string vendor() const override { return "HydroCouple"; }
93
98 std::string url() const override {
99 return "https://hydrocouple.org/projects/openswmm/plugins/hdf5";
100 }
101
106 std::vector<std::string> tags() const override {
107 return {"hdf5", "h5", "columnar", "input", "output", "export", "analysis", "python"};
108 }
109
110 // --- licensing ----------------------------------------------------------
111
116 std::string license_type() const override { return "Apache-2.0"; }
117
122 std::string license_text() const override {
123 return "Copyright (c) 2026 Caleb Buahin. All rights reserved.\n"
124 "Licensed under the Apache License, Version 2.0 — see the\n"
125 "LICENSE and NOTICE files for full text.";
126 }
127
128 // --- capabilities -------------------------------------------------------
129 //
130 // Only the model role is claimed today. Results and report plugins are
131 // designed in STRATEGY.md §7 but not built, and advertising a capability
132 // this plugin cannot honour would make swmm_model_write_with_plugin
133 // resolve and then fail at the call rather than at the lookup.
134
139 bool has_input() const noexcept override { return true; }
144 bool has_output() const noexcept override { return false; }
149 bool has_report() const noexcept override { return false; }
150
156 std::vector<FileFilter> file_filters() const override {
157 const std::string desc = "OpenSWMM HDF5 model";
158 const std::vector<std::string> patterns = {"*.h5", "*.hdf5"};
159 const std::vector<std::string> mimes = {"application/x-hdf5"};
160 return {FileFilter{desc, patterns, PluginRole::INPUT_READ, mimes}};
161 }
162
163 // --- factories ----------------------------------------------------------
164
171 IInputPlugin* create_input_plugin() const override;
172
173private:
177 Hdf5PluginInfo() = default;
178};
179
180} // namespace openswmm::h5io
181
182#endif // OPENSWMM_HDF5_PLUGIN_INFO_HPP
Interface that describes a plugin component — metadata and factory methods.
Interface for input file reader/writer plugins.
Definition IInputPlugin.hpp:61
Describes a plugin component: metadata, capabilities, and factory methods.
Definition IPluginComponentInfo.hpp:201
Singleton describing the HDF5 I/O plugin.
Definition Hdf5PluginInfo.hpp:46
bool has_output() const noexcept override
Report the plugin's has output metadata.
Definition Hdf5PluginInfo.hpp:144
static Hdf5PluginInfo & instance()
Access the built-in HDF5 plugin metadata singleton.
Definition Hdf5PluginInfo.hpp:52
std::string description() const override
Report the plugin's description metadata.
Definition Hdf5PluginInfo.hpp:75
std::string license_text() const override
Report the plugin's license text metadata.
Definition Hdf5PluginInfo.hpp:122
bool has_input() const noexcept override
Report the plugin's has input metadata.
Definition Hdf5PluginInfo.hpp:139
bool has_report() const noexcept override
Report the plugin's has report metadata.
Definition Hdf5PluginInfo.hpp:149
std::string url() const override
Report the plugin's url metadata.
Definition Hdf5PluginInfo.hpp:98
IInputPlugin * create_input_plugin() const override
Allocate an independent HDF5 model I/O plugin instance.
Definition Hdf5PluginInfo.cpp:33
std::vector< std::string > tags() const override
Report the plugin's tags metadata.
Definition Hdf5PluginInfo.hpp:106
std::string version() const override
Report the plugin's version metadata.
Definition Hdf5PluginInfo.hpp:87
std::string caption() const override
Report the plugin's caption metadata.
Definition Hdf5PluginInfo.hpp:69
std::string id() const override
Report the plugin's id metadata.
Definition Hdf5PluginInfo.hpp:63
std::string vendor() const override
Report the plugin's vendor metadata.
Definition Hdf5PluginInfo.hpp:92
std::vector< FileFilter > file_filters() const override
Report the plugin's file filters metadata.
Definition Hdf5PluginInfo.hpp:156
std::string license_type() const override
Report the plugin's license type metadata.
Definition Hdf5PluginInfo.hpp:116
@ INPUT_READ
Plugin reads a model input file (e.g. *.inp).
Definition IPluginComponentInfo.hpp:96
Definition Hdf5InputPlugin.cpp:34
A file-format filter advertised by a plugin.
Definition IPluginComponentInfo.hpp:137