Pyrogenesis  trunk
Classes | Macros | Typedefs | Enumerations | Functions | Variables
h_mgr.h File Reference
#include <stdarg.h>
#include "handle.h"
#include "lib/file/vfs/vfs.h"
Include dependency graph for h_mgr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  H_VTbl
 

Macros

#define H_TYPE_DEFINE(type)
 
#define H_USER_DATA(h, type)   (type*)h_user_data(h, H_##type)
 
#define H_DEREF(h, type, var)
 

Typedefs

typedef H_VTblH_Type
 

Enumerations

enum  { RES_NO_CACHE = 0x01, RES_UNIQUE = RES_NO_CACHE|0x10, RES_DISALLOW_RELOAD = 0x20 }
 

Functions

void h_mgr_init ()
 
void h_mgr_shutdown ()
 
Handle h_alloc (H_Type type, const PIVFS &vfs, const VfsPath &pathname, size_t flags=0,...)
 
Status h_free (Handle &h, H_Type type)
 
void h_mgr_free_type (const H_Type type)
 
Handle h_find (H_Type type, uintptr_t key)
 
void * h_user_data (Handle h, H_Type type)
 
VfsPath h_filename (Handle h)
 
Status h_reload (const PIVFS &vfs, const VfsPath &pathname)
 
Status h_force_free (Handle h, H_Type type)
 
void h_add_ref (Handle h)
 
intptr_t h_get_refcnt (Handle h)
 

Variables

const size_t H_STRING_LEN = 256
 

Macro Definition Documentation

#define H_DEREF (   h,
  type,
  var 
)
Value:
/* h already indicates an error - return immediately to pass back*/\
/* that specific error, rather than only ERR::INVALID_HANDLE*/\
if(h < 0)\
type* const var = H_USER_DATA(h, type);\
if(!var)\
const Status INVALID_HANDLE
Definition: status.h:419
i64 Status
Error handling system.
Definition: status.h:171
#define WARN_RETURN(status)
Definition: status.h:255
#define H_USER_DATA(h, type)
Definition: h_mgr.h:334
#define H_TYPE_DEFINE (   type)
Value:
/* forward decls */\
static void type##_init(type*, va_list);\
static Status type##_reload(type*, const PIVFS&, const VfsPath&, Handle);\
static void type##_dtor(type*);\
static Status type##_validate(const type*);\
static Status type##_to_string(const type*, wchar_t* buf);\
static H_VTbl V_##type =\
{\
(void (*)(void*, va_list))type##_init,\
(Status (*)(void*, const PIVFS&, const VfsPath&, Handle))type##_reload,\
(void (*)(void*))type##_dtor,\
(Status (*)(const void*))type##_validate,\
(Status (*)(const void*, wchar_t*))type##_to_string,\
sizeof(type), /* control block size */\
WIDEN(#type) /* name */\
};\
static H_Type H_##type = &V_##type
shared_ptr< IVFS > PIVFS
Definition: vfs.h:226
Definition: h_mgr.h:294
#define WIDEN(x)
Definition: code_annotation.h:390
Definition: path.h:77
i64 Status
Error handling system.
Definition: status.h:171
i64 Handle
`handle&#39; representing a reference to a resource (sound, texture, etc.)
Definition: handle.h:41
#define H_USER_DATA (   h,
  type 
)    (type*)h_user_data(h, H_##type)

Typedef Documentation

typedef H_VTbl* H_Type

Enumeration Type Documentation

anonymous enum
Enumerator
RES_NO_CACHE 
RES_UNIQUE 
RES_DISALLOW_RELOAD 

Function Documentation

void h_add_ref ( Handle  h)
Handle h_alloc ( H_Type  type,
const PIVFS vfs,
const VfsPath pathname,
size_t  flags = 0,
  ... 
)
VfsPath h_filename ( Handle  h)
Handle h_find ( H_Type  type,
uintptr_t  key 
)
Status h_force_free ( Handle  h,
H_Type  type 
)
Status h_free ( Handle h,
H_Type  type 
)
intptr_t h_get_refcnt ( Handle  h)
void h_mgr_free_type ( const H_Type  type)
void h_mgr_init ( )
void h_mgr_shutdown ( )
Status h_reload ( const PIVFS vfs,
const VfsPath pathname 
)
void* h_user_data ( Handle  h,
H_Type  type 
)

Variable Documentation

const size_t H_STRING_LEN = 256