vheap.h

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

Generated on Tue Jan 6 22:41:37 2009 for Autodesk DWF 3D Toolkit by  doxygen 1.4.5