pq.h24 lines · 457 B · raw
1#ifndef __PQ_H__
2#define __PQ_H__
3
4#include <stddef.h>
5#include <stdint.h>
6
7// Priority Queue (min-heap)
8
9struct pq;
10
11struct pq * pq_create(size_t data_size);
12void pq_destroy(struct pq * pq);
13
14void pq_clear(struct pq * pq);
15int pq_push(struct pq * pq, uint64_t priority, const void * data);
16int pq_pop(struct pq * pq, uint64_t * priority_out, void * data_out);
17size_t pq_size(struct pq * pq);
18
19#ifdef PQ_DEBUG
20void pq_print(struct pq * pq);
21#endif
22
23#endif
24