OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
Hdf5InputPlugin.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
41
42#ifndef OPENSWMM_HDF5_INPUT_PLUGIN_HPP
43#define OPENSWMM_HDF5_INPUT_PLUGIN_HPP
44
46
47#include <string>
48#include <vector>
49
50namespace openswmm::h5io {
51
53public:
57 Hdf5InputPlugin() = default;
58
63 PluginState state() const noexcept override { return state_; }
64
72 int initialize(const std::vector<std::string>& init_args,
73 const IPluginComponentInfo* info) override;
74
80 int validate(const SimulationContext& ctx) override;
81
85 int read(const std::string& path, SimulationContext& ctx) override;
86
90 int write(const std::string& path, const SimulationContext& ctx) override;
91
97 std::vector<std::string> skipped_sections() const override { return skipped_; }
98
105 int finalize(const SimulationContext& ctx) override;
106
113 const char* last_error_message() const noexcept override { return error_.c_str(); }
114
115private:
117 std::string error_;
118 std::vector<std::string> skipped_;
119};
120
121} // namespace openswmm::h5io
122
123#endif // OPENSWMM_HDF5_INPUT_PLUGIN_HPP
Interface for input file reader/writer plugins.
Interface for input file reader/writer plugins.
Definition IInputPlugin.hpp:61
Describes a plugin component: metadata, capabilities, and factory methods.
Definition IPluginComponentInfo.hpp:201
std::vector< std::string > skipped_sections() const override
Copy the most recent successful export's omission diagnostics.
Definition Hdf5InputPlugin.hpp:97
int initialize(const std::vector< std::string > &init_args, const IPluginComponentInfo *info) override
Reset diagnostics and mark the plugin initialized.
Definition Hdf5InputPlugin.cpp:37
const char * last_error_message() const noexcept override
Access the plugin's most recent error diagnostic.
Definition Hdf5InputPlugin.hpp:113
int validate(const SimulationContext &ctx) override
Mark the plugin validated without inspecting the model.
Definition Hdf5InputPlugin.cpp:46
PluginState state() const noexcept override
Inspect the last explicitly assigned plugin lifecycle state.
Definition Hdf5InputPlugin.hpp:63
int finalize(const SimulationContext &ctx) override
Mark this export plugin finalized.
Definition Hdf5InputPlugin.cpp:104
int read(const std::string &path, SimulationContext &ctx) override
Read the complete native model dataset and embedded component configurations. Older column-only expor...
Definition Hdf5InputPlugin.cpp:52
Hdf5InputPlugin()=default
Construct an unloaded plugin with empty diagnostics.
int write(const std::string &path, const SimulationContext &ctx) override
Write the complete model to HDF5, replacing the destination. Returns nonzero and records a diagnostic...
Definition Hdf5InputPlugin.cpp:85
PluginState
Plugin lifecycle states.
Definition PluginState.hpp:86
@ UNLOADED
Library not yet loaded (or was closed).
Definition PluginState.hpp:87
Definition Hdf5InputPlugin.cpp:34
Central, reentrant simulation context.
Definition SimulationContext.hpp:390