OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
PluginDiscovery.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_PLUGIN_DISCOVERY_HPP
38#define OPENSWMM_PLUGIN_DISCOVERY_HPP
39
40#include <string>
41#include <vector>
42
44
45/* =========================================================================
46 * Export macro
47 *
48 * The engine target sets WINDOWS_EXPORT_ALL_SYMBOLS OFF and relies on explicit
49 * export macros (see src/engine/CMakeLists.txt). On ELF/Mach-O the target's
50 * CXX_VISIBILITY_PRESET is `default`, so omitting the macro still exports the
51 * symbol — which is why the unannotated declarations below linked fine on
52 * Linux/macOS while failing on Windows with:
53 * error LNK2001: unresolved external symbol openswmm::discover_all_filters
54 * Block is byte-identical to the one in openswmm_engine.h / openswmm_2d.h;
55 * identical macro redefinition is well-defined, so including those alongside
56 * this header is safe.
57 * ========================================================================= */
58
59#ifdef OPENSWMM_ENGINE_STATIC
60#define SWMM_ENGINE_API
61#else
62#ifdef _WIN32
63#ifdef openswmm_engine_EXPORTS
64#define SWMM_ENGINE_API __declspec(dllexport)
65#else
66#define SWMM_ENGINE_API __declspec(dllimport)
67#endif
68#else
69#define SWMM_ENGINE_API __attribute__((visibility("default")))
70#endif
71#endif
72
73namespace openswmm {
74
85 std::string plugin_id;
86 std::string plugin_version;
87 std::string plugin_caption;
89
95 bool is_builtin = false;
96};
97
105SWMM_ENGINE_API std::vector<DiscoveredFilter> discover_all_filters();
106
125 std::string plugin_id;
126 std::string plugin_version;
127 std::string plugin_caption;
128 std::vector<PluginRole> roles;
129 std::vector<FileFilter> filters;
130
144 bool is_builtin = false;
145};
146
154SWMM_ENGINE_API std::vector<DiscoveredPlugin> discover_plugins_by_id();
155
156} /* namespace openswmm */
157
158#endif /* OPENSWMM_PLUGIN_DISCOVERY_HPP */
Interface that describes a plugin component — metadata and factory methods.
Definition ExchangeLaw.hpp:60
std::vector< DiscoveredPlugin > discover_plugins_by_id()
Group a fresh file-filter discovery snapshot by exact plugin ID.
Definition PluginDiscovery.cpp:56
std::vector< DiscoveredFilter > discover_all_filters()
Copy file-filter metadata from a transient builtin/dynamic plugin discovery.
Definition PluginDiscovery.cpp:35
#define SWMM_ENGINE_API
Definition openswmm_2d.h:62
A FileFilter paired with the plugin id and version that emitted it.
Definition PluginDiscovery.hpp:84
bool is_builtin
Definition PluginDiscovery.hpp:95
std::string plugin_caption
IPluginComponentInfo::caption() — human-readable.
Definition PluginDiscovery.hpp:87
std::string plugin_id
IPluginComponentInfo::id() of the source plugin.
Definition PluginDiscovery.hpp:85
std::string plugin_version
IPluginComponentInfo::version() of the source plugin.
Definition PluginDiscovery.hpp:86
FileFilter filter
The advertised filter.
Definition PluginDiscovery.hpp:88
A plugin grouped by id with all the roles and filters it advertises.
Definition PluginDiscovery.hpp:124
std::string plugin_version
IPluginComponentInfo::version()
Definition PluginDiscovery.hpp:126
std::string plugin_id
IPluginComponentInfo::id()
Definition PluginDiscovery.hpp:125
std::string plugin_caption
IPluginComponentInfo::caption()
Definition PluginDiscovery.hpp:127
std::vector< FileFilter > filters
Every filter the plugin advertises.
Definition PluginDiscovery.hpp:129
std::vector< PluginRole > roles
Distinct roles advertised across all filters.
Definition PluginDiscovery.hpp:128
bool is_builtin
True when the plugin was registered as an engine built-in (via PluginFactory::register_builtin_infos)...
Definition PluginDiscovery.hpp:144
A file-format filter advertised by a plugin.
Definition IPluginComponentInfo.hpp:137