LibJuno 1.0.1
LibJuno is a lightweight C11 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
queue_api.h File Reference

Fixed-capacity FIFO queue built on the Array API. More...

#include "juno/ds/array_api.h"
#include "juno/macros.h"
#include "juno/memory/pointer_api.h"
#include "juno/status.h"
#include "juno/module.h"
#include <stddef.h>
Include dependency graph for queue_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  JUNO_DS_QUEUE_API_TAG
 Queue API vtable. More...
 

Typedefs

typedef struct JUNO_DS_QUEUE_ROOT_TAG JUNO_DS_QUEUE_ROOT_T
 The queue root module.
 
typedef struct JUNO_DS_QUEUE_API_TAG JUNO_DS_QUEUE_API_T
 

Functions

struct JUNO_DS_QUEUE_ROOT_TAG JUNO_MODULE_ROOT (JUNO_DS_QUEUE_API_T, JUNO_DS_ARRAY_ROOT_T *ptQueueArray;size_t iStartIndex;size_t zLength;)
 The queue root module instance.
 
static JUNO_STATUS_T JunoDs_QueueApiVerify (const JUNO_DS_QUEUE_API_T *ptQueueApi)
 Verify that the queue API provides all required functions.
 
static JUNO_STATUS_T JunoDs_QueueVerify (const JUNO_DS_QUEUE_ROOT_T *ptQueue)
 Verify a queue instance and its API table.
 
JUNO_STATUS_T JunoDs_QueuePush (JUNO_DS_QUEUE_ROOT_T *ptQueue, JUNO_POINTER_T tItem)
 Enqueue an item to the back of the queue (O(1)).
 
JUNO_STATUS_T JunoDs_QueuePop (JUNO_DS_QUEUE_ROOT_T *ptQueue, JUNO_POINTER_T tReturn)
 Dequeue the item at the front of the queue into tReturn (O(1)).
 
JUNO_RESULT_POINTER_T JunoDs_QueuePeek (JUNO_DS_QUEUE_ROOT_T *ptQueue)
 Peek at the item at the front without removing it (O(1)).
 
JUNO_STATUS_T JunoDs_QueueInit (JUNO_DS_QUEUE_ROOT_T *ptQueue, JUNO_DS_ARRAY_ROOT_T *ptQueueArray, JUNO_FAILURE_HANDLER_T pfcnFailureHdlr, JUNO_USER_DATA_T *pvFailureUserData)
 Initialize a queue over a backing array with a given capacity.
 

Detailed Description

Fixed-capacity FIFO queue built on the Array API.

This API has been generated by LibJuno: https://www.robinonsay.com/libjuno/

Typedef Documentation

◆ JUNO_DS_QUEUE_API_T

◆ JUNO_DS_QUEUE_ROOT_T

typedef struct JUNO_DS_QUEUE_ROOT_TAG JUNO_DS_QUEUE_ROOT_T

The queue root module.

Function Documentation

◆ JunoDs_QueueApiVerify()

static JUNO_STATUS_T JunoDs_QueueApiVerify ( const JUNO_DS_QUEUE_API_T ptQueueApi)
inlinestatic

Verify that the queue API provides all required functions.

◆ JunoDs_QueueInit()

JUNO_STATUS_T JunoDs_QueueInit ( JUNO_DS_QUEUE_ROOT_T ptQueue,
JUNO_DS_ARRAY_ROOT_T ptQueueArray,
JUNO_FAILURE_HANDLER_T  pfcnFailureHdlr,
JUNO_USER_DATA_T pvFailureUserData 
)

Initialize a queue over a backing array with a given capacity.

Parameters
ptQueueQueue to initialize (output).
ptQueueArrayBacking array used for storage; defines capacity and element size.
pfcnFailureHdlrFailure callback for assertions in this module.
pvFailureUserDataOpaque user data for the failure handler.
Returns
JUNO_STATUS_SUCCESS on success; error if array verification fails.

Initialize a queue over a backing array with a given capacity.

◆ JunoDs_QueuePeek()

JUNO_RESULT_POINTER_T JunoDs_QueuePeek ( JUNO_DS_QUEUE_ROOT_T ptQueue)

Peek at the item at the front without removing it (O(1)).

Peek at the item at the front without removing it (O(1)).

◆ JunoDs_QueuePop()

JUNO_STATUS_T JunoDs_QueuePop ( JUNO_DS_QUEUE_ROOT_T ptQueue,
JUNO_POINTER_T  tReturn 
)

Dequeue the item at the front of the queue into tReturn (O(1)).

Dequeue the item at the front of the queue into tReturn (O(1)).

◆ JunoDs_QueuePush()

JUNO_STATUS_T JunoDs_QueuePush ( JUNO_DS_QUEUE_ROOT_T ptQueue,
JUNO_POINTER_T  tItem 
)

Enqueue an item to the back of the queue (O(1)).

Enqueue an item to the back of the queue (O(1)).

◆ JunoDs_QueueVerify()

static JUNO_STATUS_T JunoDs_QueueVerify ( const JUNO_DS_QUEUE_ROOT_T ptQueue)
inlinestatic

Verify a queue instance and its API table.