Leptonica 1.68
C Image Processing Library

ptra.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_PTRA_H
00017 #define  LEPTONICA_PTRA_H
00018 
00019 /*
00020  *  Contains the following structs:
00021  *      struct L_Ptra
00022  *      struct L_Ptraa
00023  *
00024  *  Contains definitions for:
00025  *      L_Ptra compaction flags for removal
00026  *      L_Ptra shifting flags for insert
00027  *      L_Ptraa accessor flags
00028  */
00029 
00030 
00031 /*------------------------------------------------------------------------* 
00032  *                     Generic Ptr Array Structs                          *
00033  *------------------------------------------------------------------------*/
00034 
00035     /* Generic pointer array */
00036 struct L_Ptra
00037 {
00038     l_int32          nalloc;    /* size of allocated ptr array         */
00039     l_int32          imax;      /* greatest valid index                */
00040     l_int32          nactual;   /* actual number of stored elements    */
00041     void           **array;     /* ptr array                           */
00042 };
00043 typedef struct L_Ptra  L_PTRA;
00044 
00045 
00046     /* Array of generic pointer arrays */
00047 struct L_Ptraa
00048 {
00049     l_int32          nalloc;    /* size of allocated ptr array         */
00050     struct L_Ptra  **ptra;      /* array of ptra                       */
00051 };
00052 typedef struct L_Ptraa  L_PTRAA;
00053 
00054 
00055 
00056 /*------------------------------------------------------------------------* 
00057  *                              Array flags                               *
00058  *------------------------------------------------------------------------*/
00059 
00060     /* Flags for removal from L_Ptra */
00061 enum {
00062     L_NO_COMPACTION = 1,        /* null the pointer only  */
00063     L_COMPACTION = 2            /* compact the array      */
00064 };
00065 
00066     /* Flags for insertion into L_Ptra */
00067 enum {
00068     L_AUTO_DOWNSHIFT = 0,       /* choose based on number of holes        */
00069     L_MIN_DOWNSHIFT = 1,        /* downshifts min # of ptrs below insert  */
00070     L_FULL_DOWNSHIFT = 2        /* downshifts all ptrs below insert       */
00071 };
00072 
00073     /* Accessor flags for L_Ptraa */
00074 enum {
00075     L_HANDLE_ONLY = 0,          /* ptr to L_Ptra; caller can inspect only    */
00076     L_REMOVE = 1                /* caller owns; destroy or save in L_Ptraa   */
00077 };
00078 
00079 
00080 #endif  /* LEPTONICA_PTRA_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines