Go to the source code of this file.
◆ priority_queue
The priority_queue data structure, which adapts a container to provide a priority queue. Adapts the vector container.
◆ priority_queue_clear()
Clears the elements from the priority queue.
- Parameters
-
me | the priority queue to clear |
- Returns
- BK_OK if no error
-
-BK_ENOMEM if out of memory
◆ priority_queue_destroy()
Frees the priority queue memory. Performing further operations after calling this function results in undefined behavior. Freeing NULL is legal, and causes no operation to be performed.
- Parameters
-
me | the priority queue to free from memory |
- Returns
- NULL
◆ priority_queue_front()
Gets the highest priority element in the priority queue. The pointer to the data being obtained should point to the data type which this priority queue holds. For example, if this priority queue holds integers, the data pointer should be a pointer to an integer. Since this data is being copied from the array to the data pointer, the pointer only has to be valid when this function is called.
- Parameters
-
data | the out copy of the highest priority element in the priority queue |
me | the priority queue to copy from |
- Returns
- BK_TRUE if the priority queue contained elements, otherwise BK_FALSE
◆ priority_queue_init()
priority_queue priority_queue_init |
( |
size_t |
data_size, |
|
|
int(*)(const void *const one, const void *const two) |
comparator |
|
) |
| |
◆ priority_queue_is_empty()
Determines whether or not the priority queue is empty.
- Parameters
-
me | the priority queue to check |
- Returns
- BK_TRUE if the priority queue is empty, otherwise BK_FALSE
◆ priority_queue_pop()
Removes the highest priority element from the priority queue. The pointer to the data being obtained should point to the data type which this priority queue holds. For example, if this priority queue holds integers, the data pointer should be a pointer to an integer. Since this data is being copied from the array to the data pointer, the pointer only has to be valid when this function is called.
- Parameters
-
data | the data to have copied from the priority queue |
me | the priority queue to pop the next element from |
- Returns
- BK_TRUE if the priority queue contained elements, otherwise BK_FALSE
◆ priority_queue_push()
Adds an element to the priority queue. The pointer to the data being passed in should point to the data type which this priority queue holds. For example, if this priority queue holds integers, the data pointer should be a pointer to an integer. Since the data is being copied, the pointer only has to be valid when this function is called.
- Parameters
-
me | the priority queue to add an element to |
data | the data to add to the queue |
- Returns
- BK_OK if no error
-
-BK_ENOMEM if out of memory
-
-BK_ERANGE if size has reached representable limit
◆ priority_queue_size()
Gets the size of the priority queue.
- Parameters
-
me | the priority queue to check |
- Returns
- the size of the priority queue