| 1 |
/* |
| 2 |
* libmowgli: A collection of useful routines for programming. |
| 3 |
* queue.h: Double-ended queues, also known as deque. |
| 4 |
* |
| 5 |
* Copyright (c) 2007 William Pitcock <nenolod -at- sacredspiral.co.uk> |
| 6 |
* |
| 7 |
* Permission to use, copy, modify, and/or distribute this software for any |
| 8 |
* purpose with or without fee is hereby granted, provided that the above |
| 9 |
* copyright notice and this permission notice is present in all copies. |
| 10 |
* |
| 11 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 12 |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 13 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 14 |
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
| 15 |
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 16 |
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 17 |
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 18 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 19 |
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 20 |
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 21 |
* POSSIBILITY OF SUCH DAMAGE. |
| 22 |
*/ |
| 23 |
|
| 24 |
#ifndef MOWGLI_SRC_LIBMOWGLI_CONTAINER_QUEUE_H_INCLUDE_GUARD |
| 25 |
#define MOWGLI_SRC_LIBMOWGLI_CONTAINER_QUEUE_H_INCLUDE_GUARD 1 |
| 26 |
|
| 27 |
#include "core/iterator.h" |
| 28 |
|
| 29 |
typedef mowgli_iterator_t mowgli_queue_t; |
| 30 |
|
| 31 |
extern mowgli_queue_t *mowgli_queue_push(mowgli_queue_t *head, void *data); |
| 32 |
extern mowgli_queue_t *mowgli_queue_shift(mowgli_queue_t *head, void *data); |
| 33 |
extern mowgli_queue_t *mowgli_queue_remove(mowgli_queue_t *head); |
| 34 |
extern mowgli_queue_t *mowgli_queue_find(mowgli_queue_t *head, void *data); |
| 35 |
extern mowgli_queue_t *mowgli_queue_remove_data(mowgli_queue_t *head, void *data); |
| 36 |
extern void mowgli_queue_destroy(mowgli_queue_t *head); |
| 37 |
extern mowgli_queue_t *mowgli_queue_skip(mowgli_queue_t *head, int amt); |
| 38 |
extern mowgli_queue_t *mowgli_queue_rewind(mowgli_queue_t *head, int amt); |
| 39 |
extern mowgli_queue_t *mowgli_queue_head(mowgli_queue_t *n); |
| 40 |
extern mowgli_queue_t *mowgli_queue_tail(mowgli_queue_t *n); |
| 41 |
extern void *mowgli_queue_pop_head(mowgli_queue_t **n); |
| 42 |
extern void *mowgli_queue_pop_tail(mowgli_queue_t **n); |
| 43 |
extern int mowgli_queue_length(mowgli_queue_t *head); |
| 44 |
|
| 45 |
#endif /* MOWGLI_SRC_LIBMOWGLI_CONTAINER_QUEUE_H_INCLUDE_GUARD */ |