239 #ifndef INCLUDED_H_MGR 240 #define INCLUDED_H_MGR 249 #ifndef INCLUDED_HANDLE 268 no boilerplate init, h_alloc calls ctor directly, make sure it fits in the memory slot
269 vtbl contains sizeof resource data, and name!
270 but- has to handle variable params, a bit ugly
296 void (*
init)(
void* user, va_list);
307 #define H_TYPE_DEFINE(type)\ 309 static void type##_init(type*, va_list);\ 310 static Status type##_reload(type*, const PIVFS&, const VfsPath&, Handle);\ 311 static void type##_dtor(type*);\ 312 static Status type##_validate(const type*);\ 313 static Status type##_to_string(const type*, wchar_t* buf);\ 314 static H_VTbl V_##type =\ 316 (void (*)(void*, va_list))type##_init,\ 317 (Status (*)(void*, const PIVFS&, const VfsPath&, Handle))type##_reload,\ 318 (void (*)(void*))type##_dtor,\ 319 (Status (*)(const void*))type##_validate,\ 320 (Status (*)(const void*, wchar_t*))type##_to_string,\ 324 static H_Type H_##type = &V_##type 334 #define H_USER_DATA(h, type) (type*)h_user_data(h, H_##type) 341 #define H_DEREF(h, type, var)\ 345 WARN_RETURN((Status)h);\ 346 type* const var = H_USER_DATA(h, type);\ 348 WARN_RETURN(ERR::INVALID_HANDLE); 432 #endif // #ifndef INCLUDED_H_MGR Status(* validate)(const void *user)
Definition: h_mgr.h:299
Handle h_alloc(H_Type type, const PIVFS &vfs, const VfsPath &pathname, size_t flags=0,...)
Definition: h_mgr.cpp:519
void h_mgr_shutdown()
Definition: h_mgr.cpp:816
Handle h_find(H_Type type, uintptr_t key)
Definition: h_mgr.cpp:679
Status h_force_free(Handle h, H_Type type)
Definition: h_mgr.cpp:693
shared_ptr< IVFS > PIVFS
Definition: vfs.h:226
void(* dtor)(void *user)
Definition: h_mgr.h:298
void * h_user_data(Handle h, H_Type type)
Definition: h_mgr.cpp:607
Status(* to_string)(const void *user, wchar_t *buf)
Definition: h_mgr.h:300
Status(* reload)(void *user, const PIVFS &vfs, const VfsPath &pathname, Handle)
Definition: h_mgr.h:297
size_t user_size
Definition: h_mgr.h:301
H_VTbl * H_Type
Definition: h_mgr.h:305
pthread_key_t key
Definition: wpthread.cpp:140
Status h_reload(const PIVFS &vfs, const VfsPath &pathname)
Definition: h_mgr.cpp:637
void h_mgr_init()
Definition: h_mgr.cpp:811
i64 Status
Error handling system.
Definition: status.h:171
i64 Handle
`handle' representing a reference to a resource (sound, texture, etc.)
Definition: handle.h:41
const wchar_t * name
Definition: h_mgr.h:302
intptr_t h_get_refcnt(Handle h)
Definition: h_mgr.cpp:732
void h_mgr_free_type(const H_Type type)
Definition: h_mgr.cpp:790
const size_t H_STRING_LEN
Definition: h_mgr.h:371
Definition: vfs_util.cpp:39
VfsPath h_filename(Handle h)
Definition: h_mgr.cpp:625
void(* init)(void *user, va_list)
Definition: h_mgr.h:296
void h_add_ref(Handle h)
Definition: h_mgr.cpp:715
Status h_free(Handle &h, H_Type type)
Definition: h_mgr.cpp:583