navit  0.5.1-trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups
callback.h
Go to the documentation of this file.
1 
20 #ifndef NAVIT_CALLBACK_H
21 #define NAVIT_CALLBACK_H
22 
23 #include "item.h"
24 #include "attr.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 /* prototypes */
30 enum attr_type;
31 struct callback;
32 struct callback_list;
33 struct callback_list *callback_list_new(void);
34 struct callback *callback_new_attr(void (*func)(void), enum attr_type type, int pcount, void **p);
35 struct callback *callback_new_attr_args(void (*func)(void), enum attr_type type, int count, ...);
36 struct callback *callback_new(void (*func)(void), int pcount, void **p);
37 struct callback *callback_new_args(void (*func)(void), int count, ...);
38 void callback_destroy(struct callback *cb);
39 void callback_set_arg(struct callback *cb, int arg, void *p);
40 void callback_list_add(struct callback_list *l, struct callback *cb);
41 struct callback *callback_list_add_new(struct callback_list *l, void (*func)(void), int pcount, void **p);
42 void callback_list_remove(struct callback_list *l, struct callback *cb);
43 void callback_list_remove_destroy(struct callback_list *l, struct callback *cb);
44 void callback_call(struct callback *cb, int pcount, void **p);
45 void callback_call_args(struct callback *cb, int count, ...);
46 void callback_list_call_attr(struct callback_list *l, enum attr_type type, int pcount, void **p);
47 void callback_list_call_attr_args(struct callback_list *cbl, enum attr_type type, int count, ...);
48 void callback_list_call(struct callback_list *l, int pcount, void **p);
49 void callback_list_call_args(struct callback_list *cbl, int count, ...);
50 void callback_list_destroy(struct callback_list *l);
51 /* end of prototypes */
52 
53 #define callback_new_0(func) callback_new_args(func, 0)
54 #define callback_new_1(func,p1) callback_new_args(func, 1, p1)
55 #define callback_new_2(func,p1,p2) callback_new_args(func, 2, p1, p2)
56 #define callback_new_3(func,p1,p2,p3) callback_new_args(func, 3, p1, p2, p3)
57 #define callback_new_4(func,p1,p2,p3,p4) callback_new_args(func, 4, p1, p2, p3, p4)
58 
59 #define callback_new_attr_0(func,type) callback_new_attr_args(func, type, 0)
60 #define callback_new_attr_1(func,type,p1) callback_new_attr_args(func, type, 1, p1)
61 #define callback_new_attr_2(func,type,p1,p2) callback_new_attr_args(func, type, 2, p1, p2)
62 #define callback_new_attr_3(func,type,p1,p2,p3) callback_new_attr_args(func, type, 3, p1, p2, p3)
63 #define callback_new_attr_4(func,type,p1,p2,p3,p4) callback_new_attr_args(func, type, 4, p1, p2, p3, p4)
64 
65 #define callback_call_0(cb) callback_call_args(cb, 0)
66 #define callback_call_1(cb,p1) callback_call_args(cb, 1, p1)
67 #define callback_call_2(cb,p1,p2) callback_call_args(cb, 2, p1, p2)
68 #define callback_call_3(cb,p1,p2,p3) callback_call_args(cb, 3, p1, p2, p3)
69 #define callback_call_4(cb,p1,p2,p3,p4) callback_call_args(cb, 4, p1, p2, p3, p4)
70 
71 #define callback_list_call_0(cbl) callback_list_call_args(cbl, 0)
72 #define callback_list_call_1(cbl,p1) callback_list_call_args(cbl, 1, p1)
73 #define callback_list_call_2(cbl,p1,p2) callback_list_call_args(cbl, 2, p1, p2)
74 #define callback_list_call_3(cbl,p1,p2,p3) callback_list_call_args(cbl, 3, p1, p2, p3)
75 #define callback_list_call_4(cbl,p1,p2,p3,p4) callback_list_call_args(cbl, 4, p1, p2, p3, p4)
76 
77 #define callback_list_call_attr_0(cbl,type) callback_list_call_attr_args(cbl,type, 0)
78 #define callback_list_call_attr_1(cbl,type,p1) callback_list_call_attr_args(cbl, type, 1, p1)
79 #define callback_list_call_attr_2(cbl,type,p1,p2) callback_list_call_attr_args(cbl, type, 2, p1, p2)
80 #define callback_list_call_attr_3(cbl,type,p1,p2,p3) callback_list_call_attr_args(cbl, type, 3, p1, p2, p3)
81 #define callback_list_call_attr_4(cbl,type,p1,p2,p3,p4) callback_list_call_attr_args(cbl, type, 4, p1, p2, p3, p4)
82 
83 #define callback_cast(x) (void (*)(void))(x)
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif
89 
void callback_list_remove(struct callback_list *l, struct callback *cb)
Definition: callback.c:128
attr_type
Definition: attr.h:34
void callback_list_add(struct callback_list *l, struct callback *cb)
Definition: callback.c:111
unsigned char p[5]
Definition: mg.h:48
void callback_list_call_attr(struct callback_list *l, enum attr_type type, int pcount, void **p)
Definition: callback.c:216
void callback_destroy(struct callback *cb)
Definition: callback.c:97
int pcount
Definition: callback.c:30
void callback_call(struct callback *cb, int pcount, void **p)
Definition: callback.c:141
struct callback_list * cbl
Definition: main.c:64
struct callback * callback_new_args(void(*func)(void), int count,...)
Definition: callback.c:84
void callback_list_call(struct callback_list *l, int pcount, void **p)
Definition: callback.c:249
void callback_list_destroy(struct callback_list *l)
Definition: callback.c:268
void callback_list_call_args(struct callback_list *cbl, int count,...)
Definition: callback.c:255
void callback_set_arg(struct callback *cb, int arg, void *p)
Definition: callback.c:103
void callback_list_remove_destroy(struct callback_list *l, struct callback *cb)
Definition: callback.c:134
Definition: callback.c:36
void(* func)(void)
Definition: callback.c:29
Definition: callback.c:26
void callback_list_call_attr_args(struct callback_list *cbl, enum attr_type type, int count,...)
Definition: callback.c:236
void callback_call_args(struct callback *cb, int count,...)
Definition: callback.c:203
struct callback * callback_new(void(*func)(void), int pcount, void **p)
Definition: callback.c:78
struct callback * callback_list_add_new(struct callback_list *l, void(*func)(void), int pcount, void **p)
Definition: callback.c:118
struct callback_list * callback_list_new(void)
Definition: callback.c:41
char type[3]
Definition: garmin_img.c:130
struct callback * callback_new_attr_args(void(*func)(void), enum attr_type type, int count,...)
Definition: callback.c:65
struct callback * callback_new_attr(void(*func)(void), enum attr_type type, int pcount, void **p)
Definition: callback.c:49