Leptonica 1.68
C Image Processing Library

bbuffer.h

Go to the documentation of this file.
00001 /*====================================================================*
00002  -  Copyright (C) 2001 Leptonica.  All rights reserved.
00003  -  This software is distributed in the hope that it will be
00004  -  useful, but with NO WARRANTY OF ANY KIND.
00005  -  No author or distributor accepts responsibility to anyone for the
00006  -  consequences of using this software, or for whether it serves any
00007  -  particular purpose or works at all, unless he or she says so in
00008  -  writing.  Everyone is granted permission to copy, modify and
00009  -  redistribute this source code, for commercial or non-commercial
00010  -  purposes, with the following restrictions: (1) the origin of this
00011  -  source code must not be misrepresented; (2) modified versions must
00012  -  be plainly marked as such; and (3) this notice may not be removed
00013  -  or altered from any source or modified source distribution.
00014  *====================================================================*/
00015 
00016 #ifndef  LEPTONICA_BBUFFER_H
00017 #define  LEPTONICA_BBUFFER_H
00018 
00019 /*
00020  *  bbuffer.h
00021  *
00022  *      Expandable byte buffer for reading data in from memory and
00023  *      writing data out to other memory.
00024  *
00025  *      This implements a queue of bytes, so data read in is put
00026  *      on the "back" of the queue (i.e., the end of the byte array)
00027  *      and data written out is taken from the "front" of the queue
00028  *      (i.e., from an index marker "nwritten" that is initially set at
00029  *      the beginning of the array.)  As usual with expandable
00030  *      arrays, we keep the size of the allocated array and the
00031  *      number of bytes that have been read into the array.
00032  *
00033  *      For implementation details, see bbuffer.c.
00034  */
00035 
00036 struct ByteBuffer
00037 {
00038     l_int32      nalloc;       /* size of allocated byte array            */
00039     l_int32      n;            /* number of bytes read into to the array  */
00040     l_int32      nwritten;     /* number of bytes written from the array  */
00041     l_uint8     *array;        /* byte array                              */
00042 };
00043 typedef struct ByteBuffer BBUFFER;
00044 
00045 
00046 #endif  /* LEPTONICA_BBUFFER_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines