libdacav 0.9.0
/home/dacav/Projects/libdacav/libdacav/dacav/dacavheap.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2009 2010 Giovanni Simoni
00003  *
00004  * This file is part of LibDacav.
00005  *
00006  * LibDacav is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, either version 3 of the License, or
00009  * (at your option) any later version.  *
00010  * LibDacav is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with LibDacav.  If not, see <http://www.gnu.org/licenses/>.
00017  *
00018  */
00019 
00025 #ifndef __defined_dacav_dacavheap_h
00026 #define __defined_dacav_dacavheap_h
00027 
00028 #include <dacav/dacav.h>
00029 #include <stdlib.h>
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00037 
00039 typedef struct dheap dheap_t;
00040 
00046 typedef enum {
00047     DHEAP_SUCCESS = 0,      
00048     DHEAP_FULL    = 1,      
00049     DHEAP_EMPTY   = 2       
00050 } dheap_result_t;
00051 
00063 dheap_t *dheap_new (size_t size, dcmp_cb_t cmp);
00064 
00072 void dheap_free (dheap_t *h, dfree_cb_t fc);
00073 
00085 dheap_result_t dheap_insert (dheap_t *h, void *val);
00086 
00096 dheap_result_t dheap_extract (dheap_t *h, void **val);
00097 
00116 void dheap_heapify_up (void *values[], size_t used, dcmp_cb_t cmp);
00117 
00142 void dheap_heapify_down (void *values[], size_t used, dcmp_cb_t cmp);
00143 
00146 #ifdef __cplusplus
00147 }
00148 #endif
00149 
00150 #endif // __defined_dacav_dacavheap_h
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator