PageRenderTime 22ms CodeModel.GetById 11ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

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

http://eyes-free.googlecode.com/
C++ Header | 107 lines | 49 code | 21 blank | 37 comment | 0 complexity | cca3e2d2688b625776828e6956ed6733 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
 16#ifndef  LEPTONICA_ARRAY_H
 17#define  LEPTONICA_ARRAY_H
 18
 19/*
 20 *  Contains the following structs:
 21 *      struct Numa
 22 *      struct Numaa
 23 *      struct Numa2d
 24 *      struct NumaHash
 25 *      struct Sarray
 26 *
 27 *  Contains definitions for:
 28 *      Numa interpolation flags
 29 */
 30
 31
 32/*------------------------------------------------------------------------* 
 33 *                             Array Structs                              *
 34 *------------------------------------------------------------------------*/
 35
 36#define  NUMA_VERSION_NUMBER     1
 37
 38    /* Number array: an array of floats */
 39struct Numa
 40{
 41    l_int32          nalloc;    /* size of allocated number array      */
 42    l_int32          n;         /* number of numbers saved             */
 43    l_int32          refcount;  /* reference count (1 if no clones)    */
 44    l_float32        startx;    /* x value assigned to array[0]        */
 45    l_float32        delx;      /* change in x value as i --> i + 1    */
 46    l_float32       *array;     /* number array                        */
 47};
 48typedef struct Numa  NUMA;
 49
 50
 51    /* Array of number arrays */
 52struct Numaa
 53{
 54    l_int32          nalloc;    /* size of allocated ptr array          */
 55    l_int32          n;         /* number of Numa saved                 */
 56    struct Numa    **numa;      /* array of Numa                        */
 57};
 58typedef struct Numaa  NUMAA;
 59
 60
 61
 62    /* Sparse 2-dimensional array of number arrays */
 63struct Numa2d
 64{
 65    l_int32          nrows;      /* number of rows allocated for ptr array  */
 66    l_int32          ncols;      /* number of cols allocated for ptr array  */
 67    l_int32          initsize;   /* initial size of each numa that is made  */
 68    struct Numa   ***numa;       /* 2D array of Numa                        */
 69};
 70typedef struct Numa2d  NUMA2D;
 71
 72
 73    /* A hash table of Numas */
 74struct NumaHash
 75{
 76    l_int32          nbuckets;
 77    l_int32          initsize;   /* initial size of each numa that is made  */
 78    struct Numa    **numa;
 79};
 80typedef struct NumaHash NUMAHASH;
 81
 82
 83#define  SARRAY_VERSION_NUMBER     1
 84
 85    /* String array: an array of C strings */
 86struct Sarray
 87{
 88    l_int32          nalloc;    /* size of allocated ptr array         */
 89    l_int32          n;         /* number of strings allocated         */
 90    l_int32          refcount;  /* reference count (1 if no clones)    */
 91    char           **array;     /* string array                        */
 92};
 93typedef struct Sarray SARRAY;
 94
 95
 96/*------------------------------------------------------------------------* 
 97 *                              Array flags                               *
 98 *------------------------------------------------------------------------*/
 99
100    /* Flags for interpolation in Numa */
101enum {
102    L_LINEAR_INTERP = 1,        /* linear     */
103    L_QUADRATIC_INTERP = 2      /* quadratic  */
104};
105
106
107#endif  /* LEPTONICA_ARRAY_H */