Loading...
Searching...
No Matches
priority_queue.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2013, 2014 Freie Universität Berlin
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
19#ifndef PRIORITY_QUEUE_H
20#define PRIORITY_QUEUE_H
21
22#include <stddef.h>
23#include <stdint.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
37
44
48#define PRIORITY_QUEUE_NODE_INIT { NULL, 0, 0 }
49
53#define PRIORITY_QUEUE_DATA_SIGNALING (UINTPTR_MAX)
54
70
74#define PRIORITY_QUEUE_INIT { NULL }
75
84static inline void priority_queue_init(priority_queue_t *priority_queue)
85{
87
88 *priority_queue = q;
89}
90
99
112
120
121#if ENABLE_DEBUG
128
135#endif
136
137#ifdef __cplusplus
138}
139#endif
140
142#endif /* PRIORITY_QUEUE_H */
#define PRIORITY_QUEUE_INIT
Static initializer for priority_queue_t.
priority_queue_node_t * priority_queue_remove_head(priority_queue_t *root)
remove the priority queue's head
void priority_queue_print(priority_queue_t *root)
print the data and priority of every node in the given priority queue
static void priority_queue_init(priority_queue_t *priority_queue)
Initialize a priority queue object.
struct priority_queue_node priority_queue_node_t
data type for priority queue nodes
void priority_queue_print_node(priority_queue_t *root)
print the data, priority, and successor of a given node
void priority_queue_remove(priority_queue_t *root, priority_queue_node_t *node)
remove node from root
#define PRIORITY_QUEUE_NODE_INIT
Static initializer for priority_queue_node_t.
void priority_queue_add(priority_queue_t *root, priority_queue_node_t *new_obj)
insert new_obj into root based on its priority
static void priority_queue_node_init(priority_queue_node_t *priority_queue_node)
Initialize a priority queue node object.
data type for priority queue nodes
uintptr_t data
queue node data
struct priority_queue_node * next
next queue node
uint32_t priority
queue node priority
data type for priority queues
priority_queue_node_t * first
first queue node