4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
33 /** \file BLI_gsqueue.h
35 * \brief A generic structure queue (a queue for fixed length
36 * (generally small) structures.
39 typedef struct _GSQueue GSQueue;
42 * Create a new GSQueue.
44 * @param elem_size The size of the structures in the queue.
45 * @retval The new queue
47 GSQueue* BLI_gsqueue_new (int elem_size);
50 * Query if the queue is empty
52 int BLI_gsqueue_is_empty(GSQueue *gq);
55 * Query number elements in the queue
57 int BLI_gsqueue_size(GSQueue *gq);
60 * Access the item at the head of the queue
61 * without removing it.
63 * @param item_r A pointer to an appropriatly
64 * sized structure (the size passed to BLI_gsqueue_new)
66 void BLI_gsqueue_peek (GSQueue *gq, void *item_r);
69 * Access the item at the head of the queue
72 * @param item_r A pointer to an appropriatly
73 * sized structure (the size passed to BLI_gsqueue_new).
74 * Can be NULL if desired.
76 void BLI_gsqueue_pop (GSQueue *gq, void *item_r);
79 * Push an element onto the tail of the queue.
81 * @param item A pointer to an appropriatly
82 * sized structure (the size passed to BLI_gsqueue_new).
84 void BLI_gsqueue_push (GSQueue *gq, void *item);
87 * Push an element back onto the head of the queue (so
88 * it would be returned from the next call to BLI_gsqueue_pop).
90 * @param item A pointer to an appropriatly
91 * sized structure (the size passed to BLI_gsqueue_new).
93 void BLI_gsqueue_pushback (GSQueue *gq, void *item);
98 void BLI_gsqueue_free (GSQueue *gq);
100 #endif /* BLI_GSQUEUE_H */