OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_controls.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
31
32#ifndef OPENSWMM_CONTROLS_H
33#define OPENSWMM_CONTROLS_H
34
35#include "openswmm_engine.h"
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/* =========================================================================
42 * Control rules
43 * ========================================================================= */
44
61SWMM_ENGINE_API int swmm_control_add_rule(SWMM_Engine engine, const char* rule_text);
62
73
85SWMM_ENGINE_API int swmm_control_get_rule(SWMM_Engine engine, int idx, char* buf, int buflen);
86
102SWMM_ENGINE_API int swmm_control_get_id(SWMM_Engine engine, int idx, char* buf, int buflen);
103
115
128
144SWMM_ENGINE_API int swmm_control_find_references(SWMM_Engine engine, const char* object_name,
145 int* rule_indices_out, int* n_inout);
146
166SWMM_ENGINE_API int swmm_control_validate_rule(SWMM_Engine engine, const char* rule_text,
167 char* errbuf, int buflen, int* line_out);
168
169/* =========================================================================
170 * Direct control actions (without rules)
171 * ========================================================================= */
172
186SWMM_ENGINE_API int swmm_control_set_link_setting(SWMM_Engine engine, int link_idx, double setting);
187
200SWMM_ENGINE_API int swmm_control_set_link_status(SWMM_Engine engine, int link_idx, int status);
201
202#ifdef __cplusplus
203} /* extern "C" */
204#endif
205
206#endif /* OPENSWMM_CONTROLS_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
SWMM_ENGINE_API int swmm_control_validate_rule(SWMM_Engine engine, const char *rule_text, char *errbuf, int buflen, int *line_out)
Parse a control text block in a disposable engine without storing it.
Definition openswmm_controls_impl.cpp:246
SWMM_ENGINE_API int swmm_control_find_references(SWMM_Engine engine, const char *object_name, int *rule_indices_out, int *n_inout)
Find stored rule blocks that reference an object name.
Definition openswmm_controls_impl.cpp:228
SWMM_ENGINE_API int swmm_control_remove_rule(SWMM_Engine engine, int idx)
Remove one stored control text block while the model is editable.
Definition openswmm_controls_impl.cpp:218
SWMM_ENGINE_API int swmm_control_set_link_setting(SWMM_Engine engine, int link_idx, double setting)
Assign the current setting field for one link directly.
Definition openswmm_controls_impl.cpp:285
SWMM_ENGINE_API int swmm_control_clear_rules(SWMM_Engine engine)
Clear the stored control text blocks.
Definition openswmm_controls_impl.cpp:211
SWMM_ENGINE_API int swmm_control_get_rule(SWMM_Engine engine, int idx, char *buf, int buflen)
Copy a stored control text block by index.
Definition openswmm_controls_impl.cpp:178
SWMM_ENGINE_API int swmm_control_add_rule(SWMM_Engine engine, const char *rule_text)
Store a control-rule text block and compile immediately when the engine is initialized.
Definition openswmm_controls_impl.cpp:120
SWMM_ENGINE_API int swmm_control_set_link_status(SWMM_Engine engine, int link_idx, int status)
Assign the current closed/open flag for one link directly.
Definition openswmm_controls_impl.cpp:294
SWMM_ENGINE_API int swmm_control_count(SWMM_Engine engine)
Count stored control text blocks.
Definition openswmm_controls_impl.cpp:172
SWMM_ENGINE_API int swmm_control_get_id(SWMM_Engine engine, int idx, char *buf, int buflen)
Copy the RULE identifier at the beginning of a stored text block.
Definition openswmm_controls_impl.cpp:193
OpenSWMM Engine — primary transparent C API (master header).