OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
openswmm_geopackage.h
Go to the documentation of this file.
1
61#ifndef OPENSWMM_GEOPACKAGE_H
62#define OPENSWMM_GEOPACKAGE_H
63
64#include "openswmm_engine_export.h"
65
66#ifdef __cplusplus
67extern "C" {
68#endif
69
70/* =========================================================================
71 * Opaque handle
72 * ========================================================================= */
73
75typedef void* SWMM_Gpkg;
76
77/* =========================================================================
78 * Return codes
79 * ========================================================================= */
80
81#define SWMM_GPKG_OK 0
82#define SWMM_GPKG_ERR -1
84/* =========================================================================
85 * Lifecycle
86 * ========================================================================= */
87
99
108
115
116/* =========================================================================
117 * Transactions
118 * ========================================================================= */
119
131
138
145
146/* =========================================================================
147 * Registration
148 * ========================================================================= */
149
159SWMM_ENGINE_API int swmm_gpkg_register(const char* license_key,
160 const char* organization,
161 const char* contact_email,
162 const char* deployment_id);
163
169
170/* =========================================================================
171 * Read: Simulation metadata
172 * ========================================================================= */
173
180
191 char* buf, int bufsz);
192
193/* =========================================================================
194 * Read: Model object counts
195 * ========================================================================= */
196
197SWMM_ENGINE_API int swmm_gpkg_node_count(SWMM_Gpkg gpkg, const char* simulation_id);
198SWMM_ENGINE_API int swmm_gpkg_link_count(SWMM_Gpkg gpkg, const char* simulation_id);
199SWMM_ENGINE_API int swmm_gpkg_subcatch_count(SWMM_Gpkg gpkg, const char* simulation_id);
200SWMM_ENGINE_API int swmm_gpkg_gage_count(SWMM_Gpkg gpkg, const char* simulation_id);
201SWMM_ENGINE_API int swmm_gpkg_topology_edge_count(SWMM_Gpkg gpkg, const char* simulation_id);
203
204/* =========================================================================
205 * Read: Simulation result timeseries
206 * ========================================================================= */
207
226 const char* simulation_id,
227 const char* object_type,
228 const char* object_id,
229 const char* variable_name,
230 double* times,
231 double* values,
232 int max_count);
233
247 const char* simulation_id,
248 const char* object_type,
249 const char* object_id,
250 const char* variable_name);
251
252/* =========================================================================
253 * Read: Summary statistics
254 * ========================================================================= */
255
268 const char* simulation_id,
269 const char* object_type,
270 const char* object_id,
271 const char* variable_name,
272 double* value);
273
274/* =========================================================================
275 * Write: Observed / sensor timeseries
276 * ========================================================================= */
277
295 const char* name,
296 const char* variable_name,
297 const char* object_type,
298 const char* object_id,
299 const char* source,
300 const char* units);
301
313 int series_id,
314 const char* timestamp,
315 double value,
316 const char* quality_flag);
317
339 int series_id,
340 const char** timestamps,
341 const double* values,
342 const char** quality_flags,
343 int count);
344
345/* =========================================================================
346 * Read: Observed / sensor timeseries
347 * ========================================================================= */
348
355
363
377 int series_id,
378 char* timestamps,
379 int ts_buf_len,
380 double* values,
381 int max_count);
382
383/* =========================================================================
384 * Read: Ad-hoc queries
385 * ========================================================================= */
386
393SWMM_ENGINE_API int swmm_gpkg_query_int(SWMM_Gpkg gpkg, const char* sql);
394
402SWMM_ENGINE_API int swmm_gpkg_query_double(SWMM_Gpkg gpkg, const char* sql,
403 double* result);
404
405#ifdef __cplusplus
406}
407#endif
408
409#endif /* OPENSWMM_GEOPACKAGE_H */
#define SWMM_ENGINE_API
Definition openswmm_2d.h:37
SWMM_ENGINE_API const char * swmm_gpkg_last_error(SWMM_Gpkg gpkg)
Get the last error message.
Definition openswmm_geopackage_impl.cpp:96
SWMM_ENGINE_API void swmm_gpkg_close(SWMM_Gpkg gpkg)
Close the GeoPackage and free all resources.
Definition openswmm_geopackage_impl.cpp:86
SWMM_ENGINE_API int swmm_gpkg_register(const char *license_key, const char *organization, const char *contact_email, const char *deployment_id)
Register the GeoPackage plugin.
Definition openswmm_geopackage_impl.cpp:138
SWMM_ENGINE_API int swmm_gpkg_link_count(SWMM_Gpkg gpkg, const char *simulation_id)
Definition openswmm_geopackage_impl.cpp:189
SWMM_ENGINE_API SWMM_Gpkg swmm_gpkg_open(const char *path)
Open an existing GeoPackage file.
Definition openswmm_geopackage_impl.cpp:66
SWMM_ENGINE_API int swmm_gpkg_gage_count(SWMM_Gpkg gpkg, const char *simulation_id)
Definition openswmm_geopackage_impl.cpp:203
SWMM_ENGINE_API int swmm_gpkg_read_summary(SWMM_Gpkg gpkg, const char *simulation_id, const char *object_type, const char *object_id, const char *variable_name, double *value)
Read a single summary statistic value.
Definition openswmm_geopackage_impl.cpp:287
SWMM_ENGINE_API int swmm_gpkg_simulation_id(SWMM_Gpkg gpkg, int index, char *buf, int bufsz)
Get the simulation_id at the given index.
Definition openswmm_geopackage_impl.cpp:162
SWMM_ENGINE_API int swmm_gpkg_observed_series_count(SWMM_Gpkg gpkg)
Get the number of observed series in the GeoPackage.
Definition openswmm_geopackage_impl.cpp:417
SWMM_ENGINE_API int swmm_gpkg_observed_value_count(SWMM_Gpkg gpkg, int series_id)
Get the number of values in an observed series.
Definition openswmm_geopackage_impl.cpp:423
SWMM_ENGINE_API int swmm_gpkg_create_observed_series(SWMM_Gpkg gpkg, const char *name, const char *variable_name, const char *object_type, const char *object_id, const char *source, const char *units)
Create an observed data series.
Definition openswmm_geopackage_impl.cpp:318
SWMM_ENGINE_API int swmm_gpkg_query_double(SWMM_Gpkg gpkg, const char *sql, double *result)
Execute a read-only SQL query and get the first double result.
Definition openswmm_geopackage_impl.cpp:479
void * SWMM_Gpkg
Opaque handle to an open GeoPackage database.
Definition openswmm_geopackage.h:75
SWMM_ENGINE_API int swmm_gpkg_result_ts_count(SWMM_Gpkg gpkg, const char *simulation_id, const char *object_type, const char *object_id, const char *variable_name)
Get the number of result timeseries records for a query.
Definition openswmm_geopackage_impl.cpp:225
SWMM_ENGINE_API int swmm_gpkg_write_observed_values(SWMM_Gpkg gpkg, int series_id, const char **timestamps, const double *values, const char **quality_flags, int count)
Bulk-write a vector of observed data points to a series.
Definition openswmm_geopackage_impl.cpp:382
SWMM_ENGINE_API int swmm_gpkg_node_count(SWMM_Gpkg gpkg, const char *simulation_id)
Definition openswmm_geopackage_impl.cpp:182
SWMM_ENGINE_API int swmm_gpkg_simulation_count(SWMM_Gpkg gpkg)
Get the number of simulation runs in the GeoPackage.
Definition openswmm_geopackage_impl.cpp:156
SWMM_ENGINE_API int swmm_gpkg_variable_count(SWMM_Gpkg gpkg)
Definition openswmm_geopackage_impl.cpp:217
SWMM_ENGINE_API int swmm_gpkg_read_observed_values(SWMM_Gpkg gpkg, int series_id, char *timestamps, int ts_buf_len, double *values, int max_count)
Read observed timeseries values into caller-supplied arrays.
Definition openswmm_geopackage_impl.cpp:436
SWMM_ENGINE_API int swmm_gpkg_write_observed_value(SWMM_Gpkg gpkg, int series_id, const char *timestamp, double value, const char *quality_flag)
Write a single observed data point.
Definition openswmm_geopackage_impl.cpp:361
SWMM_ENGINE_API int swmm_gpkg_begin(SWMM_Gpkg gpkg)
Begin a transaction for bulk operations.
Definition openswmm_geopackage_impl.cpp:103
SWMM_ENGINE_API int swmm_gpkg_query_int(SWMM_Gpkg gpkg, const char *sql)
Execute a read-only SQL query and get the first integer result.
Definition openswmm_geopackage_impl.cpp:468
SWMM_ENGINE_API int swmm_gpkg_topology_edge_count(SWMM_Gpkg gpkg, const char *simulation_id)
Definition openswmm_geopackage_impl.cpp:210
SWMM_ENGINE_API int swmm_gpkg_rollback(SWMM_Gpkg gpkg)
Roll back the current transaction.
Definition openswmm_geopackage_impl.cpp:125
SWMM_ENGINE_API int swmm_gpkg_commit(SWMM_Gpkg gpkg)
Commit the current transaction.
Definition openswmm_geopackage_impl.cpp:114
SWMM_ENGINE_API int swmm_gpkg_read_result_ts(SWMM_Gpkg gpkg, const char *simulation_id, const char *object_type, const char *object_id, const char *variable_name, double *times, double *values, int max_count)
Read a result timeseries for one object and variable.
Definition openswmm_geopackage_impl.cpp:249
SWMM_ENGINE_API int swmm_gpkg_is_registered(void)
Check whether the GeoPackage plugin is registered.
Definition openswmm_geopackage_impl.cpp:150
SWMM_ENGINE_API int swmm_gpkg_subcatch_count(SWMM_Gpkg gpkg, const char *simulation_id)
Definition openswmm_geopackage_impl.cpp:196