Overview   Project   Class   Tree   Deprecated   Index 
0 A.D.
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

lib.res
(lib.res globals)

   in h_mgr.h
   in handle.h
   in mem.h
   in res.h
   in h_mgr.h
   in h_mgr.cpp
   in mem.cpp
   in h_mgr.cpp
   in mem.cpp
   in res.cpp

(lib.res globals)


Field Summary
 cassert( 16+ 32 <
          See h_mgr.cpp
 static i32 first_free
          See h_mgr.cpp
 static Pool fn_pool
          See h_mgr.cpp
 static const size_t FN_POOL_EL_SIZE
          See h_mgr.cpp
 const size_t H_STRING_LEN
          user_size is checked to make sure the user data fits in the handle data space.
 static const i32 hdata_cap
          See h_mgr.cpp
 static const uint hdata_per_page
          See h_mgr.cpp
 static const size_t HDATA_USER_SIZE
          See h_mgr.cpp
 const u32 IDX_MASK
          See h_mgr.cpp
 const uint IDX_SHIFT
          See h_mgr.cpp
 static ModuleInitState initState
          See h_mgr.cpp
 static OverrunProtector< Key2Idx > key2idx_wrapper
          See h_mgr.cpp
 static i32 last_in_use
          See h_mgr.cpp
 static const uint MAX_EXTANT_HANDLES
          ========================================================================= File : h_mgr.
 static pthread_mutex_t mutex
          ========================================================================= File : mem.
 static const uint num_pages
          See h_mgr.cpp
 static const size_t PAGE_SIZE
          See h_mgr.cpp
 static HDATA*[ num_pages ] pages
          See h_mgr.cpp
 static OverrunProtector< Ptr2H > ptr2h_wrapper
          See mem.cpp
 static const uint REF_BITS
          See h_mgr.cpp
 static const u32 REF_MAX
          See h_mgr.cpp
 const u32 TAG_MASK
          See h_mgr.cpp
 const uint TAG_SHIFT
          See h_mgr.cpp
 static const uint TYPE_BITS
          See h_mgr.cpp
 
Method Summary
 static LibError alloc_idx( i32& idx, HDATA*& hd )
          See h_mgr.cpp
 static Handle alloc_new_handle( H_Type type, const char* fn, uintptr_t key, uint flags, va_list* init_args )
          See h_mgr.cpp
 static LibError call_init_and_reload( Handle h, H_Type type, HDATA* hd, const char* fn, va_list* init_args )
          See h_mgr.cpp
  ERROR_ASSOCIATE( ERR::RES_UNKNOWN_FORMAT,"Unknown file format",-1 )
          ========================================================================= File : res.
  ERROR_ASSOCIATE( ERR::RES_INCOMPLETE_HEADER,"File header not completely read",-1 )
          See res.cpp
 static Handle find_alloc( void* target_raw_p, It* out_it = 0 )
          See mem.cpp
 static void fn_free( HDATA* hd )
          See h_mgr.cpp
 static void fn_init()
          See h_mgr.cpp
 static bool fn_is_in_HDATA( HDATA* hd )
          See h_mgr.cpp
 static void fn_shutdown()
          See h_mgr.cpp
 static void fn_store( HDATA* hd, const char* fn )
          See h_mgr.cpp
 static LibError free_idx( i32 idx )
          See h_mgr.cpp
 static u32 gen_tag()
          See h_mgr.cpp
 void h_add_ref( Handle h )
          See h_mgr.cpp
 Handle h_alloc( H_Type type, const char* fn, uint flags,... )
          See h_mgr.cpp
 static HDATA* h_data_from_idx( const i32 idx )
          See h_mgr.cpp
 static inline HDATA* h_data_no_tag( const Handle h )
          See h_mgr.cpp
 static inline HDATA* h_data_tag( const Handle h )
          See h_mgr.cpp
 static HDATA* h_data_tag_type( const Handle h, const H_Type type )
          See h_mgr.cpp
 const char* h_filename( const Handle h )
          See h_mgr.cpp
 Handle h_find( H_Type type, uintptr_t key )
          See h_mgr.cpp
 LibError h_force_free( Handle h, H_Type type )
          See h_mgr.cpp
 LibError h_free( Handle& h, H_Type type )
          See h_mgr.cpp
 static LibError h_free_idx( i32 idx, HDATA* hd )
          See h_mgr.cpp
 int h_get_refcnt( Handle h )
          See h_mgr.cpp
 static inline u32 h_idx( const Handle h )
          See h_mgr.cpp
 void h_mgr_init()
          See h_mgr.cpp
 void h_mgr_shutdown()
          See h_mgr.cpp
 LibError h_reload( const char* fn )
          See h_mgr.cpp
 static inline u32 h_tag( const Handle h )
          See h_mgr.cpp
  H_TYPE_DEFINE( Mem )
          See mem.cpp
 void* h_user_data( const Handle h, const H_Type type )
          See h_mgr.cpp
 static inline Handle handle( const u32 _idx, const u32 tag )
          See h_mgr.cpp
 static void* heap_alloc( size_t raw_size, uintptr_t& ctx )
          See mem.cpp
 static void heap_free( void* raw_p, size_t UNUSED( raw_size ), uintptr_t UNUSED( ctx ) )
          See mem.cpp
 static void key_add( uintptr_t key, Handle h )
          See h_mgr.cpp
 static Handle key_find( uintptr_t key, H_Type type, KeyRemoveFlag remove_option = KEY_NOREMOVE )
          See h_mgr.cpp
 static void key_remove( uintptr_t key, H_Type type )
          See h_mgr.cpp
 void* mem_alloc( size_t size, const size_t align, uint flags, Handle* phm )
          See mem.cpp
 static void Mem_dtor( Mem* m )
          See mem.cpp
 LibError mem_free_h( Handle& hm )
          See mem.cpp
 LibError mem_free_p( void*& p )
          See mem.cpp
 LibError mem_get( Handle hm, u8** pp, size_t* psize )
          See mem.cpp
 void* mem_get_ptr( Handle hm, size_t* user_size )
          See mem.cpp
 static void Mem_init( Mem* m, va_list args )
          See mem.cpp
 static LibError Mem_reload( Mem* m, const char* UNUSED( fn ), Handle hm )
          See mem.cpp
 void mem_shutdown()
          See mem.cpp
 static LibError Mem_to_string( const Mem* m, char* buf )
          See mem.cpp
 static LibError Mem_validate( const Mem* m )
          See mem.cpp
 Handle mem_wrap( void* p, size_t size, uint flags, void* raw_p, size_t raw_size, MEM_DTOR dtor, uintptr_t ctx, void* owner )
          See mem.cpp
 static void remove_alloc( void* raw_p )
          See mem.cpp
 static Handle reuse_existing_handle( uintptr_t key, H_Type type, uint flags )
          See h_mgr.cpp
 static void set_alloc( void* raw_p, Handle hm )
          See mem.cpp
 static LibError type_validate( H_Type type )
          See h_mgr.cpp
 static void warn_if_invalid( HDATA* hd )
          See h_mgr.cpp
 
Symbol Summary
 #define IDX_BITS 16
          See h_mgr.cpp
 #define INCLUDED_H_MGR
          See h_mgr.h
 #define INCLUDED_HANDLE
          See handle.h
 #define INCLUDED_MEM
          See mem.h
 #define INCLUDED_RES
          See res.h
 #define SCOPED_LOCK ScopedLock UID__
          See mem.cpp
 #define TAG_BITS 32
          See h_mgr.cpp
 
Macro Summary
 #define H_DEREF(h, type, varif(h < 0WARN_RETURN((LibErrorhtype*) const var = H_USER_DATA(h, type)if(!var)WARN_RETURN(ERR::INVALID_HANDLE)
          See h_mgr.h
 #define H_TYPE_DEFINE(typestatic) void type##_init(type*, va_list)static LibError type##_reload(type*, const char*, Handle)static void type##_dtor(type*)static LibError type##_validate(const type*)static LibError type##_to_string(const type*, char* buf)static H_VTbl V_##type ={(void (*)(void*, va_list))type##_init,(LibError (*)(void*, const char*, Handle))type##_reload,(void (*)(void*))type##_dtor,(LibError (*)(const void*))type##_validate,(LibError (*)(const void*, char*))type##_to_string,sizeof(type), #type }static H_Type H_##type = &V_##type
          See h_mgr.h
 #define H_USER_DATA(h, type) (type*)h_user_data(h, H_##type)
          See h_mgr.h
 #define mem_free(p) mem_free_p((void*&)p)
          See mem.h
 

Field Detail

<

 cassert( 16+ 32 <;
See h_mgr.cpp.

first_free

 static i32 first_free;
See h_mgr.cpp.

fn_pool

 static Pool fn_pool;
See h_mgr.cpp.

FN_POOL_EL_SIZE

 static const size_t FN_POOL_EL_SIZE;
See h_mgr.cpp.

H_STRING_LEN

 const size_t H_STRING_LEN;
user_size is checked to make sure the user data fits in the handle data space. dtor is associated with type and called when the object is freed. handle data is initialized to 0; optionally, a pointer to it is returned.
See h_mgr.h.

hdata_cap

 static const i32 hdata_cap;
See h_mgr.cpp.

hdata_per_page

 static const uint hdata_per_page;
See h_mgr.cpp.

HDATA_USER_SIZE

 static const size_t HDATA_USER_SIZE;
See h_mgr.cpp.

IDX_MASK

 const u32 IDX_MASK;
See h_mgr.cpp.

IDX_SHIFT

 const uint IDX_SHIFT;
See h_mgr.cpp.

initState

 static ModuleInitState initState;
See h_mgr.cpp.

key2idx_wrapper

 static OverrunProtector< Key2Idx > key2idx_wrapper;
See h_mgr.cpp.

last_in_use

 static i32 last_in_use;
See h_mgr.cpp.

MAX_EXTANT_HANDLES

 static const uint MAX_EXTANT_HANDLES;
========================================================================= File : h_mgr.cpp Project : 0 A.D. Description : handle manager for resources. =========================================================================
See h_mgr.cpp.

mutex

 static pthread_mutex_t mutex;
========================================================================= File : mem.cpp Project : 0 A.D. Description : wrapper that treats memory as a "resource", i.e. : guarantees its lifetime and automatic release. =========================================================================
See mem.cpp.

num_pages

 static const uint num_pages;
See h_mgr.cpp.

PAGE_SIZE

 static const size_t PAGE_SIZE;
See h_mgr.cpp.

pages

 static HDATA* pages[ num_pages ];
See h_mgr.cpp.

ptr2h_wrapper

 static OverrunProtector< Ptr2H > ptr2h_wrapper;
See mem.cpp.

REF_BITS

 static const uint REF_BITS;
See h_mgr.cpp.

REF_MAX

 static const u32 REF_MAX;
See h_mgr.cpp.

TAG_MASK

 const u32 TAG_MASK;
See h_mgr.cpp.

TAG_SHIFT

 const uint TAG_SHIFT;
See h_mgr.cpp.

TYPE_BITS

 static const uint TYPE_BITS;
See h_mgr.cpp.


Method Detail

alloc_idx

 static LibError alloc_idx( i32& idx, HDATA*& hd );
See h_mgr.cpp.

alloc_new_handle

 static Handle alloc_new_handle( H_Type type, const char* fn, uintptr_t key, uint flags, va_list* init_args );
See h_mgr.cpp.

call_init_and_reload

 static LibError call_init_and_reload( Handle h, H_Type type, HDATA* hd, const char* fn, va_list* init_args );
See h_mgr.cpp.

ERROR_ASSOCIATE

 ERROR_ASSOCIATE( ERR::RES_UNKNOWN_FORMAT,"Unknown file format",-1 );
========================================================================= File : res.cpp Project : 0 A.D. Description : =========================================================================
See res.cpp.

ERROR_ASSOCIATE

 ERROR_ASSOCIATE( ERR::RES_INCOMPLETE_HEADER,"File header not completely read",-1 );
See res.cpp.

find_alloc

 static Handle find_alloc( void* target_raw_p, It* out_it = 0 );
See mem.cpp.

fn_free

 static void fn_free( HDATA* hd );
See h_mgr.cpp.

fn_init

 static void fn_init();
See h_mgr.cpp.

fn_is_in_HDATA

 static bool fn_is_in_HDATA( HDATA* hd );
See h_mgr.cpp.

fn_shutdown

 static void fn_shutdown();
See h_mgr.cpp.

fn_store

 static void fn_store( HDATA* hd, const char* fn );
See h_mgr.cpp.

free_idx

 static LibError free_idx( i32 idx );
See h_mgr.cpp.

gen_tag

 static u32 gen_tag();
See h_mgr.cpp.

h_add_ref

 void h_add_ref( Handle h );
See h_mgr.cpp.

h_alloc

 Handle h_alloc( H_Type type, const char* fn, uint flags,... );
See h_mgr.cpp.

h_data_from_idx

 static HDATA* h_data_from_idx( const i32 idx );
See h_mgr.cpp.

h_data_no_tag

 static inline HDATA* h_data_no_tag( const Handle h );
See h_mgr.cpp.

h_data_tag

 static inline HDATA* h_data_tag( const Handle h );
See h_mgr.cpp.

h_data_tag_type

 static HDATA* h_data_tag_type( const Handle h, const H_Type type );
See h_mgr.cpp.

h_filename

 const char* h_filename( const Handle h );
See h_mgr.cpp.

h_find

 Handle h_find( H_Type type, uintptr_t key );
See h_mgr.cpp.

h_force_free

 LibError h_force_free( Handle h, H_Type type );
See h_mgr.cpp.

h_free

 LibError h_free( Handle& h, H_Type type );
See h_mgr.cpp.

h_free_idx

 static LibError h_free_idx( i32 idx, HDATA* hd );
See h_mgr.cpp.

h_get_refcnt

 int h_get_refcnt( Handle h );
See h_mgr.cpp.

h_idx

 static inline u32 h_idx( const Handle h );
See h_mgr.cpp.

h_mgr_init

 void h_mgr_init();
See h_mgr.cpp.

h_mgr_shutdown

 void h_mgr_shutdown();
See h_mgr.cpp.

h_reload

 LibError h_reload( const char* fn );
See h_mgr.cpp.

h_tag

 static inline u32 h_tag( const Handle h );
See h_mgr.cpp.

H_TYPE_DEFINE

 H_TYPE_DEFINE( Mem );
See mem.cpp.

h_user_data

 void* h_user_data( const Handle h, const H_Type type );
See h_mgr.cpp.

handle

 static inline Handle handle( const u32 _idx, const u32 tag );
See h_mgr.cpp.

heap_alloc

 static void* heap_alloc( size_t raw_size, uintptr_t& ctx );
See mem.cpp.

heap_free

 static void heap_free( void* raw_p, size_t UNUSED( raw_size ), uintptr_t UNUSED( ctx ) );
See mem.cpp.

key_add

 static void key_add( uintptr_t key, Handle h );
See h_mgr.cpp.

key_find

 static Handle key_find( uintptr_t key, H_Type type, KeyRemoveFlag remove_option = KEY_NOREMOVE );
See h_mgr.cpp.

key_remove

 static void key_remove( uintptr_t key, H_Type type );
See h_mgr.cpp.

mem_alloc

 void* mem_alloc( size_t size, const size_t align, uint flags, Handle* phm );
See mem.cpp.

Mem_dtor

 static void Mem_dtor( Mem* m );
See mem.cpp.

mem_free_h

 LibError mem_free_h( Handle& hm );
See mem.cpp.

mem_free_p

 LibError mem_free_p( void*& p );
See mem.cpp.

mem_get

 LibError mem_get( Handle hm, u8** pp, size_t* psize );
See mem.cpp.

mem_get_ptr

 void* mem_get_ptr( Handle hm, size_t* user_size );
See mem.cpp.

Mem_init

 static void Mem_init( Mem* m, va_list args );
See mem.cpp.

Mem_reload

 static LibError Mem_reload( Mem* m, const char* UNUSED( fn ), Handle hm );
See mem.cpp.

mem_shutdown

 void mem_shutdown();
See mem.cpp.

Mem_to_string

 static LibError Mem_to_string( const Mem* m, char* buf );
See mem.cpp.

Mem_validate

 static LibError Mem_validate( const Mem* m );
See mem.cpp.

mem_wrap

 Handle mem_wrap( void* p, size_t size, uint flags, void* raw_p, size_t raw_size, MEM_DTOR dtor, uintptr_t ctx, void* owner );
See mem.cpp.

remove_alloc

 static void remove_alloc( void* raw_p );
See mem.cpp.

reuse_existing_handle

 static Handle reuse_existing_handle( uintptr_t key, H_Type type, uint flags );
See h_mgr.cpp.

set_alloc

 static void set_alloc( void* raw_p, Handle hm );
See mem.cpp.

type_validate

 static LibError type_validate( H_Type type );
See h_mgr.cpp.

warn_if_invalid

 static void warn_if_invalid( HDATA* hd );
See h_mgr.cpp.


Symbol Detail

IDX_BITS

 #define IDX_BITS 16
See h_mgr.cpp.

INCLUDED_H_MGR

 #define INCLUDED_H_MGR 
See h_mgr.h.

INCLUDED_HANDLE

 #define INCLUDED_HANDLE 
See handle.h.

INCLUDED_MEM

 #define INCLUDED_MEM 
See mem.h.

INCLUDED_RES

 #define INCLUDED_RES 
See res.h.

SCOPED_LOCK

 #define SCOPED_LOCK ScopedLock UID__;
See mem.cpp.

TAG_BITS

 #define TAG_BITS 32
See h_mgr.cpp.


Macro Detail

H_DEREF

 #define H_DEREF(h, type, varif(h < 0WARN_RETURN((LibErrorh;type*) const var = H_USER_DATA(h, type);if(!var)WARN_RETURN(ERR::INVALID_HANDLE);
See h_mgr.h.

H_TYPE_DEFINE

 #define H_TYPE_DEFINE(typestatic) void type##_init(type*, va_list);static LibError type##_reload(type*, const char*, Handle);static void type##_dtor(type*);static LibError type##_validate(const type*);static LibError type##_to_string(const type*, char* buf);static H_VTbl V_##type ={(void (*)(void*, va_list))type##_init,(LibError (*)(void*, const char*, Handle))type##_reload,(void (*)(void*))type##_dtor,(LibError (*)(const void*))type##_validate,(LibError (*)(const void*, char*))type##_to_string,sizeof(type),	#type			};static H_Type H_##type = &V_##type
See h_mgr.h.

H_USER_DATA

 #define H_USER_DATA(h, type) (type*)h_user_data(h, H_##type)
See h_mgr.h.

mem_free

 #define mem_free(p) mem_free_p((void*&)p)
See mem.h.

 Overview   Project   Class   Tree   Deprecated   Index 
0 A.D.
Generated on September 04, 2007 at 18:13
CppDoc v2.4.0
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD