adds client callback API function

This commit is contained in:
Sam Hatchett
2022-07-27 16:37:49 -04:00
parent 44ad2488e4
commit 41887e9016
5 changed files with 37 additions and 1 deletions

View File

@@ -517,6 +517,18 @@ typedef struct Project *EN_Project;
********************************************************************/
/**
@brief Set a user-supplied callback function for reporting
@param ph an EPANET project handle.
@param callback a function pointer with declared signature, which gets called by EPANET for reporting.
@return an error code.
@details The report callback function must have the signature specified - void(void* userData, EN_Project, char*) -
use the userData parameter to pass any client context necessary (a context pointer or wrapper object perhaps).
Leave un-set or set the report callback to NULL to revert to EPANET's default behavior.
**/
int DLLEXPORT EN_setReportCallback(EN_Project ph, void (*callback)(void *userData, void *EN_projectHandle, char*));
int DLLEXPORT EN_setReportCallbackUserData(EN_Project ph, void *userData);
/**
@brief Writes a line of text to a project's report file.
@param ph an EPANET project handle.