Salad  1.0.15
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Typedefs | Enumerations | Functions
Sld_queue

Data Structures

struct  sld_queue
 

Typedefs

typedef struct sld_queue sld_queue
 

Enumerations

enum  sld_queue_type { sld_queue_list = 0, sld_queue_vector = 1 }
 

Functions

SLD_SSINT sld_queue_init (struct sld_queue *queue, sld_queue_type queue_type)
 Initializes a sld_queue. More...
 
SLD_UINT sld_queue_size (struct sld_queue *queue)
 Returns the size of a sld_queue. More...
 
SLD_SSINT sld_queue_add (struct sld_queue *queue, void *object)
 Adds an object to the start of a sld_queue. More...
 
void * sld_queue_remove (struct sld_queue *queue)
 Returns and removes the first object in a sld_queue. More...
 
void * sld_queue_peek (struct sld_queue *queue)
 Returns the first object in a sld_queue. More...
 
void sld_queue_free (struct sld_queue *queue)
 Frees any memory allocated for an initialized sld_queue. More...
 

Detailed Description

This module contains enums, functions, and structures related to sld_queue objects.

Typedef Documentation

typedef struct sld_queue sld_queue

A sld_queue contains data in a FIFO (first in, first out) arrangement

Enumeration Type Documentation

These constants allow the user to define how queue data should reside in memory (contiguous or not.) This can also affect performance (resizing arrays can be expensive in the case of a vector for example.)

Enumerator
sld_queue_list 
sld_queue_vector 

Function Documentation

SLD_SSINT sld_queue_add ( struct sld_queue queue,
void *  object 
)
related

Adds an object to the start of a sld_queue.

Parameters
queuean initialized sld_queue
objectan arbitrary object
Returns
Success or failure
sld_queue_add(&queue, "foo");
Examples:
queue.c.
void sld_queue_free ( struct sld_queue queue)
related

Frees any memory allocated for an initialized sld_queue.

Parameters
queuean initialized sld_queue
Examples:
queue.c.
SLD_SSINT sld_queue_init ( struct sld_queue queue,
sld_queue_type  queue_type 
)
related

Initializes a sld_queue.

Parameters
queuean uninitialized sld_queue
queue_typecan be either a sld_queue_list or sld_queue_vector
Returns
Success or failure
Examples:
queue.c.
void * sld_queue_peek ( struct sld_queue queue)
related

Returns the first object in a sld_queue.

Parameters
queuean initialized sld_queue
Returns
The first object in the passed sld_queue
puts((char *)sld_queue_peek(&queue));
Examples:
queue.c.
void * sld_queue_remove ( struct sld_queue queue)
related

Returns and removes the first object in a sld_queue.

Parameters
queuean initialized sld_queue
Returns
The first object in the passed sld_queue
Examples:
queue.c.
SLD_UINT sld_queue_size ( struct sld_queue queue)
related

Returns the size of a sld_queue.

Parameters
queuean initialized sld_queue
Returns
The size of the passed sld_queue
printf("The queue currently has %u items waiting.\n", sld_queue_size());
Examples:
queue.c.