The cdc_priority_queue is a struct and functions that provide a priority queue.
More...
#include <cdcontainers/common.h>
#include <cdcontainers/status.h>
#include <cdcontainers/tables/ipqueue.h>
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
Go to the source code of this file.
|
enum cdc_stat | cdc_priority_queue_ctor (const struct cdc_priority_queue_table *table, struct cdc_priority_queue **q, struct cdc_data_info *info) |
| Constructs an empty priority queue. More...
|
|
enum cdc_stat | cdc_priority_queue_ctorl (const struct cdc_priority_queue_table *table, struct cdc_priority_queue **q, struct cdc_data_info *info,...) |
| Constructs a priority queue, initialized by an arbitrary number of pointers. The last item must be NULL. More...
|
|
enum cdc_stat | cdc_priority_queue_ctorv (const struct cdc_priority_queue_table *table, struct cdc_priority_queue **q, struct cdc_data_info *info, va_list args) |
| Constructs a priority queue, initialized by args. The last item must be NULL. More...
|
|
void | cdc_priority_queue_dtor (struct cdc_priority_queue *q) |
| Destroys the priority queue. More...
|
|
static void * | cdc_priority_queue_top (struct cdc_priority_queue *q) |
| Returns a pointer to the priority queue's top item. This function assumes that the priority queue isn't empty. More...
|
|
static bool | cdc_priority_queue_empty (struct cdc_priority_queue *q) |
| Returns true if the priority queue has size 0; otherwise returns false. More...
|
|
static size_t | cdc_priority_queue_size (struct cdc_priority_queue *q) |
| Returns the number of items in the priority queue. More...
|
|
static enum cdc_stat | cdc_priority_queue_push (struct cdc_priority_queue *q, void *elem) |
| Adds element elem to the priority queue. More...
|
|
static void | cdc_priority_queue_pop (struct cdc_priority_queue *q) |
| Removes the top element. More...
|
|
void | cdc_priority_queue_swap (struct cdc_priority_queue *a, struct cdc_priority_queue *b) |
| Swaps priority queues a and b. This operation is very fast and never fails. More...
|
|
The cdc_priority_queue is a struct and functions that provide a priority queue.
- Author
- Maksim Andrianov maksi.nosp@m.mand.nosp@m.riano.nosp@m.v1@y.nosp@m.andex.nosp@m..ru
◆ cdc_priority_queue_ctor()
Constructs an empty priority queue.
- Parameters
-
- Returns
- CDC_STATUS_OK in a successful case or other value indicating an error
◆ cdc_priority_queue_ctorl()
Constructs a priority queue, initialized by an arbitrary number of pointers. The last item must be NULL.
- Parameters
-
- Returns
- CDC_STATUS_OK in a successful case or other value indicating an error
◆ cdc_priority_queue_ctorv()
Constructs a priority queue, initialized by args. The last item must be NULL.
- Parameters
-
- Returns
- CDC_STATUS_OK in a successful case or other value indicating an error
◆ cdc_priority_queue_dtor()
Destroys the priority queue.
- Parameters
-
◆ cdc_priority_queue_top()
Returns a pointer to the priority queue's top item. This function assumes that the priority queue isn't empty.
- Parameters
-
- Returns
- top item
◆ cdc_priority_queue_empty()
Returns true if the priority queue has size 0; otherwise returns false.
- Parameters
-
- Returns
- true if the pairing heap has size 0; otherwise returns false
◆ cdc_priority_queue_size()
Returns the number of items in the priority queue.
- Parameters
-
- Returns
- size
◆ cdc_priority_queue_push()
Adds element elem to the priority queue.
- Parameters
-
- Returns
- CDC_STATUS_OK in a successful case or other value indicating an error
◆ cdc_priority_queue_pop()
Removes the top element.
- Parameters
-
◆ cdc_priority_queue_swap()
Swaps priority queues a and b. This operation is very fast and never fails.
- Parameters
-