1#ifndef ROUTING_KIT_ID_SET_QUEUE_H
2#define ROUTING_KIT_ID_SET_QUEUE_H
66 static const unsigned root = 1;
125 assert(
id <
id_count() &&
"id out of bounds");
154 assert(
id <
id_count() &&
"id out of bounds");
190 assert(y <
data.size());
unsigned id_count() const
static unsigned is_smaller_child(unsigned x)
True if other_child(x) > x. Only works if x != root.
unsigned max_number_of_ids
bool empty() const
Checks whether the queue contains any element.
static unsigned is_larger_child(unsigned x)
True if other_child(x) < x. Only works if x != root.
static unsigned larger_child(unsigned x)
Returns the node y such that parent(y) == x and y > other_child(y).
void clear()
Removes all elements from the queue.
static unsigned smallest_two_power_no_smaller_than(unsigned x)
static unsigned other_child(unsigned x)
Maps a node onto its sibling. Only works if x != root.
bool contains(unsigned id) const
Checks whether an ID is in the queue.
static unsigned parent(unsigned x)
Maps a node onto its parent. Only works if x != root.
static const unsigned root
IDSetMinQueue(unsigned n)
The queue may contain IDs from 0 to n-1.
static unsigned smaller_child(unsigned x)
Returns the node y such that parent(y) == x and y < other_child(y).
void min_to(T &x, const T &y)
const unsigned invalid_id