fix include path of glib for redhat
[lttv.git] / ltt / branches / poly / include / lttv / hook.h
CommitLineData
c5d77517 1#ifndef HOOK_H
2#define HOOK_H
3
83e90c10 4#include <glib-2.0/glib.h>
c5d77517 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
10typedef void (*lttv_hook)(void *hook_data, void *call_data);
11
12
13/* A list of hooks allows registering hooks to be called later. */
14
15typedef GArray _lttv_hooks;
16typedef _lttv_hooks lttv_hooks;
17
18lttv_hooks *lttv_hooks_new();
19
20void lttv_hooks_destroy(lttv_hooks *h);
21
22void lttv_hooks_add(lttv_hooks *h, lttv_hook f, void *hook_data);
23
24void 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
31typedef GPtrArray _lttv_hooks_by_id;
32typedef _lttv_hooks_by_id lttv_hooks_by_id;
33
34lttv_hooks_by_id *lttv_hooks_by_id_new();
35
36void lttv_hooks_by_id_destroy(lttv_hooks_by_id *h);
37
38void lttv_hooks_by_id_add(lttv_hooks_by_id *h, lttv_hook f, void *hook_data,
39 unsigned int id);
40
41void 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.023525 seconds and 4 git commands to generate.