OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_callbacks.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
46
47#ifndef OPENSWMM_ENGINE_CALLBACKS_H
48#define OPENSWMM_ENGINE_CALLBACKS_H
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
55typedef void* SWMM_Engine;
56
57/* =========================================================================
58 * Progress callback
59 * ========================================================================= */
60
78typedef void (*SWMM_ProgressCallback)(SWMM_Engine engine, double elapsed_frac, double sim_time,
79 void* user_data);
80
98typedef int (*SWMM_CancelCallback)(SWMM_Engine engine, int stage, int progress, void* user_data);
99
100/* =========================================================================
101 * Warning / error callback
102 * ========================================================================= */
103
120typedef void (*SWMM_WarningCallback)(SWMM_Engine engine, int code, const char* message,
121 void* user_data);
122
123/* =========================================================================
124 * Timestep begin/end callbacks
125 * ========================================================================= */
126
142typedef void (*SWMM_StepBeginCallback)(SWMM_Engine engine, double sim_time, double dt,
143 void* user_data);
144
161typedef void (*SWMM_StepEndCallback)(SWMM_Engine engine, double sim_time, double dt,
162 void* user_data);
163
164/* =========================================================================
165 * Plugin event callbacks (fired by the plugin system)
166 * ========================================================================= */
167
183typedef void (*SWMM_PluginStateCallback)(SWMM_Engine engine, const char* plugin_id, int old_state,
184 int new_state, void* user_data);
185
186/* =========================================================================
187 * Hot start callbacks
188 * ========================================================================= */
189
204typedef void (*SWMM_HotStartMissingCallback)(SWMM_Engine engine, const char* object_type,
205 const char* object_id, void* user_data);
206
207#ifdef __cplusplus
208} /* extern "C" */
209#endif
210
211#endif /* OPENSWMM_ENGINE_CALLBACKS_H */
void * SWMM_Engine
Opaque handle to an OpenSWMM Engine instance.
Definition openswmm_callbacks.h:55
void(* SWMM_PluginStateCallback)(SWMM_Engine engine, const char *plugin_id, int old_state, int new_state, void *user_data)
Describe a plugin-state notification callback signature.
Definition openswmm_callbacks.h:183
void(* SWMM_HotStartMissingCallback)(SWMM_Engine engine, const char *object_type, const char *object_id, void *user_data)
Describe a missing-object hot-start notification callback signature.
Definition openswmm_callbacks.h:204
void(* SWMM_StepBeginCallback)(SWMM_Engine engine, double sim_time, double dt, void *user_data)
Run before physics at the start of a physical simulation step.
Definition openswmm_callbacks.h:142
int(* SWMM_CancelCallback)(SWMM_Engine engine, int stage, int progress, void *user_data)
Report synchronous read-only operation progress and optionally request cancellation.
Definition openswmm_callbacks.h:98
void(* SWMM_WarningCallback)(SWMM_Engine engine, int code, const char *message, void *user_data)
Receive a diagnostic synchronously when the engine emits it.
Definition openswmm_callbacks.h:120
void(* SWMM_StepEndCallback)(SWMM_Engine engine, double sim_time, double dt, void *user_data)
Run after physics and output snapshots for one physical simulation step.
Definition openswmm_callbacks.h:161
void(* SWMM_ProgressCallback)(SWMM_Engine engine, double elapsed_frac, double sim_time, void *user_data)
Report the simulation fraction immediately before a physical step.
Definition openswmm_callbacks.h:78