|  |  |  | telepathy-glib API Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | ||||
#include <telepathy-glib/telepathy-glib.h>
                    TpHeap;
TpHeap *            tp_heap_new                         (GCompareFunc comparator,
                                                         GDestroyNotify destructor);
void                tp_heap_destroy                     (TpHeap *heap);
void                tp_heap_clear                       (TpHeap *heap);
void                tp_heap_add                         (TpHeap *heap,
                                                         gpointer element);
void                tp_heap_remove                      (TpHeap *heap,
                                                         gpointer element);
gpointer            tp_heap_peek_first                  (TpHeap *heap);
gpointer            tp_heap_extract_first               (TpHeap *heap);
guint               tp_heap_size                        (TpHeap *heap);
typedef struct _TpHeap TpHeap;
Structure representing the heap queue. All fields are private.
TpHeap * tp_heap_new (GCompareFunc comparator,GDestroyNotify destructor);
| 
 | Comparator by which to order the pointers in the heap | 
| 
 | Function to call on the pointers when the heap is destroyed
or cleared, or NULLif this is not needed | 
| Returns : | A new, empty heap queue. | 
void                tp_heap_destroy                     (TpHeap *heap);
Destroy a TpHeap. The destructor, if any, is called on all items.
| 
 | The heap queue | 
void                tp_heap_clear                       (TpHeap *heap);
Remove all items from a TpHeap. The destructor, if any, is called on all items.
| 
 | The heap queue | 
void tp_heap_add (TpHeap *heap,gpointer element);
Add element to the heap queue, maintaining correct order.
| 
 | The heap queue | 
| 
 | An element | 
void tp_heap_remove (TpHeap *heap,gpointer element);
Remove element from heap, if it's present. The destructor, if any,
is not called.
| 
 | The heap queue | 
| 
 | An element in the heap | 
gpointer            tp_heap_peek_first                  (TpHeap *heap);
| 
 | The heap queue | 
| Returns : | The first item in the queue, or NULLif the queue is empty | 
gpointer            tp_heap_extract_first               (TpHeap *heap);
Remove and return the first element in the queue. The destructor, if any, is not called.
| 
 | The heap queue | 
| Returns : | the removed element |