Clustal Omega  1.2.3
queue.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Clustal Omega - Multiple sequence alignment
3  *
4  * Copyright (C) 2010 University College Dublin
5  *
6  * Clustal-Omega is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This file is part of Clustal-Omega.
12  *
13  ********************************************************************/
14 
15 /*
16  * RCS $Id: queue.h 193 2011-02-07 15:45:21Z andreas $
17  *
18  * Functions/Macros for FIFOs/Queues
19  *
20  */
21 
22 #ifndef CLUSTALO_QUEUE_H
23 #define CLUSTALO_QUEUE_H
24 
25 #include "list.h"
26 
27 
28 
29 /* FIFO/Queue as list_t, storing data pointers
30  *
31  */
32 
33 typedef list_t queue_t;
34 
35 /* setup queue */
36 #define QUEUE_INIT(prQueue, destroy_func) ListInit((prQueue), (destroy_func))
37 
38 /* free all elements from queue */
39 #define QUEUE_DESTROY(prQueue) ListDestroy((prQueue))
40 
41 /* enqueue */
42 #define QUEUE_PUSH(prQueue, data) LIST_APPEND((prQueue), (data))
43 
44 /* dequeue */
45 #define QUEUE_POP(prQueue, data) ListRemoveNext((prQueue), NULL, (data))
46 
47 /* is queue empty ? */
48 #define QUEUE_EMPTY(prQueue) (0==LIST_SIZE((prQueue)))
49 
50 
51 
52 /* Special int FIF/Queue, storing ints by copying them instead of
53  * keeping pointers only
54  */
55 
57 
58 /* setup queue */
59 #define INT_QUEUE_INIT(prQueue) INT_LIST_INIT((prQueue))
60 
61 /* free all elements from queue */
62 #define INT_QUEUE_DESTROY(prQueue) INT_LIST_DESTROY((prQueue))
63 
64 /* enqueue */
65 #define INT_QUEUE_PUSH(prQueue, data) INT_LIST_APPEND((prQueue), (data))
66 
67 /* dequeue */
68 #define INT_QUEUE_POP(prQueue, data) IntListRemoveNext((prQueue), NULL, (data))
69 
70 /* is queue empty ? */
71 #define INT_QUEUE_EMPTY(prQueue) (0==INT_LIST_SIZE((prQueue)))
72 
73 
74 
75 #endif
Definition: list.h:32
list_t queue_t
Definition: queue.h:33
queue_t int_queue_t
Definition: queue.h:56