80 columns formatting
[lttv.git] / ltt / branches / poly / include / lttv / hook.h
1 #ifndef HOOK_H
2 #define HOOK_H
3
4 #include <glib.h>
5
6 /* A hook is a function to call with the supplied hook data, and with
7 call site specific data (e.g., hooks for events are called with a
8 pointer to the current event). */
9
10 typedef void (*lttv_hook)(void *hook_data, void *call_data);
11
12
13 /* A list of hooks allows registering hooks to be called later. */
14
15 typedef GArray _lttv_hooks;
16 typedef _lttv_hooks lttv_hooks;
17
18 lttv_hooks *lttv_hooks_new();
19
20 void lttv_hooks_destroy(lttv_hooks *h);
21
22 void lttv_hooks_add(lttv_hooks *h, lttv_hook f, void *hook_data);
23
24 void lttv_hooks_call(lttv_hooks *h, void *call_data);
25
26
27 /* Sometimes different hooks need to be called based on the case. The
28 case is represented by an unsigned integer id and may represent different
29 event types, for instance. */
30
31 typedef GPtrArray _lttv_hooks_by_id;
32 typedef _lttv_hooks_by_id lttv_hooks_by_id;
33
34 lttv_hooks_by_id *lttv_hooks_by_id_new();
35
36 void lttv_hooks_by_id_destroy(lttv_hooks_by_id *h);
37
38 void lttv_hooks_by_id_add(lttv_hooks_by_id *h, lttv_hook f, void *hook_data,
39 unsigned int id);
40
41 void lttv_hooks_by_id_call(lttv_hooks_by_id *h, void *call_data, unsigned int id);
42
43 #endif // HOOK_H
This page took 0.034469 seconds and 4 git commands to generate.