OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_geopackage_impl.cpp File Reference

C API implementation for GeoPackage I/O. More...

#include <openswmm/engine/openswmm_geopackage.h>
#include "GpkgUtils.hpp"
#include "GeoPackageSchema.hpp"
#include "GeoPackagePluginInfo.hpp"
#include <string>
#include <cstring>
Include dependency graph for openswmm_geopackage_impl.cpp:

Classes

struct  GpkgHandle
 

Functions

SWMM_ENGINE_API SWMM_Gpkg swmm_gpkg_open (const char *path)
 Open or create a writable GeoPackage and ensure its OpenSWMM schema exists.
 
SWMM_ENGINE_API void swmm_gpkg_close (SWMM_Gpkg gpkg)
 Roll back an outstanding transaction and delete the database handle.
 
SWMM_ENGINE_API const char * swmm_gpkg_last_error (SWMM_Gpkg gpkg)
 Borrow the last stored handle diagnostic.
 
SWMM_ENGINE_API int swmm_gpkg_begin (SWMM_Gpkg gpkg)
 Begin an immediate SQLite transaction on this handle.
 
SWMM_ENGINE_API int swmm_gpkg_commit (SWMM_Gpkg gpkg)
 Commit this handle active transaction.
 
SWMM_ENGINE_API int swmm_gpkg_rollback (SWMM_Gpkg gpkg)
 Roll back this handle active transaction if one exists.
 
SWMM_ENGINE_API int swmm_gpkg_register (const char *license_key, const char *organization, const char *contact_email, const char *deployment_id)
 Submit process-global GeoPackage plugin registration metadata.
 
SWMM_ENGINE_API int swmm_gpkg_is_registered (void)
 Read process-global GeoPackage plugin registration state.
 
SWMM_ENGINE_API int swmm_gpkg_simulation_count (SWMM_Gpkg gpkg)
 Count stored simulation-run rows.
 
SWMM_ENGINE_API int swmm_gpkg_simulation_id (SWMM_Gpkg gpkg, int index, char *buf, int bufsz)
 Copy one simulation-run ID in creation-time order.
 
SWMM_ENGINE_API int swmm_gpkg_node_count (SWMM_Gpkg gpkg, const char *sim_id)
 Count node rows for one simulation.
 
SWMM_ENGINE_API int swmm_gpkg_link_count (SWMM_Gpkg gpkg, const char *sim_id)
 Count link rows for one simulation.
 
SWMM_ENGINE_API int swmm_gpkg_subcatch_count (SWMM_Gpkg gpkg, const char *sim_id)
 Count subcatchment rows for one simulation.
 
SWMM_ENGINE_API int swmm_gpkg_gage_count (SWMM_Gpkg gpkg, const char *sim_id)
 Count rain-gage rows for one simulation.
 
SWMM_ENGINE_API int swmm_gpkg_topology_edge_count (SWMM_Gpkg gpkg, const char *sim_id)
 Count node-link topology edge rows for one simulation.
 
SWMM_ENGINE_API int swmm_gpkg_variable_count (SWMM_Gpkg gpkg)
 Count catalogue variables, including added observed-data variables.
 
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)
 Count result rows for one simulation/object/variable key.
 
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)
 Copy the first time-ordered result rows for one simulation/object/variable.
 
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 stored summary value for one simulation/object/variable.
 
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 a uniquely named observed series and resolve/create its variable row.
 
SWMM_ENGINE_API int swmm_gpkg_write_observed_value (SWMM_Gpkg gpkg, int series_id, const char *timestamp, double value, const char *quality_flag)
 Insert one observed timestamp/value into a series.
 
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)
 Insert a vector of observed values using one prepared statement.
 
SWMM_ENGINE_API int swmm_gpkg_observed_series_count (SWMM_Gpkg gpkg)
 Count observed-series definitions.
 
SWMM_ENGINE_API int swmm_gpkg_observed_value_count (SWMM_Gpkg gpkg, int series_id)
 Count rows stored for an observed series ID.
 
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)
 Copy a timestamp-ordered prefix of observed values.
 
SWMM_ENGINE_API int swmm_gpkg_query_int (SWMM_Gpkg gpkg, const char *sql)
 Execute supplied SQL and return the first column of its first result row as int.
 
SWMM_ENGINE_API int swmm_gpkg_query_double (SWMM_Gpkg gpkg, const char *sql, double *result)
 Execute supplied SQL and copy the first row/column as double.
 

Detailed Description

C API implementation for GeoPackage I/O.

Model definitions and simulation results are read-only. Only observed/sensor timeseries data is writable through this API.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License
Apache-2.0

Function Documentation

◆ swmm_gpkg_begin()

SWMM_ENGINE_API int swmm_gpkg_begin ( SWMM_Gpkg gpkg)

Begin an immediate SQLite transaction on this handle.

Uses BEGIN IMMEDIATE. Further observed inserts share this transaction until commit/rollback; closing the handle attempts rollback.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
Returns
SWMM_GPKG_OK on success, SWMM_GPKG_ERR for null handle, an already active transaction or a caught database error.
Here is the call graph for this function:

◆ swmm_gpkg_close()

SWMM_ENGINE_API void swmm_gpkg_close ( SWMM_Gpkg gpkg)

Roll back an outstanding transaction and delete the database handle.

Attempts rollback when marked in a transaction, closes the database and frees its wrapper. Does not report rollback failure.

Parameters
[in]gpkgCaller-owned handle, or NULL for a no-op. All borrowed diagnostics become invalid; do not use the handle afterward.

◆ swmm_gpkg_commit()

SWMM_ENGINE_API int swmm_gpkg_commit ( SWMM_Gpkg gpkg)

Commit this handle active transaction.

The active flag clears only after successful commit; after refusal the caller can inspect the diagnostic and roll back.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
Returns
SWMM_GPKG_OK on success, SWMM_GPKG_ERR for null handle, no active transaction or a caught commit error.
Here is the call graph for this function:

◆ swmm_gpkg_create_observed_series()

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 a uniquely named observed series and resolve/create its variable row.

Does not validate that the linked model object exists or convert values to the declared units. Variable creation and series insertion are separate statements; use an explicit transaction when they must roll back together.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]nameNon-null copied series name; uniqueness is enforced by the database.
[in]variable_nameNon-null copied measured variable name.
[in]object_typeOptional copied category. NULL stores an unlinked series but uses NODE when resolving/creating its variable catalogue entry.
[in]object_idOptional copied model-object ID; NULL stores no linked ID.
[in]sourceOptional copied source description; NULL stores SQL NULL.
[in]unitsOptional copied units label; NULL stores SQL NULL for the series and an empty label for a newly created variable.
Returns
New nonnegative series ID, or SWMM_GPKG_ERR for null required arguments, a constraint failure or a caught database error.
Here is the call graph for this function:

◆ swmm_gpkg_gage_count()

SWMM_ENGINE_API int swmm_gpkg_gage_count ( SWMM_Gpkg gpkg,
const char * simulation_id )

Count rain-gage rows for one simulation.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]simulation_idNon-null NUL-terminated simulation ID as stored in the database; borrowed for the call.
Returns
Nonnegative row count (zero for an absent simulation key), or -1 for null arguments/caught query error.

◆ swmm_gpkg_is_registered()

SWMM_ENGINE_API int swmm_gpkg_is_registered ( void )

Read process-global GeoPackage plugin registration state.

Returns
1 when registered, otherwise 0.
Here is the call graph for this function:

◆ swmm_gpkg_last_error()

SWMM_ENGINE_API const char * swmm_gpkg_last_error ( SWMM_Gpkg gpkg)

Borrow the last stored handle diagnostic.

Not every refusal stores a diagnostic and successful operations do not uniformly clear old text. Use the operation return code as the primary result.

Parameters
[in]gpkgLive handle, or NULL to obtain an empty static string.
Returns
Borrowed NUL-terminated string; do not free it and copy before another operation replaces it or the handle is closed.

◆ swmm_gpkg_link_count()

SWMM_ENGINE_API int swmm_gpkg_link_count ( SWMM_Gpkg gpkg,
const char * simulation_id )

Count link rows for one simulation.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]simulation_idNon-null NUL-terminated simulation ID as stored in the database; borrowed for the call.
Returns
Nonnegative row count (zero for an absent simulation key), or -1 for null arguments/caught query error.

◆ swmm_gpkg_node_count()

SWMM_ENGINE_API int swmm_gpkg_node_count ( SWMM_Gpkg gpkg,
const char * simulation_id )

Count node rows for one simulation.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]simulation_idNon-null NUL-terminated simulation ID as stored in the database; borrowed for the call.
Returns
Nonnegative row count (zero for an absent simulation key), or -1 for null arguments/caught query error.

◆ swmm_gpkg_observed_series_count()

SWMM_ENGINE_API int swmm_gpkg_observed_series_count ( SWMM_Gpkg gpkg)

Count observed-series definitions.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
Returns
Nonnegative series count, or SWMM_GPKG_ERR for null handle/caught query error.

◆ swmm_gpkg_observed_value_count()

SWMM_ENGINE_API int swmm_gpkg_observed_value_count ( SWMM_Gpkg gpkg,
int series_id )

Count rows stored for an observed series ID.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]series_idObserved-series key; absent keys produce zero rows.
Returns
Nonnegative count, or SWMM_GPKG_ERR for null handle/caught query error.
Here is the call graph for this function:

◆ swmm_gpkg_open()

SWMM_ENGINE_API SWMM_Gpkg swmm_gpkg_open ( const char * path)

Open or create a writable GeoPackage and ensure its OpenSWMM schema exists.

Uses SQLite READWRITE|CREATE and idempotently creates schema/default variable rows, so this is not a read-only open even when the caller intends only to query. Model/result APIs below read those tables; observed-series APIs perform user writes.

Parameters
[in]pathNon-null NUL-terminated database path, borrowed for the call. An absent file may be created.
Returns
Caller-owned handle, or NULL for a null path or caught database/schema-open failure. Release with swmm_gpkg_close().
Here is the call graph for this function:

◆ swmm_gpkg_query_double()

SWMM_ENGINE_API int swmm_gpkg_query_double ( SWMM_Gpkg gpkg,
const char * sql,
double * result )

Execute supplied SQL and copy the first row/column as double.

Uses SQLite numeric conversion without validating the result schema or converting units; prepares/steps one statement.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]sqlNon-null borrowed SQL text; callers requiring read-only access must supply a read-only query because this wrapper does not enforce it.
[out]resultNon-null double destination, written only when SQLite returns a row.
Returns
SWMM_GPKG_OK for a returned row, SWMM_GPKG_ERR for null required arguments, no row or caught database error.
Here is the call graph for this function:

◆ swmm_gpkg_query_int()

SWMM_ENGINE_API int swmm_gpkg_query_int ( SWMM_Gpkg gpkg,
const char * sql )

Execute supplied SQL and return the first column of its first result row as int.

Executes one prepared statement and steps once. It is a direct database interface rather than a constrained SELECT parser; no automatic protection of model/result tables is applied here.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]sqlNon-null borrowed SQL text. Callers intending a read-only operation must supply a read-only query; this wrapper does not enforce SQL read-only status.
Returns
SQLite integer conversion of first row/column, or SWMM_GPKG_ERR (-1) for null arguments, no row or caught error. A legitimate -1 query result is indistinguishable from failure.
Here is the call graph for this function:

◆ swmm_gpkg_read_observed_values()

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 )

Copy a timestamp-ordered prefix of observed values.

Orders by the stored timestamp TEXT, not a parsed calendar/timezone value. Use a consistently sortable timestamp representation. No quality flags or needed-size output are returned; earlier records may have been copied on failure.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]series_idObserved-series key to query.
[out]timestampsOptional flat caller-owned buffer of max_count*ts_buf_len bytes. Each timestamp uses one fixed-stride slot and is NUL-terminated/truncated when stride>0.
[in]ts_buf_lenPer-timestamp byte stride including NUL. Nonpositive suppresses timestamp copying, even when timestamps is non-null.
[out]valuesNon-null caller-owned max_count-double array; raw stored measurement values without unit conversion.
[in]max_countPositive row limit and value-array capacity.
Returns
Number of rows copied (>=0), or SWMM_GPKG_ERR for null handle/values, nonpositive max_count or caught query error.
Here is the call graph for this function:

◆ swmm_gpkg_read_result_ts()

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 )

Copy the first time-ordered result rows for one simulation/object/variable.

Ordered by elapsed_time; ties follow query order. Does not interpolate, transform units or report an additional required size. On failure earlier rows may already have been copied.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]simulation_idNon-null NUL-terminated simulation ID as stored in the database; borrowed for the call.
[in]object_typeNon-null object category token as stored (for example NODE, LINK, SUBCATCH or SYSTEM); matched by the database query.
[in]object_idNon-null NUL-terminated object ID as stored.
[in]variable_nameNon-null NUL-terminated variable name resolved with object_type in the variable catalogue.
[out]timesNon-null caller-owned max_count-double array for elapsed seconds.
[out]valuesNon-null caller-owned max_count-double array for stored values; units follow the database variable metadata, with no conversion here.
[in]max_countPositive array capacity/SQL row limit.
Returns
Number of rows copied (>=0), or SWMM_GPKG_ERR for null required arguments/nonpositive capacity/caught query error. An unknown variable sets a diagnostic and returns 0.
Here is the call graph for this function:

◆ swmm_gpkg_read_summary()

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 stored summary value for one simulation/object/variable.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]simulation_idNon-null NUL-terminated simulation ID as stored in the database; borrowed for the call.
[in]object_typeNon-null object category token as stored (for example NODE, LINK, SUBCATCH or SYSTEM); matched by the database query.
[in]object_idNon-null NUL-terminated object ID as stored.
[in]variable_nameNon-null NUL-terminated variable name resolved with object_type in the variable catalogue.
[out]valueNon-null stored-value destination; unchanged when no row is found. Units are those recorded by the summary writer; no conversion is applied.
Returns
SWMM_GPKG_OK for a row, SWMM_GPKG_ERR for null required arguments, unknown variable, no summary match or a caught query error.
Here is the call graph for this function:

◆ swmm_gpkg_register()

SWMM_ENGINE_API int swmm_gpkg_register ( const char * license_key,
const char * organization,
const char * contact_email,
const char * deployment_id )

Submit process-global GeoPackage plugin registration metadata.

Does not take or return a database handle; registration does not itself open a file.

Parameters
[in]license_keyOptional borrowed NUL-terminated registration key/token; NULL becomes empty.
[in]organizationOptional borrowed organization name; NULL becomes empty.
[in]contact_emailOptional borrowed contact email; NULL becomes empty.
[in]deployment_idOptional borrowed deployment identifier; NULL becomes empty.
Returns
1 when the plugin registration hook accepts the copied metadata, otherwise 0.
Here is the call graph for this function:

◆ swmm_gpkg_result_ts_count()

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 )

Count result rows for one simulation/object/variable key.

Use to allocate result arrays; count and later read are separate database queries and can observe intervening writes.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]simulation_idNon-null NUL-terminated simulation ID as stored in the database; borrowed for the call.
[in]object_typeNon-null object category token as stored (for example NODE, LINK, SUBCATCH or SYSTEM); matched by the database query.
[in]object_idNon-null NUL-terminated object ID as stored.
[in]variable_nameNon-null NUL-terminated variable name resolved with object_type in the variable catalogue.
Returns
Nonnegative row count, including zero for an unknown variable or no matches; SWMM_GPKG_ERR for null required arguments or a caught query error.
Here is the call graph for this function:

◆ swmm_gpkg_rollback()

SWMM_ENGINE_API int swmm_gpkg_rollback ( SWMM_Gpkg gpkg)

Roll back this handle active transaction if one exists.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
Returns
SWMM_GPKG_OK after rollback or when no transaction is active; SWMM_GPKG_ERR for null handle or a caught database error.
Here is the call graph for this function:

◆ swmm_gpkg_simulation_count()

SWMM_ENGINE_API int swmm_gpkg_simulation_count ( SWMM_Gpkg gpkg)

Count stored simulation-run rows.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
Returns
Nonnegative count, or -1 for null handle/caught query error.

◆ swmm_gpkg_simulation_id()

SWMM_ENGINE_API int swmm_gpkg_simulation_id ( SWMM_Gpkg gpkg,
int index,
char * buf,
int bufsz )

Copy one simulation-run ID in creation-time order.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]indexZero-based query offset. Supply a valid nonnegative index; ordering ties follow the database result order.
[out]bufNon-null caller-owned ID destination, NUL-terminated and silently truncated to bufsz-1 bytes.
[in]bufszPositive byte capacity including NUL.
Returns
SWMM_GPKG_OK after copying a row; SWMM_GPKG_ERR for invalid buffer/handle, no row or caught query error.
Here is the call graph for this function:

◆ swmm_gpkg_subcatch_count()

SWMM_ENGINE_API int swmm_gpkg_subcatch_count ( SWMM_Gpkg gpkg,
const char * simulation_id )

Count subcatchment rows for one simulation.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]simulation_idNon-null NUL-terminated simulation ID as stored in the database; borrowed for the call.
Returns
Nonnegative row count (zero for an absent simulation key), or -1 for null arguments/caught query error.

◆ swmm_gpkg_topology_edge_count()

SWMM_ENGINE_API int swmm_gpkg_topology_edge_count ( SWMM_Gpkg gpkg,
const char * simulation_id )

Count node-link topology edge rows for one simulation.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]simulation_idNon-null NUL-terminated simulation ID as stored in the database; borrowed for the call.
Returns
Nonnegative row count (zero for an absent simulation key), or -1 for null arguments/caught query error.

◆ swmm_gpkg_variable_count()

SWMM_ENGINE_API int swmm_gpkg_variable_count ( SWMM_Gpkg gpkg)

Count catalogue variables, including added observed-data variables.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
Returns
Nonnegative count, or -1 for null handle/caught query error.

◆ swmm_gpkg_write_observed_value()

SWMM_ENGINE_API int swmm_gpkg_write_observed_value ( SWMM_Gpkg gpkg,
int series_id,
const char * timestamp,
double value,
const char * quality_flag )

Insert one observed timestamp/value into a series.

Joins an active transaction when present; otherwise normal SQLite autocommit applies.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]series_idStored observed-series ID; database constraints determine acceptance.
[in]timestampNon-null NUL-terminated timestamp string, conventionally ISO 8601; copied without parsing or timezone conversion.
[in]valueMeasured numeric value in the series declared units; no finite/range/unit validation here.
[in]quality_flagOptional copied quality label such as A/P/E; NULL stores SQL NULL.
Returns
SWMM_GPKG_OK after SQLite accepts the insert, or SWMM_GPKG_ERR for null required arguments, constraint failure or caught database error.
Here is the call graph for this function:

◆ swmm_gpkg_write_observed_values()

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 )

Insert a vector of observed values using one prepared statement.

Does not create an implicit all-or-nothing transaction. Earlier accepted inserts remain committed/pending if a later row fails; wrap begin/commit and roll back on refusal when batch atomicity is required.

Parameters
[in]gpkgNon-null live GeoPackage handle; caller serializes access and retains ownership until swmm_gpkg_close().
[in]series_idStored observed-series ID for all records.
[in]timestampsNon-null count-entry borrowed timestamp-pointer array. Each supplied string is copied by SQLite; provide valid timestamps consistent with the series.
[in]valuesNon-null count-double borrowed measurement array, in series units; no conversion/finite validation.
[in]quality_flagsOptional count-entry borrowed flag-pointer array; NULL array or NULL entries store SQL NULL.
[in]countPositive record count.
Returns
SWMM_GPKG_OK after all inserts, or SWMM_GPKG_ERR for invalid required pointers/count, a failed insert or caught database error.
Here is the call graph for this function: