Definition in file eg_eheap.h.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <float.h>
#include "eg_macros.h"
#include "eg_lpnum.h"
Include dependency graph for eg_eheap.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | EGeHeap_t |
| Structure to hold a whole heap structure, this structure is designed so that it can grow on the fly with a low cost. More... | |
| struct | EGeHeapCn_t |
| Structure to store the information relevant to an element in the heap. More... | |
Defines | |
| #define | EG_EHEAP_DEBUG 1000 |
| Debug level for the heap. | |
| #define | EG_EHEAP_POISON UINT_MAX |
| Poison position for heap connector not in a heap. | |
| #define | EGeHeapAdd(hp, hcn) |
| Add an element to the heap. | |
| #define | EGeHeapChangeD(hp, width) |
| set the breath of the heap, this function must be called only when the heap is empty. | |
| #define | EGeHeapChangeVal(hp, hcn, new_val) |
| Change the value of an element in the heap. | |
| #define | EGeHeapCheck(hp) 0 |
| Check the integrity of the given heap. | |
| #define | EGeHeapClear(hp) |
| Clear a heap structure, and free any internal memory (not allocated by the user). | |
| #define | EGeHeapCnClear(hcn) EGlpNumClearVar((hcn)->val) |
| Free all internal memory used by this structured not allocated by the user. This function should be called after an init call, and only once. | |
| #define | EGeHeapCnInit(hcn) ({EGlpNumInitVar((hcn)->val);(hcn)->pos = EG_EHEAP_POISON;}) |
| Initialize a heap conector structure. This function will allocate any interal memory not allocated by the user, it should be called only once, or after a clear function call. | |
| #define | EGeHeapCnReset(hcn) ((hcn)->pos = EG_EHEAP_POISON) |
| Reset a heap conector to the same state as after an init call, this function is provided only for completness. | |
| #define | EGeHeapDel(hp, hcn) |
| Eliminate an element from the heap, note that the position stored in the eliminated element is reset to zero. | |
| #define | EGeHeapEmpty(hp) ((hp)->sz = 0) |
| set the number of elements in hte heap to zero. | |
| #define | EGeHeapFatherId(d, id) ((id)?(((id)-1)/(d)):0) |
| return the index of the father of the given index. | |
| #define | EGeHeapFirstChildId(d, id) ((d)*(id)+1) |
| Give the first child for a given position. | |
| #define | EGeHeapGetMin(hp) |
| get the minimum conector in the heap, if the heap is empty, return NULL. | |
| #define | EGeHeapGetMinVal(hp, number) |
| get the minimum value in the heap. | |
| #define | EGeHeapInit(hp) (*(hp) = (EGeHeap_t){0,0,0,0}) |
| Initialize a heap as an empty heap (with no space for conectors). | |
| #define | EGeHeapIsFull(hp) ({EGeHeap_t*const __EGehp = (hp); __EGehp->sz == __EGehp->max_sz;}) |
| Return one if the heap is full, zero otherwise. | |
| #define | EGeHeapResize(hp, new_sz) |
| resize the heap cn array to the given size, if the new size is zero, it is equivalent to free the internal memory, and left the heap as an empty heap with zero space. | |
| #define | EGeHeapSiftDown(hp, hcn) |
| Move an element down in the heap (position 0 is the top), this kind of operation is needed whenever we increase the value in a heap element. | |
| #define | EGeHeapSiftUp(hp, hcn) |
| move an element in the heap up in the heap (position 0 is the top, this kind of move is neded whenever we decrease the value in a heap element). | |
| #define | EGeHepReset(hp) EGeHeapInit(hp) |
| Reset the given heap as an empty heap (just as returned by the init call. | |
Typedefs | |
| typedef EGeHeap_t | EGeHeap_t |
| Structure to hold a whole heap structure, this structure is designed so that it can grow on the fly with a low cost. | |
| typedef EGeHeapCn_t | EGeHeapCn_t |
| Structure to store the information relevant to an element in the heap. | |
1.4.5