libFirm
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

A priority queue. More...

Typedefs

typedef struct pqueue_t pqueue_t
 priority queue More...
 

Functions

pqueue_tnew_pqueue (void)
 Creates a new priority queue. More...
 
void del_pqueue (pqueue_t *q)
 Frees all memory allocated by the priority queue. More...
 
void pqueue_put (pqueue_t *q, void *data, int priority)
 Inserts a new element into a priority queue. More...
 
void * pqueue_pop_front (pqueue_t *q)
 Returns and removes the first element, i.e. More...
 
size_t pqueue_length (pqueue_t const *q)
 Get the length of the priority queue. More...
 
int pqueue_empty (pqueue_t const *q)
 Returns true if queue is empty. More...
 

Detailed Description

A priority queue.

Implementation based on a heap data structure

Typedef Documentation

typedef struct pqueue_t pqueue_t

priority queue

Definition at line 29 of file pqueue.h.

Function Documentation

void del_pqueue ( pqueue_t q)

Frees all memory allocated by the priority queue.

Parameters
qThe priority queue to destroy.
pqueue_t* new_pqueue ( void  )

Creates a new priority queue.

Returns
A priority queue of initial length 0.
int pqueue_empty ( pqueue_t const *  q)

Returns true if queue is empty.

Parameters
qThe priority queue.
Returns
1 if the queue is empty, 0 otherwise.
size_t pqueue_length ( pqueue_t const *  q)

Get the length of the priority queue.

Parameters
qThe priority queue.
Returns
The length of the queue.
void* pqueue_pop_front ( pqueue_t q)

Returns and removes the first element, i.e.

that one with the highest priority, from the queue.

Parameters
qThe priority queue.
Returns
The first element of the queue. Asserts if queue is empty.
void pqueue_put ( pqueue_t q,
void *  data,
int  priority 
)

Inserts a new element into a priority queue.

Parameters
qThe priority queue the element should be inserted to.
dataThe actual data which should be stored in the queue.
priorityThe priority for the data.