O2S C Library 1.8.2
Provide high-level data-structures and other fundamental tools for C projects
Loading...
Searching...
No Matches
queue.h File Reference

Realtime FIFO buffer. More...

#include "o2s/deque.h"

Go to the source code of this file.

Typedefs

typedef deque_t queue_t
 A queue is First In First Out.

Functions

void queue_free (queue_t *self)
 Release the allocated memory.
Modifiers
bool queue_push (queue_t *self, const void *element)
 Add a single element to the queue.
bool queue_push_n (queue_t *self, const void *elements, size_t count)
 Add count elements to the queue.
bool queue_pop (queue_t *self, void *destination)
 Pop the first element of the queue.
bool queue_pop_n (queue_t *self, void *destination, size_t count)
 Pop the first count elements of the queue.
bool queue_pop_into_array (queue_t *self, struct array *destination, size_t count)
 Move the count first elements at the back of destination.
Element access
void * queue_first (const queue_t *self)
 Next element to be popped.
void * queue_get (const queue_t *self, size_t index)
 Access an arbitrary queue element.
Capacity
size_t queue_room (const queue_t *self)
 Number of elements that can be added.
size_t queue_count (const queue_t *self)
 Number of elements currently in the queue.
size_t queue_capacity (const queue_t *self)
 Number of elements that can be stored in the queue.

Detailed Description

Realtime FIFO buffer.

Author
Antoine GAGNIERE

Definition in file queue.h.

Function Documentation

◆ queue_capacity()

size_t queue_capacity ( const queue_t * self)

Number of elements that can be stored in the queue.

See also
deque_capacity

Definition at line 61 of file queue.c.

◆ queue_count()

size_t queue_count ( const queue_t * self)

Number of elements currently in the queue.

See also
deque_count

Definition at line 55 of file queue.c.

◆ queue_first()

void * queue_first ( const queue_t * self)

Next element to be popped.

See also
deque_first

Definition at line 67 of file queue.c.

◆ queue_free()

void queue_free ( queue_t * self)

Release the allocated memory.

See also
deque_free

Definition at line 19 of file queue.c.

◆ queue_get()

void * queue_get ( const queue_t * self,
size_t index )

Access an arbitrary queue element.

See also
deque_get

Definition at line 73 of file queue.c.

◆ queue_pop()

bool queue_pop ( queue_t * self,
void * destination )

Pop the first element of the queue.

See also
deque_pop_front

Definition at line 37 of file queue.c.

◆ queue_pop_into_array()

bool queue_pop_into_array ( queue_t * self,
struct array * destination,
size_t count )

Move the count first elements at the back of destination.

See also
deque_pop_front_into_array

Definition at line 79 of file queue.c.

◆ queue_pop_n()

bool queue_pop_n ( queue_t * self,
void * destination,
size_t count )

Pop the first count elements of the queue.

See also
deque_pop_front_n

Definition at line 43 of file queue.c.

◆ queue_push()

bool queue_push ( queue_t * self,
const void * element )

Add a single element to the queue.

See also
deque_push_back

Definition at line 25 of file queue.c.

◆ queue_push_n()

bool queue_push_n ( queue_t * self,
const void * elements,
size_t count )

Add count elements to the queue.

See also
deque_push_back_n

Definition at line 31 of file queue.c.

◆ queue_room()

size_t queue_room ( const queue_t * self)

Number of elements that can be added.

See also
deque_room

Definition at line 49 of file queue.c.