OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
openswmm_api_common.hpp File Reference

Internal shared helpers for C API impl files. More...

#include "SWMMEngine.hpp"
#include "../../../include/openswmm/engine/openswmm_engine.h"
#include <cstring>
#include <algorithm>
Include dependency graph for openswmm_api_common.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CHECK_HANDLE(e)   do { if (!(e)) return SWMM_ERR_BADHANDLE; } while(0)
 
#define CHECK_INDEX(cond)   do { if (!(cond)) return SWMM_ERR_BADINDEX; } while(0)
 
#define CHECK_GEOMETRY(ctx)
 Geometry/topology setters: only BUILDING or OPENED.
 
#define CHECK_INITIAL_COND(ctx)
 Initial-condition setters: BUILDING, OPENED, or INITIALIZED.
 
#define CHECK_RUNNING(ctx)
 Runtime forcing / state override: only RUNNING.
 
#define CHECK_READABLE(ctx)
 Read-only access: any state where data exists (not CREATED, CLOSED, or ERROR)
 

Detailed Description

Internal shared helpers for C API impl files.

NOT installed — used only by openswmm_*_impl.cpp files. Provides the opaque-handle cast and common guard macros.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n MIT License

Macro Definition Documentation

◆ CHECK_GEOMETRY

#define CHECK_GEOMETRY (   ctx)
Value:
do { \
if ((ctx).state != openswmm::EngineState::BUILDING && \
} while(0)
@ BUILDING
Programmatic model construction in progress (no .inp)
@ OPENED
Input file parsed, objects allocated.
@ SWMM_ERR_LIFECYCLE
Definition openswmm_engine.h:106

Geometry/topology setters: only BUILDING or OPENED.

◆ CHECK_HANDLE

#define CHECK_HANDLE (   e)    do { if (!(e)) return SWMM_ERR_BADHANDLE; } while(0)

◆ CHECK_INDEX

#define CHECK_INDEX (   cond)    do { if (!(cond)) return SWMM_ERR_BADINDEX; } while(0)

◆ CHECK_INITIAL_COND

#define CHECK_INITIAL_COND (   ctx)
Value:
do { \
if ((ctx).state != openswmm::EngineState::BUILDING && \
(ctx).state != openswmm::EngineState::OPENED && \
} while(0)
@ INITIALIZED
Initial conditions applied.

Initial-condition setters: BUILDING, OPENED, or INITIALIZED.

◆ CHECK_READABLE

#define CHECK_READABLE (   ctx)
Value:
do { \
if ((ctx).state == openswmm::EngineState::CREATED || \
(ctx).state == openswmm::EngineState::CLOSED || \
} while(0)
@ CLOSED
Resources released.
@ ERROR_STATE
Fatal error; call swmm_engine_last_error()
@ CREATED
Context allocated, no input loaded.

Read-only access: any state where data exists (not CREATED, CLOSED, or ERROR)

◆ CHECK_RUNNING

#define CHECK_RUNNING (   ctx)
Value:
do { \
if ((ctx).state != openswmm::EngineState::RUNNING) \
} while(0)
@ RUNNING
Simulation loop in progress.

Runtime forcing / state override: only RUNNING.