The cdc_queue is a struct and functions that provide a queue.
More...
#include <cdcontainers/common.h>
#include <cdcontainers/status.h>
#include <cdcontainers/tables/isequence.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_queue_ctor (const struct cdc_sequence_table *table, struct cdc_queue **q, struct cdc_data_info *info) |
| Constructs an empty queue. More...
|
|
enum cdc_stat | cdc_queue_ctorl (const struct cdc_sequence_table *table, struct cdc_queue **q, struct cdc_data_info *info,...) |
| Constructs a queue, initialized by an arbitrary number of pointers. The last item must be NULL. More...
|
|
enum cdc_stat | cdc_queue_ctorv (const struct cdc_sequence_table *table, struct cdc_queue **q, struct cdc_data_info *info, va_list args) |
| Constructs a queue, initialized by args The last item must be NULL. More...
|
|
void | cdc_queue_dtor (struct cdc_queue *q) |
| Destroys the queue. More...
|
|
static void * | cdc_queue_front (struct cdc_queue *q) |
| Returns pointer to the first element in the queue. This function assumes that the queue isn't empty. More...
|
|
static void * | cdc_queue_back (struct cdc_queue *q) |
| Returns pointer to the last element in the queue. This function assumes that the queue isn't empty. More...
|
|
static bool | cdc_queue_empty (struct cdc_queue *q) |
| Returns true if the queue has size 0; otherwise returns false. More...
|
|
static size_t | cdc_queue_size (struct cdc_queue *q) |
| Returns the number of items in the queue. More...
|
|
static enum cdc_stat | cdc_queue_push (struct cdc_queue *q, void *elem) |
| Adds value elem to the tail of the queue. More...
|
|
static void | cdc_queue_pop (struct cdc_queue *q) |
| Removes the head item in the queue. This function assumes that the queue isn't empty. More...
|
|
void | cdc_queue_swap (struct cdc_queue *a, struct cdc_queue *b) |
| Swaps queues a and b. This operation is very fast and never fails. More...
|
|
The cdc_queue is a struct and functions that provide a queue.
- Author
- Maksim Andrianov maksi.nosp@m.mand.nosp@m.riano.nosp@m.v1@y.nosp@m.andex.nosp@m..ru
◆ cdc_queue_ctor()
Constructs an empty queue.
- Parameters
-
- Returns
- CDC_STATUS_OK in a successful case or other value indicating an error
◆ cdc_queue_ctorl()
Constructs a 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_queue_ctorv()
Constructs a 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_queue_dtor()
Destroys the queue.
- Parameters
-
◆ cdc_queue_front()
static void* cdc_queue_front |
( |
struct cdc_queue * |
q | ) |
|
|
inlinestatic |
Returns pointer to the first element in the queue. This function assumes that the queue isn't empty.
- Parameters
-
- Returns
- pointer to the first element in the queue
◆ cdc_queue_back()
static void* cdc_queue_back |
( |
struct cdc_queue * |
q | ) |
|
|
inlinestatic |
Returns pointer to the last element in the queue. This function assumes that the queue isn't empty.
- Parameters
-
- Returns
- pointer to the last element in the queue
◆ cdc_queue_empty()
static bool cdc_queue_empty |
( |
struct cdc_queue * |
q | ) |
|
|
inlinestatic |
Returns true if the queue has size 0; otherwise returns false.
- Parameters
-
- Returns
- true if the list has size 0; otherwise returns false
◆ cdc_queue_size()
static size_t cdc_queue_size |
( |
struct cdc_queue * |
q | ) |
|
|
inlinestatic |
Returns the number of items in the queue.
- Parameters
-
- Returns
- size
◆ cdc_queue_push()
Adds value elem to the tail of the queue.
- Parameters
-
- Returns
- CDC_STATUS_OK in a successful case or other value indicating an error
◆ cdc_queue_pop()
static void cdc_queue_pop |
( |
struct cdc_queue * |
q | ) |
|
|
static |
Removes the head item in the queue. This function assumes that the queue isn't empty.
- Parameters
-
◆ cdc_queue_swap()
Swaps queues a and b. This operation is very fast and never fails.
- Parameters
-