libresman

annotate src/resman.h @ 26:6b9974a8bdae

started BSD/mac support for file watching
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 31 Mar 2014 19:51:00 +0300
parents bebc065a941f
children
rev   line source
nuclear@0 1 #ifndef RESOURCE_MANAGER_H_
nuclear@0 2 #define RESOURCE_MANAGER_H_
nuclear@0 3
nuclear@5 4 /* load callback: everything or just file read/parse stage
nuclear@10 5 * done callback: second-stage callback, called in the context of the
nuclear@10 6 * user thread, after the load callback returns
nuclear@5 7 */
nuclear@11 8 typedef int (*resman_load_func)(const char *fname, int id, void *closure);
nuclear@11 9 typedef int (*resman_done_func)(int id, void *closure);
nuclear@11 10 typedef void (*resman_destroy_func)(int id, void *closure);
nuclear@5 11
nuclear@0 12 struct resman;
nuclear@0 13
nuclear@6 14 #ifdef __cplusplus
nuclear@6 15 extern "C" {
nuclear@6 16 #endif
nuclear@6 17
nuclear@5 18 struct resman *resman_create(void);
nuclear@5 19 void resman_free(struct resman *rman);
nuclear@5 20
nuclear@0 21 int resman_init(struct resman *rman);
nuclear@0 22 void resman_destroy(struct resman *rman);
nuclear@0 23
nuclear@5 24 void resman_set_load_func(struct resman *rman, resman_load_func func, void *cls);
nuclear@10 25 void resman_set_done_func(struct resman *rman, resman_done_func func, void *cls);
nuclear@5 26 void resman_set_destroy_func(struct resman *rman, resman_destroy_func func, void *cls);
nuclear@0 27
nuclear@5 28 int resman_lookup(struct resman *rman, const char *fname, void *data);
nuclear@1 29 void resman_wait(struct resman *rman, int id);
nuclear@1 30
nuclear@1 31 int resman_poll(struct resman *rman);
nuclear@1 32
nuclear@11 33 const char *resman_get_res_name(struct resman *rman, int res_id);
nuclear@11 34
nuclear@1 35 void resman_set_res_data(struct resman *rman, int res_id, void *data);
nuclear@1 36 void *resman_get_res_data(struct resman *rman, int res_id);
nuclear@1 37
nuclear@11 38 int resman_get_res_result(struct resman *rman, int res_id);
nuclear@10 39
nuclear@21 40 int resman_get_res_load_count(struct resman *rman, int res_id);
nuclear@21 41
nuclear@6 42 #ifdef __cplusplus
nuclear@6 43 }
nuclear@6 44 #endif
nuclear@6 45
nuclear@0 46
nuclear@0 47 #endif /* RESOURCE_MANAGER_H_ */