Blender V2.61 - r43446
Typedefs | Functions

BLI_gsqueue.h File Reference

A generic structure queue (a queue for fixed length (generally small) structures. More...

Go to the source code of this file.

Typedefs

typedef struct _GSQueue GSQueue

Functions

GSQueueBLI_gsqueue_new (int elem_size)
int BLI_gsqueue_is_empty (GSQueue *gq)
int BLI_gsqueue_size (GSQueue *gq)
void BLI_gsqueue_peek (GSQueue *gq, void *item_r)
void BLI_gsqueue_pop (GSQueue *gq, void *item_r)
void BLI_gsqueue_push (GSQueue *gq, void *item)
void BLI_gsqueue_pushback (GSQueue *gq, void *item)
void BLI_gsqueue_free (GSQueue *gq)

Detailed Description

A generic structure queue (a queue for fixed length (generally small) structures.

Definition in file BLI_gsqueue.h.


Typedef Documentation

typedef struct _GSQueue GSQueue

Definition at line 37 of file BLI_gsqueue.h.


Function Documentation

void BLI_gsqueue_free ( GSQueue gq)

Free the queue

Definition at line 121 of file gsqueue.c.

References BLI_gsqueue_pop(), _GSQueue::head, MEM_freeN(), and NULL.

Referenced by BLI_thread_queue_free().

int BLI_gsqueue_is_empty ( GSQueue gq)

Query if the queue is empty

Definition at line 57 of file gsqueue.c.

References _GSQueue::head, and NULL.

Referenced by BLI_gsqueue_push(), BLI_gsqueue_pushback(), BLI_thread_queue_pop(), and BLI_thread_queue_pop_timeout().

GSQueue* BLI_gsqueue_new ( int  elem_size)

Create a new GSQueue.

Parameters:
elem_sizeThe size of the structures in the queue.
Return values:
Thenew queue

Definition at line 48 of file gsqueue.c.

References _GSQueue::elem_size, _GSQueue::head, MEM_mallocN(), NULL, and _GSQueue::tail.

Referenced by BLI_thread_queue_init().

void BLI_gsqueue_peek ( GSQueue gq,
void *  item_r 
)

Access the item at the head of the queue without removing it.

Parameters:
item_rA pointer to an appropriatly sized structure (the size passed to BLI_gsqueue_new)

Definition at line 73 of file gsqueue.c.

References _GSQueue::elem_size, and _GSQueue::head.

void BLI_gsqueue_pop ( GSQueue gq,
void *  item_r 
)

Access the item at the head of the queue and remove it.

Parameters:
item_rA pointer to an appropriatly sized structure (the size passed to BLI_gsqueue_new). Can be NULL if desired.

Definition at line 77 of file gsqueue.c.

References _GSQueue::elem_size, _GSQueue::head, MEM_freeN(), _GSQueueElem::next, NULL, and _GSQueue::tail.

Referenced by BLI_gsqueue_free(), BLI_thread_queue_pop(), and BLI_thread_queue_pop_timeout().

void BLI_gsqueue_push ( GSQueue gq,
void *  item 
)

Push an element onto the tail of the queue.

Parameters:
itemA pointer to an appropriatly sized structure (the size passed to BLI_gsqueue_new).

Definition at line 89 of file gsqueue.c.

References BLI_gsqueue_is_empty(), _GSQueue::elem_size, _GSQueue::head, MEM_mallocN(), _GSQueueElem::next, NULL, and _GSQueue::tail.

Referenced by BLI_thread_queue_push().

void BLI_gsqueue_pushback ( GSQueue gq,
void *  item 
)

Push an element back onto the head of the queue (so it would be returned from the next call to BLI_gsqueue_pop).

Parameters:
itemA pointer to an appropriatly sized structure (the size passed to BLI_gsqueue_new).

Definition at line 108 of file gsqueue.c.

References BLI_gsqueue_is_empty(), _GSQueue::elem_size, _GSQueue::head, MEM_mallocN(), _GSQueueElem::next, and _GSQueue::tail.

int BLI_gsqueue_size ( GSQueue gq)

Query number elements in the queue

Definition at line 62 of file gsqueue.c.

References _GSQueue::head, _GSQueueElem::next, and size().

Referenced by BLI_thread_queue_size().