orca-software
|
#include <hal.h>
#include <libc.h>
#include <malloc.h>
#include <queue.h>
Functions | |
struct queue * | hf_queue_create (int32_t size) |
Creates a queue of specified size. More... | |
int32_t | hf_queue_destroy (struct queue *q) |
Destroys a queue. More... | |
int32_t | hf_queue_count (struct queue *q) |
Counts the number of nodes in a queue. More... | |
int32_t | hf_queue_addtail (struct queue *q, void *ptr) |
Adds a node to the tail of the queue. More... | |
void * | hf_queue_remhead (struct queue *q) |
Removes a node from the head of the queue. More... | |
void * | hf_queue_remtail (struct queue *q) |
Removes a node from the tail of the queue. More... | |
void * | hf_queue_get (struct queue *q, int32_t elem) |
Returns a node from the queue. More... | |
int32_t | hf_queue_set (struct queue *q, int32_t elem, void *ptr) |
Updates a node on the queue. More... | |
int32_t | hf_queue_swap (struct queue *q, int32_t elem1, int32_t elem2) |
Swap the position of two nodes in the queue. More... | |
This source code is licensed under the GNU General Public License, Version 2. See the file 'doc/license/gpl-2.0.txt' for more details.
Queue manipulation primitives and auxiliary functions. Queue structures are allocated only on the creation of queues, so little additional overhead regarding memory management is incurred at runtime.
int32_t hf_queue_addtail | ( | struct queue * | q, |
void * | ptr | ||
) |
Adds a node to the tail of the queue.
q | is a pointer to a queue structure. |
ptr | a pointer to data belonging to the queue node. |
int32_t hf_queue_count | ( | struct queue * | q | ) |
Counts the number of nodes in a queue.
q | is a pointer to a queue structure. |
struct queue* hf_queue_create | ( | int32_t | size | ) |
Creates a queue of specified size.
size | is the maximum number of elements. |
int32_t hf_queue_destroy | ( | struct queue * | q | ) |
Destroys a queue.
q | is a pointer to a queue structure. |
void* hf_queue_get | ( | struct queue * | q, |
int32_t | elem | ||
) |
Returns a node from the queue.
q | is a pointer to a queue structure. |
elem | is the n-th element from the queue. |
void* hf_queue_remhead | ( | struct queue * | q | ) |
Removes a node from the head of the queue.
q | is a pointer to a queue structure. |
void* hf_queue_remtail | ( | struct queue * | q | ) |
Removes a node from the tail of the queue.
q | is a pointer to a queue structure. |
int32_t hf_queue_set | ( | struct queue * | q, |
int32_t | elem, | ||
void * | ptr | ||
) |
Updates a node on the queue.
q | is a pointer to a queue structure. |
elem | is the n-th element from the queue. |
ptr | a pointer to data belonging to the queue node. |
int32_t hf_queue_swap | ( | struct queue * | q, |
int32_t | elem1, | ||
int32_t | elem2 | ||
) |
Swap the position of two nodes in the queue.
q | is a pointer to a queue structure. |
elem1 | is the first n-th element from the queue. |
elem2 | is the second n-th element from the queue. |