qLibc
|
Queue implementation. More...
Go to the source code of this file.
Functions | |
qqueue_t * | qqueue (int options) |
Create new queue container. | |
size_t | qqueue_setsize (qqueue_t *queue, size_t max) |
qqueue->setsize(): Sets maximum number of elements allowed in this queue. | |
bool | qqueue_push (qqueue_t *queue, const void *data, size_t size) |
qqueue->push(): Pushes an element onto the top of this queue. | |
bool | qqueue_pushstr (qqueue_t *queue, const char *str) |
qqueue->pushstr(): Pushes a string onto the top of this queue. | |
bool | qqueue_pushint (qqueue_t *queue, int64_t num) |
qqueue->pushint(): Pushes a integer onto the top of this queue. | |
void * | qqueue_pop (qqueue_t *queue, size_t *size) |
qqueue->pop(): Removes a element at the top of this queue and returns that element. | |
char * | qqueue_popstr (qqueue_t *queue) |
qqueue->popstr(): Removes a element at the top of this queue and returns that element. | |
int64_t | qqueue_popint (qqueue_t *queue) |
qqueue->popint(): Removes a integer at the top of this queue and returns that element. | |
void * | qqueue_popat (qqueue_t *queue, int index, size_t *size) |
qqueue->popat(): Returns and remove the element at the specified position in this queue. | |
void * | qqueue_get (qqueue_t *queue, size_t *size, bool newmem) |
qqueue->get(): Returns an element at the top of this queue without removing it. | |
char * | qqueue_getstr (qqueue_t *queue) |
qqueue->getstr(): Returns an string at the top of this queue without removing it. | |
int64_t | qqueue_getint (qqueue_t *queue) |
qqueue->getint(): Returns an integer at the top of this queue without removing it. | |
void * | qqueue_getat (qqueue_t *queue, int index, size_t *size, bool newmem) |
qqueue->getat(): Returns an element at the specified position in this queue without removing it. | |
size_t | qqueue_size (qqueue_t *queue) |
qqueue->size(): Returns the number of elements in this queue. | |
void | qqueue_clear (qqueue_t *queue) |
qqueue->clear(): Removes all of the elements from this queue. | |
bool | qqueue_debug (qqueue_t *queue, FILE *out) |
qqueue->debug(): Print out stored elements for debugging purpose. | |
void | qqueue_free (qqueue_t *queue) |
qqueue->free(): Free qqueue_t | |
Queue implementation.
qqueue container is a queue implementation. It represents a first-in-first-out(FIFO). It extends qlist container that allow a linked-list to be treated as a queue.
Definition in file qqueue.c.
qqueue_t * qqueue | ( | int | options | ) |
Create new queue container.
options | combination of initialization options. |
errno | will be set in error condition.
|
size_t qqueue_setsize | ( | qqueue_t * | queue, |
size_t | max | ||
) |
bool qqueue_push | ( | qqueue_t * | queue, |
const void * | data, | ||
size_t | size | ||
) |
qqueue->push(): Pushes an element onto the top of this queue.
queue | qqueue container pointer. |
data | a pointer which points data memory. |
size | size of the data. |
errno | will be set in error condition.
|
bool qqueue_pushstr | ( | qqueue_t * | queue, |
const char * | str | ||
) |
qqueue->pushstr(): Pushes a string onto the top of this queue.
queue | qqueue container pointer. |
data | a pointer which points data memory. |
size | size of the data. |
errno | will be set in error condition.
|
bool qqueue_pushint | ( | qqueue_t * | queue, |
int64_t | num | ||
) |
qqueue->pushint(): Pushes a integer onto the top of this queue.
queue | qqueue container pointer. |
num | integer data. |
errno | will be set in error condition.
|
void * qqueue_pop | ( | qqueue_t * | queue, |
size_t * | size | ||
) |
qqueue->pop(): Removes a element at the top of this queue and returns that element.
queue | qqueue container pointer. |
size | if size is not NULL, element size will be stored. |
errno | will be set in error condition.
|
char * qqueue_popstr | ( | qqueue_t * | queue | ) |
qqueue->popstr(): Removes a element at the top of this queue and returns that element.
queue | qqueue container pointer. |
errno | will be set in error condition.
|
int64_t qqueue_popint | ( | qqueue_t * | queue | ) |
qqueue->popint(): Removes a integer at the top of this queue and returns that element.
queue | qqueue container pointer. |
errno | will be set in error condition.
|
void * qqueue_popat | ( | qqueue_t * | queue, |
int | index, | ||
size_t * | size | ||
) |
qqueue->popat(): Returns and remove the element at the specified position in this queue.
queue | qqueue container pointer. |
index | index at which the specified element is to be inserted |
size | if size is not NULL, element size will be stored. |
errno | will be set in error condition.
|
void * qqueue_get | ( | qqueue_t * | queue, |
size_t * | size, | ||
bool | newmem | ||
) |
qqueue->get(): Returns an element at the top of this queue without removing it.
queue | qqueue container pointer. |
size | if size is not NULL, element size will be stored. |
newmem | whether or not to allocate memory for the element. |
errno | will be set in error condition.
|
char * qqueue_getstr | ( | qqueue_t * | queue | ) |
qqueue->getstr(): Returns an string at the top of this queue without removing it.
queue | qqueue container pointer. |
errno | will be set in error condition.
|
int64_t qqueue_getint | ( | qqueue_t * | queue | ) |
qqueue->getint(): Returns an integer at the top of this queue without removing it.
queue | qqueue container pointer. |
errno | will be set in error condition.
|
void * qqueue_getat | ( | qqueue_t * | queue, |
int | index, | ||
size_t * | size, | ||
bool | newmem | ||
) |
qqueue->getat(): Returns an element at the specified position in this queue without removing it.
queue | qqueue container pointer. |
index | index at which the specified element is to be inserted |
size | if size is not NULL, element size will be stored. |
newmem | whether or not to allocate memory for the element. |
errno | will be set in error condition.
|
size_t qqueue_size | ( | qqueue_t * | queue | ) |
void qqueue_clear | ( | qqueue_t * | queue | ) |
bool qqueue_debug | ( | qqueue_t * | queue, |
FILE * | out | ||
) |