OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_process_components.h
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 */
17
35
36#ifndef OPENSWMM_PROCESS_COMPONENTS_H
37#define OPENSWMM_PROCESS_COMPONENTS_H
38
39#include "openswmm_engine.h"
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
54
74SWMM_ENGINE_API int swmm_process_component_get(SWMM_Engine engine, int idx, char* id_buf,
75 int id_len, char* config_buf, int config_len,
76 char* resolved_buf, int resolved_len);
77
86
103 const char* config_path);
104
116
117/* ---- Built-in component catalogue (U1, 2026-09-07) -----------------------
118 * The ids the engine knows how to bind, independent of any model: the six
119 * planned/implemented built-ins of the process-global registry. This is the
120 * catalogue the GUI's Process Components table offers in its Id combo. The
121 * external component-library discovery (`swmm_component_library_*`,
122 * PROG stream D) is a separate, later seam; this one never scans disk.
123 */
124
132
151SWMM_ENGINE_API int swmm_process_component_known_get(int idx, char* id_buf, int id_len,
152 char* desc_buf, int desc_len,
153 int* implemented);
154
155/* ------------------------------------------------------------------------
156 * D2 (program plan §B.2.5) — discovered HydroCouple component libraries.
157 *
158 * Process-global, like the built-in catalogue above: no engine handle. A
159 * component library is a shared library exporting HydroCouple's loader
160 * contract (`hydrocouple_component_abi_v1` + `hydrocouple_component_info_v1`,
161 * from HydroCouple's hydrocouplecomponentabi.h), or the legacy
162 * `CreateComponentInfo`.
163 *
164 * Discovery (§B.2.3) runs once, on the first call to either query below:
165 * the engine library's directory and its plugins/ and components/
166 * subdirectories, then each directory in the path-list environment
167 * variable HYDROCOUPLE_COMPONENT_PATH (':'-separated; ';' on Windows).
168 * swmm_component_search_path_add() scans a further directory immediately.
169 *
170 * Every library the engine RECOGNISED as a component is listed — including
171 * ones it refused. A stamped library whose ABI stamp differs from the
172 * engine's is never called beyond its stamp, and is listed with both stamps
173 * in `load_error`. A legacy library is loaded best-effort and listed with
174 * stamp "unstamped(legacy CreateComponentInfo)", so it is never mistaken
175 * for a verified one. Libraries that are not components are not listed.
176 *
177 * Built without OPENSWMM_WITH_HYDROCOUPLE, discovery finds nothing: the
178 * count is 0 and swmm_component_search_path_add returns SWMM_ERR_PLUGIN.
179 *
180 * Argument / exchange-item / capability enumeration
181 * (swmm_component_info_*) is a later part of D2 and not yet available.
182 * ------------------------------------------------------------------------ */
183
187 char id[256];
188 char caption[256];
189 char version[64];
190 char path[1024];
191 char kind[16];
192 char stamp[256];
193 char load_error[1024];
195
209
219
232
233#ifdef __cplusplus
234}
235#endif
236
237#endif /* OPENSWMM_PROCESS_COMPONENTS_H */
#define SWMM_ENGINE_API
Definition openswmm_2d.h:62
void * SWMM_Engine
Opaque handle to an OpenSWMM Engine instance.
Definition openswmm_callbacks.h:55
OpenSWMM Engine — primary transparent C API (master header).
SWMM_ENGINE_API int swmm_process_component_get(SWMM_Engine engine, int idx, char *id_buf, int id_len, char *config_buf, int config_len, char *resolved_buf, int resolved_len)
Copy one process-component registration and its last resolved config path.
Definition openswmm_process_components_impl.cpp:80
SWMM_ENGINE_API int swmm_process_component_known_count(void)
Count process-global built-in catalogue entries.
Definition openswmm_process_components_impl.cpp:96
SWMM_ENGINE_API int swmm_process_component_register(SWMM_Engine engine, const char *id, const char *config_path)
Append an editable process-component registration.
Definition openswmm_process_components_impl.cpp:161
SWMM_ENGINE_API int swmm_process_component_remove(SWMM_Engine engine, int idx)
Remove a model registration and shift later indices down.
Definition openswmm_process_components_impl.cpp:181
SWMM_ENGINE_API int swmm_component_library_get(int idx, SWMM_ComponentLibraryInfo *info)
Copy metadata for one recognized component-library candidate.
Definition openswmm_process_components_impl.cpp:134
SWMM_ENGINE_API int swmm_process_component_known_get(int idx, char *id_buf, int id_len, char *desc_buf, int desc_len, int *implemented)
Read one process-global built-in catalogue entry.
Definition openswmm_process_components_impl.cpp:101
SWMM_ENGINE_API int swmm_component_search_path_add(const char *dir)
Scan an additional directory for HydroCouple component libraries.
Definition openswmm_process_components_impl.cpp:121
SWMM_ENGINE_API int swmm_process_component_count(SWMM_Engine engine)
Count stored model process-component registrations.
Definition openswmm_process_components_impl.cpp:74
SWMM_ENGINE_API int swmm_process_component_find(SWMM_Engine engine, const char *id)
Find a model registration by exact component ID.
Definition openswmm_process_components_impl.cpp:151
SWMM_ENGINE_API int swmm_component_library_count(void)
Count recognized discovered component libraries, including refused candidates.
Definition openswmm_process_components_impl.cpp:130
One discovered (or refused) component library. Strings are NUL-terminated and truncated to their fiel...
Definition openswmm_process_components.h:186
char stamp[256]
Definition openswmm_process_components.h:192
char load_error[1024]
Definition openswmm_process_components.h:193
char caption[256]
Definition openswmm_process_components.h:188
char version[64]
Definition openswmm_process_components.h:189
char path[1024]
Definition openswmm_process_components.h:190
char kind[16]
Definition openswmm_process_components.h:191