nuclear@0: #ifndef RESOURCE_MANAGER_H_ nuclear@0: #define RESOURCE_MANAGER_H_ nuclear@0: nuclear@5: /* load callback: everything or just file read/parse stage nuclear@10: * done callback: second-stage callback, called in the context of the nuclear@10: * user thread, after the load callback returns nuclear@5: */ nuclear@5: typedef int (*resman_load_func)(const char *fname, void *data, void *closure); nuclear@10: typedef int (*resman_done_func)(int result, void *data, void *closure); nuclear@5: typedef void (*resman_destroy_func)(void *data, void *closure); nuclear@5: nuclear@0: struct resman; nuclear@0: nuclear@6: #ifdef __cplusplus nuclear@6: extern "C" { nuclear@6: #endif nuclear@6: nuclear@5: struct resman *resman_create(void); nuclear@5: void resman_free(struct resman *rman); nuclear@5: nuclear@0: int resman_init(struct resman *rman); nuclear@0: void resman_destroy(struct resman *rman); nuclear@0: nuclear@5: void resman_set_load_func(struct resman *rman, resman_load_func func, void *cls); nuclear@10: void resman_set_done_func(struct resman *rman, resman_done_func func, void *cls); nuclear@5: void resman_set_destroy_func(struct resman *rman, resman_destroy_func func, void *cls); nuclear@0: nuclear@5: int resman_lookup(struct resman *rman, const char *fname, void *data); nuclear@1: void resman_wait(struct resman *rman, int id); nuclear@1: nuclear@1: int resman_poll(struct resman *rman); nuclear@1: nuclear@1: void resman_set_res_data(struct resman *rman, int res_id, void *data); nuclear@1: void *resman_get_res_data(struct resman *rman, int res_id); nuclear@1: nuclear@10: int resman_get_res_error(struct resman *rman, int res_id); nuclear@10: nuclear@6: #ifdef __cplusplus nuclear@6: } nuclear@6: #endif nuclear@6: nuclear@0: nuclear@0: #endif /* RESOURCE_MANAGER_H_ */