00001 /**************************************************************** 00002 * Fulguro 00003 * Copyright (C) 2004 Christophe Clienti 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the 00017 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 * Boston, MA 02111-1307, USA. 00019 ***************************************************************/ 00020 00021 #include <stdlib.h> 00022 #include <flgrCoreMalloc.h> 00023 #include <flgrCoreDispatch.h> 00024 #include "flgrDataToolsFifo.h" 00025 00026 00034 void flgr_fifo_init(FLGR_Fifo *fifo) { 00035 fifo->input = NULL; 00036 fifo->output = NULL; 00037 fifo->label = NULL; 00038 fifo->size = 0; 00039 } 00040 00041 FLGR_Fifo *flgr_fifo_create(void) { 00042 FLGR_Fifo *fifo = (FLGR_Fifo *) flgr_malloc(sizeof(FLGR_Fifo)); 00043 00044 flgr_fifo_init(fifo); 00045 00046 return fifo; 00047 } 00048 00049 int flgr_fifo_get_size(FLGR_Fifo *fifo) { 00050 return fifo->size; 00051 } 00052 00053 void flgr_fifo_flush(FLGR_Fifo *fifo) { 00054 while(flgr_fifo_get_size(fifo)!=0) { 00055 flgr_fifo_del_current(fifo); 00056 } 00057 } 00058 00059 void flgr_fifo_destroy(FLGR_Fifo *fifo) { 00060 flgr_fifo_flush(fifo); 00061 flgr_free(fifo); 00062 } 00063 00064 00065 00066 00067