Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

vheap.h

00001 
00002 #ifndef __VHEAP_INCLUDE__
00003 #define __VHEAP_INCLUDE__
00004 #ifdef __cplusplus
00005 extern "C" {
00006 #endif /* __cplusplus */
00007 
00008 /* 
00009  * HT_VHeap and HT_IHeap
00010  *
00011  * IHeap tracks integers.
00012  * VHeap tracks "void *"'s
00013  *
00014  * NOTES
00015  * a) IHeap uses its integers directly for a reverse lookup table.  Therefore:
00016  *      1) integers must be non-negative
00017  *      2) they must be confined to some reasonable range
00018  * b) IHeap is primarily intended to track array indices, which would satisfy
00019  *      both of the above requirements
00020  */ 
00021 
00022 /* vheap depends on vhash */
00023 #include "vhash.h"
00024 
00025 typedef struct iheap_s {
00026     int used;
00027     int allocated;
00028     long *items;
00029     float *values;
00030     int *lookup;
00031 } iheap_t;
00032 
00033 typedef struct vheap_s {
00034     iheap_t *iheap;
00035     vhash_t *vhash;
00036     vhash_t *reverse_vhash;
00037     int next_index;
00038 } vheap_t;
00039 
00040 iheap_t *new_iheap(void);
00041 void delete_iheap( iheap_t *heap );
00042 void iheap_insert( iheap_t *heap, int item, float value );
00043 void iheap_update( iheap_t *heap, int item, float value );
00044 int iheap_kill( iheap_t *heap, int item );
00045 int iheap_pop( iheap_t *heap, long *item, float *value );
00046 int iheap_peek( iheap_t *heap, long *item, float *value );
00047 
00048 vheap_t *new_vheap(void);
00049 void delete_vheap( vheap_t *heap );
00050 void vheap_insert( vheap_t *heap, void const *item, float value );
00051 void vheap_update( vheap_t *heap, void const *item, float value );
00052 int vheap_kill( vheap_t *heap, void const *item );
00053 int vheap_pop( vheap_t *heap, void **item, float *value );
00054 int vheap_peek( vheap_t *heap, void **item, float *value );
00055 
00056 
00057 #ifdef __cplusplus
00058 } /* extern "C" */
00059 #endif /* __cplusplus */
00060 #endif /* __VHEAP_INCLUDE__ */
00061 
00062 

Generated on Tue May 17 12:06:00 2005 for Autodesk DWF 3D Toolkit by  doxygen 1.4.1