OpenWaterAnalytics / EPANET

The Water Distribution System Hydraulic and Water Quality Analysis Toolkit
MIT License
279 stars 204 forks source link

adds client callback API function #689

Closed samhatchett closed 1 year ago

samhatchett commented 2 years ago

This addition should be viewed as a helpful counterpart to the pviewprog callback that can be passed into the ENepanet function, but with the inclusion of the project handle and a user-supplied context pointer. If the user supplies a reporting callback, their function will be called each time EPANET wants to log anything that used to go into the report file.

LRossman commented 2 years ago

Picky comment: the new functions don't follow the practice of using all lower case for API function names.

Also, can ENsetreportcallback(void (callback)(void userData, void EN_projectHandle, char) and ENsetreportcallbackuserdata(void *userData) functions be added to epanet2.h and epanet2.c to have both single- and multi-threaded versions like we do for all of the other API functions?

samhatchett commented 2 years ago

@LRossman good catch. I get so used to camel case... and I can totally add mirror functions to the legacy API.

samhatchett commented 2 years ago

ok, i think this one is good to review and merge based on above feedback.