Allow API to get/set type of status report

The existing EN_setstatusreport function only allows one to set the level of status reporting and not retrieve this value. A new EN_STATUS_REPORT constant was added, to be used with EN_setoption and EN_getoption, to provide read/write access to the level of status reporting.
This commit is contained in:
Lew Rossman
2023-07-19 09:15:25 -04:00
parent 2825f96120
commit 353ba4eb34
8 changed files with 30 additions and 13 deletions

View File

@@ -1,13 +1,13 @@
/*
******************************************************************************
Project: OWA EPANET
Version: 2.2
Version: 2.3
Module: epanet.c
Description: implementation of EPANET's API functions
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 04/29/2023
Last Updated: 07/17/2023
******************************************************************************
*/
@@ -1211,6 +1211,9 @@ int DLLEXPORT EN_getoption(EN_Project p, int option, double *value)
case EN_PRESS_UNITS:
v = (double)p->parser.Pressflag;
break;
case EN_STATUS_REPORT:
v = (double)( p->report.Statflag);
break;
default:
return 251;
}
@@ -1401,6 +1404,12 @@ int DLLEXPORT EN_setoption(EN_Project p, int option, double value)
qcf = Ucf[FLOW] / qfactor;
updateruleunits(p, dcf, pcf, hcf, qcf);
break;
case EN_STATUS_REPORT:
i = ROUND(value);
if (i < EN_NO_REPORT || i > EN_FULL_REPORT) return 213;
p->report.Statflag = i;
break;
default:
return 251;