/ocr/ocrservice/jni/hydrogen/include/leptonica/bbuffer.h

http://eyes-free.googlecode.com/ · C++ Header · 46 lines · 11 code · 5 blank · 30 comment · 0 complexity · 55646e641e18bbf75690ed41cf262337 MD5 · raw file

  1. /*====================================================================*
  2. - Copyright (C) 2001 Leptonica. All rights reserved.
  3. - This software is distributed in the hope that it will be
  4. - useful, but with NO WARRANTY OF ANY KIND.
  5. - No author or distributor accepts responsibility to anyone for the
  6. - consequences of using this software, or for whether it serves any
  7. - particular purpose or works at all, unless he or she says so in
  8. - writing. Everyone is granted permission to copy, modify and
  9. - redistribute this source code, for commercial or non-commercial
  10. - purposes, with the following restrictions: (1) the origin of this
  11. - source code must not be misrepresented; (2) modified versions must
  12. - be plainly marked as such; and (3) this notice may not be removed
  13. - or altered from any source or modified source distribution.
  14. *====================================================================*/
  15. #ifndef LEPTONICA_BBUFFER_H
  16. #define LEPTONICA_BBUFFER_H
  17. /*
  18. * bbuffer.h
  19. *
  20. * Expandable byte buffer for reading data in from memory and
  21. * writing data out to other memory.
  22. *
  23. * This implements a queue of bytes, so data read in is put
  24. * on the "back" of the queue (i.e., the end of the byte array)
  25. * and data written out is taken from the "front" of the queue
  26. * (i.e., from an index marker "nwritten" that is initially set at
  27. * the beginning of the array.) As usual with expandable
  28. * arrays, we keep the size of the allocated array and the
  29. * number of bytes that have been read into the array.
  30. *
  31. * For implementation details, see bbuffer.c.
  32. */
  33. struct ByteBuffer
  34. {
  35. l_int32 nalloc; /* size of allocated byte array */
  36. l_int32 n; /* number of bytes read into to the array */
  37. l_int32 nwritten; /* number of bytes written from the array */
  38. l_uint8 *array; /* byte array */
  39. };
  40. typedef struct ByteBuffer BBUFFER;
  41. #endif /* LEPTONICA_BBUFFER_H */