| 1 |
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 |
// vi: set et ts=4 sw=2 sts=2: |
| 3 |
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root |
| 4 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 |
/** \file |
| 6 |
\brief Header file for general purpose fifo (first in, first out) structure |
| 7 |
*/ |
| 8 |
|
| 9 |
/****************************************************************************/ |
| 10 |
/* */ |
| 11 |
/* File: fifo.h */ |
| 12 |
/* */ |
| 13 |
/* Purpose: header file for general purpose fifo */ |
| 14 |
/* */ |
| 15 |
/* Author: Peter Bastian */ |
| 16 |
/* Interdisziplinaeres Zentrum fuer Wissenschaftliches Rechnen */ |
| 17 |
/* Universitaet Heidelberg */ |
| 18 |
/* Im Neuenheimer Feld 368 */ |
| 19 |
/* 6900 Heidelberg */ |
| 20 |
/* */ |
| 21 |
/* History: 30.01.92 begin, ug version 2.0 */ |
| 22 |
/* */ |
| 23 |
/* Revision: 07.09.95 */ |
| 24 |
/* */ |
| 25 |
/****************************************************************************/ |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
/****************************************************************************/ |
| 30 |
/* */ |
| 31 |
/* auto include mechanism and other include files */ |
| 32 |
/* */ |
| 33 |
/****************************************************************************/ |
| 34 |
|
| 35 |
#ifndef __FIFO__ |
| 36 |
#define __FIFO__ |
| 37 |
|
| 38 |
|
| 39 |
#include "ugtypes.h" |
| 40 |
|
| 41 |
#include "namespace.h" |
| 42 |
|
| 43 |
START_UG_NAMESPACE |
| 44 |
|
| 45 |
/****************************************************************************/ |
| 46 |
/* */ |
| 47 |
/* data structures exported by the corresponding source file */ |
| 48 |
/* */ |
| 49 |
/****************************************************************************/ |
| 50 |
|
| 51 |
typedef struct { |
| 52 |
INT start,end,size,used; |
| 53 |
void **elements; |
| 54 |
} FIFO ; |
| 55 |
|
| 56 |
|
| 57 |
/****************************************************************************/ |
| 58 |
/* */ |
| 59 |
/* function declarations */ |
| 60 |
/* */ |
| 61 |
/****************************************************************************/ |
| 62 |
|
| 63 |
INT fifo_init (FIFO *myfifo, void *buffer, INT size); |
| 64 |
void fifo_clear (FIFO *myfifo); |
| 65 |
INT fifo_empty (const FIFO *myfifo); |
| 66 |
INT fifo_full (const FIFO *myfifo); |
| 67 |
INT fifo_in (FIFO *myfifo, void *newelement); |
| 68 |
void *fifo_out (FIFO *myfifo); |
| 69 |
|
| 70 |
END_UG_NAMESPACE |
| 71 |
|
| 72 |
#endif |