The callback API provides a way for a
to signal precisely when a particular change (e.g., an edge toggle) is
about to take place. It is intended to simplify and robustify the
u_ functions from the Terms API.
void OnNetworkEdgeChange(Vertex, Vertex, void *, Network *)
void OnWtNetworkEdgeChange(Vertex, Vertex, double, void *, Network *),
a callback function, compatible with
u_ functions and
Mu_ functions both (since a
void* can be any
OnNetworkEdgeChange **on_edge_change and
OnWtNetworkEdgeChange **on_edge_change: an array of
pointers to callback functions.
void **on_edge_change_payload: an array of
void pointers that get passed as the third argument to the
unsigned int n_on_edge_change: number of callbacks in
the above two arrays.
unsigned int max_on_edge_change: the amount of space
allocated for the above two arrays.
void AddOnNetworkEdgeChange(Network *nwp, OnNetworkEdgeChange u_func, void *payload, unsigned int pos)
void AddOnWtNetworkEdgeChange(WtNetwork *nwp, OnWtNetworkEdgeChange u_func, void *payload, unsigned int pos):
Set a callback
u_func to be called with argument
payload whenever an edge in
nwp is changed.
Its position in the list (i.e., the order in which it is called) is set
pos (with large
pos truncated to
indicate the last position).
void DeleteOnNetworkEdgeChange(Network *nwp, OnNetworkEdgeChange u_func, void *payload)
void DeleteOnWtNetworkEdgeChange(WtNetwork *nwp, OnWTNetworkEdgeChange u_func, void *payload):
Search the list of
nwp’s callbacks for
payload and delete the callback when it is found. (If
it is not found, an immediate error is raised.)