1
/*********************************************************************
2
* Clustal Omega - Multiple sequence alignment
4
* Copyright (C) 2010 University College Dublin
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.
11
* This file is part of Clustal-Omega.
13
********************************************************************/
16
* RCS $Id: queue.h 193 2011-02-07 15:45:21Z andreas $
18
* Functions/Macros for FIFOs/Queues
22
#ifndef CLUSTALO_QUEUE_H
23
#define CLUSTALO_QUEUE_H
29
/* FIFO/Queue as list_t, storing data pointers
33
typedef list_t queue_t;
36
#define QUEUE_INIT(prQueue, destroy_func) ListInit((prQueue), (destroy_func))
38
/* free all elements from queue */
39
#define QUEUE_DESTROY(prQueue) ListDestroy((prQueue))
42
#define QUEUE_PUSH(prQueue, data) LIST_APPEND((prQueue), (data))
45
#define QUEUE_POP(prQueue, data) ListRemoveNext((prQueue), NULL, (data))
47
/* is queue empty ? */
48
#define QUEUE_EMPTY(prQueue) (0==LIST_SIZE((prQueue)))
52
/* Special int FIF/Queue, storing ints by copying them instead of
53
* keeping pointers only
56
typedef queue_t int_queue_t;
59
#define INT_QUEUE_INIT(prQueue) INT_LIST_INIT((prQueue))
61
/* free all elements from queue */
62
#define INT_QUEUE_DESTROY(prQueue) INT_LIST_DESTROY((prQueue))
65
#define INT_QUEUE_PUSH(prQueue, data) INT_LIST_APPEND((prQueue), (data))
68
#define INT_QUEUE_POP(prQueue, data) IntListRemoveNext((prQueue), NULL, (data))
70
/* is queue empty ? */
71
#define INT_QUEUE_EMPTY(prQueue) (0==INT_LIST_SIZE((prQueue)))