# ringbuffer.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  $RCSfile: ringbuffer.h,v $
    00003                              -------------------
    00004     cvs         : $Id: ringbuffer.h,v 1.8 2005/01/25 23:25:37 aquamaniac Exp $
    00005     begin       : Sun Jan 25 2004
    00006     copyright   : (C) 2004 by Martin Preuss
    00007     email       : martin@libchipcard.de
    00008
    00009  ***************************************************************************
    00010  *                                                                         *
    00011  *   This library is free software; you can redistribute it and/or         *
    00012  *   modify it under the terms of the GNU Lesser General Public            *
    00013  *   License as published by the Free Software Foundation; either          *
    00014  *   version 2.1 of the License, or (at your option) any later version.    *
    00015  *                                                                         *
    00016  *   This library is distributed in the hope that it will be useful,       *
    00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
    00019  *   Lesser General Public License for more details.                       *
    00020  *                                                                         *
    00021  *   You should have received a copy of the GNU Lesser General Public      *
    00022  *   License along with this library; if not, write to the Free Software   *
    00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
    00024  *   MA  02111-1307  USA                                                   *
    00025  *                                                                         *
    00026  ***************************************************************************/
    00027
    00028
    00029 #ifndef GWEN_RINGBUFFER_H
    00030 #define GWEN_RINGBUFFER_H
    00031
    00032 #include <gwenhywfar/types.h>
    00033 #include <gwenhywfar/gwenhywfarapi.h>
    00034
    00035 #ifdef __cplusplus
    00036 extern "C" {
    00037 #endif
    00038
    00039
    00047
    00048 typedef struct GWEN_RINGBUFFER GWEN_RINGBUFFER;
    00049
    00050
    00059 GWENHYWFAR_API
    00060 GWEN_RINGBUFFER *GWEN_RingBuffer_new(unsigned int size);
    00061
    00065 GWENHYWFAR_API
    00066 void GWEN_RingBuffer_free(GWEN_RINGBUFFER *rb);
    00067
    00068
    00081 GWENHYWFAR_API
    00082 int GWEN_RingBuffer_WriteBytes(GWEN_RINGBUFFER *rb,
    00083                                const char *buffer,
    00084                                GWEN_TYPE_UINT32 *size);
    00085
    00089 GWENHYWFAR_API
    00090 int GWEN_RingBuffer_WriteByte(GWEN_RINGBUFFER *rb, char c);
    00091
    00092
    00101 GWENHYWFAR_API
    00102 int GWEN_RingBuffer_ReadBytes(GWEN_RINGBUFFER *rb,
    00103                               char *buffer,
    00104                               GWEN_TYPE_UINT32 *size);
    00105
    00109 GWENHYWFAR_API
    00110 int GWEN_RingBuffer_ReadByte(GWEN_RINGBUFFER *rb);
    00121 GWENHYWFAR_API
    00122 GWEN_TYPE_UINT32 GWEN_RingBuffer_GetUsedBytes(const GWEN_RINGBUFFER *rb);
    00123
    00128 GWENHYWFAR_API
    00129 GWEN_TYPE_UINT32 GWEN_RingBuffer_GetBytesLeft(const GWEN_RINGBUFFER *rb);
    00130
    00134 GWENHYWFAR_API
    00135 GWEN_TYPE_UINT32 GWEN_RingBuffer_GetBufferSize(const GWEN_RINGBUFFER *rb);
    00147 GWENHYWFAR_API
    00148 GWEN_TYPE_UINT32 GWEN_RingBuffer_GetEmptyCounter(const GWEN_RINGBUFFER *rb);
    00149
    00150 GWENHYWFAR_API
    00151 void GWEN_RingBuffer_ResetEmptyCounter(GWEN_RINGBUFFER *rb);
    00152
    00153
    00157 GWENHYWFAR_API
    00158 GWEN_TYPE_UINT32 GWEN_RingBuffer_GetFullCounter(const GWEN_RINGBUFFER *rb);
    00159
    00160 GWENHYWFAR_API
    00161 void GWEN_RingBuffer_ResetFullCounter(GWEN_RINGBUFFER *rb);
    00162
    00163
    00168 GWENHYWFAR_API
    00169 GWEN_TYPE_UINT32 GWEN_RingBuffer_GetThroughput(GWEN_RINGBUFFER *rb);
    00170
    00174 GWENHYWFAR_API
    00175 void GWEN_RingBuffer_ResetThroughput(GWEN_RINGBUFFER *rb);
    00176
    00177
    00178
    00182 GWENHYWFAR_API
    00183 GWEN_TYPE_UINT32 GWEN_RingBuffer_GetMaxUsedBytes(const GWEN_RINGBUFFER *rb);
    00184
    00189 GWENHYWFAR_API
    00190 void GWEN_RingBuffer_ResetMaxUsedBytes(GWEN_RINGBUFFER *rb);
    00191
    00192 GWENHYWFAR_API
    00193 void GWEN_RingBuffer_Reset(GWEN_RINGBUFFER *rb);
    00194
    00195  /* name */
    00197
    00198
    00199
    00211 GWENHYWFAR_API
    00212 GWEN_TYPE_UINT32
    00213   GWEN_RingBuffer_GetMaxUnsegmentedRead(GWEN_RINGBUFFER *rb);
    00214
    00220 GWENHYWFAR_API
    00221 GWEN_TYPE_UINT32
    00222   GWEN_RingBuffer_GetMaxUnsegmentedWrite(GWEN_RINGBUFFER *rb);
    00223
    00230 GWENHYWFAR_API
    00231 void GWEN_RingBuffer_SkipBytesRead(GWEN_RINGBUFFER *rb,
    00232                                    GWEN_TYPE_UINT32 psize);
    00233
    00240 GWENHYWFAR_API
    00241 void GWEN_RingBuffer_SkipBytesWrite(GWEN_RINGBUFFER *rb,
    00242                                     GWEN_TYPE_UINT32 psize);
    00243
    00253 GWENHYWFAR_API
    00254 const char *GWEN_RingBuffer_GetReadPointer(const GWEN_RINGBUFFER *rb);
    00255
    00265 GWENHYWFAR_API
    00266 char *GWEN_RingBuffer_GetWritePointer(const GWEN_RINGBUFFER *rb);
    00267  /* name */
    00269
    00270  /* group */
    00272
    00273 #ifdef __cplusplus
    00274 }
    00275 #endif
    00276
    00277
    00278 #endif /* GWEN_RINGBUFFER_H */
    00279
    00280
    00281
    00282