Clustal Omega  1.1.0
src/clustal/queue.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  * Clustal Omega - Multiple sequence alignment
00003  *
00004  * Copyright (C) 2010 University College Dublin
00005  *
00006  * Clustal-Omega is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License as
00008  * published by the Free Software Foundation; either version 2 of the
00009  * License, or (at your option) any later version.
00010  *
00011  * This file is part of Clustal-Omega.
00012  *
00013  ********************************************************************/
00014 
00015 /*
00016  * RCS $Id: queue.h 193 2011-02-07 15:45:21Z andreas $
00017  *
00018  * Functions/Macros for FIFOs/Queues
00019  *
00020  */
00021 
00022 #ifndef CLUSTALO_QUEUE_H
00023 #define CLUSTALO_QUEUE_H
00024 
00025 #include "list.h"
00026 
00027 
00028 
00029 /*  FIFO/Queue as list_t, storing data pointers
00030  * 
00031  */
00032 
00033 typedef list_t queue_t;
00034 
00035 /* setup queue */
00036 #define QUEUE_INIT(prQueue, destroy_func) ListInit((prQueue), (destroy_func))
00037 
00038 /* free all elements from queue */
00039 #define QUEUE_DESTROY(prQueue) ListDestroy((prQueue))
00040 
00041 /* enqueue */
00042 #define QUEUE_PUSH(prQueue, data) LIST_APPEND((prQueue), (data))
00043 
00044 /* dequeue */
00045 #define QUEUE_POP(prQueue, data) ListRemoveNext((prQueue), NULL, (data))
00046 
00047 /* is queue empty ? */
00048 #define QUEUE_EMPTY(prQueue) (0==LIST_SIZE((prQueue)))
00049 
00050 
00051 
00052 /* Special int FIF/Queue, storing ints by copying them instead of
00053  * keeping pointers only
00054  */
00055 
00056 typedef queue_t int_queue_t;
00057 
00058 /* setup queue */
00059 #define INT_QUEUE_INIT(prQueue) INT_LIST_INIT((prQueue))
00060 
00061 /* free all elements from queue */
00062 #define INT_QUEUE_DESTROY(prQueue) INT_LIST_DESTROY((prQueue))
00063 
00064 /* enqueue */
00065 #define INT_QUEUE_PUSH(prQueue, data) INT_LIST_APPEND((prQueue), (data))
00066 
00067 /* dequeue */
00068 #define INT_QUEUE_POP(prQueue, data) IntListRemoveNext((prQueue), NULL, (data))
00069 
00070 /* is queue empty ? */
00071 #define INT_QUEUE_EMPTY(prQueue) (0==INT_LIST_SIZE((prQueue)))
00072 
00073 
00074 
00075 #endif