cucon/priq.h: Array-Based Priority Queue

Data Structures

struct  cucon_priq


#define cucon_priq_prior(q)   (CU_MARG(cucon_priq_t, q)->prior)


void cucon_priq_init (cucon_priq_t q, cu_clop(prior, cu_bool_t, void *, void *))
cucon_priq_t cucon_priq_new (cu_clop(prior, cu_bool_t, void *, void *))
void cucon_priq_init_copy (cucon_priq_t q, cucon_priq_t src)
void cucon_priq_insert (cucon_priq_t q, void *key)
void * cucon_priq_pop_front (cucon_priq_t q)
void * cucon_priq_front (cucon_priq_t q)
cu_bool_t cucon_priq_is_empty (cucon_priq_t q)
size_t cucon_priq_count (cucon_priq_t q)
void cucon_priq_dump (cucon_priq_t q, cu_clop(print_key_fn, void, void *key, FILE *out), FILE *out)

Detailed Description

This is an implementation of priority queues based on a pyramid-like array. It guarantees that the front element x fulfils prior(x, y) for all other y in the queue.

Define Documentation

#define cucon_priq_prior (  )     (CU_MARG(cucon_priq_t, q)->prior)

Return the prior-relation, as passed to cucon_priq_init.

Function Documentation

size_t cucon_priq_count ( cucon_priq_t  q  ) 

Return the number of elements in the queue.

void cucon_priq_dump ( cucon_priq_t  q,
cu_clop(print_key_fn, void, void *key, FILE *out)  ,
FILE *  out 

Debug dump.

void* cucon_priq_front ( cucon_priq_t  q  ) 

The front element of the queue.

void cucon_priq_init ( cucon_priq_t  q,
cu_clop(prior, cu_bool_t, void *, void *)   

Construct q as a priority queue of elements with priority relation prior.

void cucon_priq_init_copy ( cucon_priq_t  q,
cucon_priq_t  src 

Construct q as a copy of src.

void cucon_priq_insert ( cucon_priq_t  q,
void *  key 

Enqueue key.

cu_bool_t cucon_priq_is_empty ( cucon_priq_t  q  ) 

True iff the queue is empty.

cucon_priq_t cucon_priq_new ( cu_clop(prior, cu_bool_t, void *, void *)   ) 

Return a priority queue with the priority relation prior.

void* cucon_priq_pop_front ( cucon_priq_t  q  ) 

Pop off and return the front element of the queue.

Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.