libFirm

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

◆ pqueue_t

typedef struct pqueue_t pqueue_t

priority queue

Definition at line 29 of file pqueue.h.

Function Documentation

◆ del_pqueue()

void del_pqueue ( pqueue_t q)

Frees all memory allocated by the priority queue.

Parameters
qThe priority queue to destroy.

◆ new_pqueue()

pqueue_t* new_pqueue ( void  )

Creates a new priority queue.

Returns
A priority queue of initial length 0.

◆ pqueue_empty()

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.

◆ pqueue_length()

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.

◆ pqueue_pop_front()

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.

◆ pqueue_put()

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.