LibJuno 1.0.1
LibJuno is a lightweight C11 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
juno_buff_stack.c File Reference
#include "juno/ds/array_api.h"
#include "juno/ds/stack_api.h"
#include "juno/macros.h"
#include "juno/memory/memory_api.h"
#include "juno/status.h"
Include dependency graph for juno_buff_stack.c:

Functions

JUNO_STATUS_T JunoDs_StackPush (JUNO_DS_STACK_ROOT_T *ptStack, JUNO_POINTER_T tItem)
 Push an item onto the top of the stack (O(1)).
 
JUNO_STATUS_T JunoDs_StackPop (JUNO_DS_STACK_ROOT_T *ptStack, JUNO_POINTER_T tReturn)
 Pop the top item into tReturn (O(1)).
 
JUNO_RESULT_POINTER_T JunoDs_StackPeek (JUNO_DS_STACK_ROOT_T *ptStack)
 Peek at the top item without removing it (O(1)).
 
JUNO_STATUS_T JunoDs_StackInit (JUNO_DS_STACK_ROOT_T *ptStack, JUNO_DS_ARRAY_ROOT_T *ptStackArray, JUNO_FAILURE_HANDLER_T pfcnFailureHdlr, JUNO_USER_DATA_T *pvFailureUserData)
 Initialize a buffer queue with a capacity.
 

Variables

static const JUNO_DS_STACK_API_T gtStackApi
 

Function Documentation

◆ JunoDs_StackInit()

JUNO_STATUS_T JunoDs_StackInit ( JUNO_DS_STACK_ROOT_T ptStack,
JUNO_DS_ARRAY_ROOT_T ptStackArray,
JUNO_FAILURE_HANDLER_T  pfcnFailureHdlr,
JUNO_USER_DATA_T pvFailureUserData 
)

Initialize a buffer queue with a capacity.

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

◆ JunoDs_StackPeek()

JUNO_RESULT_POINTER_T JunoDs_StackPeek ( JUNO_DS_STACK_ROOT_T ptStack)

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

Peek at the next item in the queue

Returns
the index of the next item in the queue

◆ JunoDs_StackPop()

JUNO_STATUS_T JunoDs_StackPop ( JUNO_DS_STACK_ROOT_T ptStack,
JUNO_POINTER_T  tReturn 
)

Pop the top item into tReturn (O(1)).

Dequeue an item from the buffer

Returns
The index to dequeue the item from

◆ JunoDs_StackPush()

JUNO_STATUS_T JunoDs_StackPush ( JUNO_DS_STACK_ROOT_T ptStack,
JUNO_POINTER_T  tItem 
)

Push an item onto the top of the stack (O(1)).

Enqueue an item into the buffer

Returns
The index to place the enqueued item

Variable Documentation

◆ gtStackApi

const JUNO_DS_STACK_API_T gtStackApi
static
Initial value:
=
{
}
JUNO_STATUS_T JunoDs_StackPush(JUNO_DS_STACK_ROOT_T *ptStack, JUNO_POINTER_T tItem)
Push an item onto the top of the stack (O(1)).
Definition juno_buff_stack.c:27
JUNO_STATUS_T JunoDs_StackPop(JUNO_DS_STACK_ROOT_T *ptStack, JUNO_POINTER_T tReturn)
Pop the top item into tReturn (O(1)).
Definition juno_buff_stack.c:51
JUNO_RESULT_POINTER_T JunoDs_StackPeek(JUNO_DS_STACK_ROOT_T *ptStack)
Peek at the top item without removing it (O(1)).
Definition juno_buff_stack.c:75