libFirm
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
pqueue.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5 
13 #ifndef FIRM_ADT_PQUEUE_H
14 #define FIRM_ADT_PQUEUE_H
15 
16 #include <stddef.h>
17 
18 #include "../begin.h"
19 
29 typedef struct pqueue_t pqueue_t;
30 
35 FIRM_API pqueue_t *new_pqueue(void);
36 
41 FIRM_API void del_pqueue(pqueue_t *q);
42 
49 FIRM_API void pqueue_put(pqueue_t *q, void *data, int priority);
50 
56 FIRM_API void *pqueue_pop_front(pqueue_t *q);
57 
63 FIRM_API size_t pqueue_length(pqueue_t const *q);
64 
70 FIRM_API int pqueue_empty(pqueue_t const *q);
71 
74 #include "../end.h"
75 
76 #endif
void pqueue_put(pqueue_t *q, void *data, int priority)
Inserts a new element into a priority queue.
size_t pqueue_length(pqueue_t const *q)
Get the length of the priority queue.
void * pqueue_pop_front(pqueue_t *q)
Returns and removes the first element, i.e.
struct pqueue_t pqueue_t
priority queue
Definition: pqueue.h:29
int pqueue_empty(pqueue_t const *q)
Returns true if queue is empty.
pqueue_t * new_pqueue(void)
Creates a new priority queue.
void del_pqueue(pqueue_t *q)
Frees all memory allocated by the priority queue.