GRASS Programmer's Manual  6.4.1(2011)
G.h
Go to the documentation of this file.
00001 #include <grass/config.h>
00002 #include <grass/gis.h>
00003 #include <rpc/types.h>
00004 #include <rpc/xdr.h>
00005 #ifdef HAVE_GDAL
00006 #include <gdal.h>
00007 #endif
00008 
00009 #define XDR_FLOAT_NBYTES 4
00010 #define XDR_DOUBLE_NBYTES 8
00011 #define NULL_ROWS_INMEM 8
00012 
00013 /* if short is 16 bits, then
00014  *       short will allow 32767 cols
00015  *       unsigned short will allow 65536 cols
00016  * use int if you need more columns (but this will take more memory).
00017  *
00018  */
00019 typedef int COLUMN_MAPPING;
00020 
00021 struct GDAL_link
00022 {
00023     char *filename;
00024     int band_num;
00025     DCELL null_val;
00026 #ifdef HAVE_GDAL
00027     GDALDatasetH data;
00028     GDALRasterBandH band;
00029     GDALDataType type;
00030 #endif
00031 };
00032 
00033 #ifdef HAVE_GDAL
00034 extern CPLErr G_gdal_raster_IO(GDALRasterBandH, GDALRWFlag,
00035                                int, int, int, int,
00036                                void *, int, int, GDALDataType, int, int);
00037 #endif
00038 
00039 struct fileinfo                 /* Information for opened cell files */
00040 {
00041     int open_mode;              /* see defines below            */
00042     struct Cell_head cellhd;    /* Cell header                  */
00043     struct Reclass reclass;     /* Table reclass                */
00044     struct Cell_stats statf;    /* Cell stats                   */
00045     struct Range range;         /* Range structure              */
00046     struct FPRange fp_range;    /* float Range structure        */
00047     int want_histogram;
00048     int reclass_flag;           /* Automatic reclass flag       */
00049     off_t *row_ptr;             /* File row addresses           */
00050     COLUMN_MAPPING *col_map;    /* Data to window col mapping   */
00051     double C1, C2;              /* Data to window row constants */
00052     int cur_row;                /* Current data row in memory   */
00053     int null_cur_row;           /* Current null row in memory   */
00054     int cur_nbytes;             /* nbytes per cell for current row */
00055     unsigned char *data;        /* Decompressed data buffer     */
00056     int nbytes;                 /* bytes per cell               */
00057     RASTER_MAP_TYPE map_type;   /* type: int, float or double map */
00058     char *temp_name;            /* Temporary name for NEW files */
00059     char *null_temp_name;       /* Temporary name for NEW NULL files */
00060     int null_file_exists;       /* for existing raster maps     */
00061     char *name;                 /* Name of open file            */
00062     char *mapset;               /* Mapset of open file          */
00063     int io_error;               /* io error warning given       */
00064     XDR xdrstream;              /* xdr stream for reading fp    */
00065     unsigned char *NULL_ROWS[NULL_ROWS_INMEM];
00066     unsigned char *null_work_buf;       /* data buffer for reading null rows    */
00067     int min_null_row;           /* Minimum row null row number in memory */
00068     struct Quant quant;
00069     struct GDAL_link *gdal;
00070 };
00071 
00072 struct G__                      /*  Structure of library globals */
00073 {
00074     int fp_nbytes;              /* size of cell in floating maps */
00075     RASTER_MAP_TYPE fp_type;    /* type for writing floating maps */
00076     struct Cell_head window;    /* Contains the current window          */
00077     int window_set;             /* Flag: window set?                    */
00078     int mask_fd;                /* File descriptor for automatic mask   */
00079     int auto_mask;              /* Flag denoting automatic masking      */
00080     CELL *mask_buf;
00081     char *null_buf;             /* buffer for reading null rows         */
00082     CELL *temp_buf;
00083     unsigned char *compressed_buf;      /* Pre/post compressed data buffer      */
00084     int compressed_buf_size;    /* sizeof compressed_buf                */
00085     unsigned char *work_buf;    /* work data buffer                     */
00086     int work_buf_size;          /* sizeof work_buf                      */
00087     int null_buf_size;          /* sizeof null_buf                      */
00088     int mask_buf_size;          /* sizeof mask_buf                      */
00089     int temp_buf_size;          /* sizeof temp_buf                      */
00090     int want_histogram;
00091 
00092     int fileinfo_count;
00093     struct fileinfo *fileinfo;
00094 };
00095 
00096 extern struct G__ G__;          /* allocated in gisinit */
00097 
00098 #define OPEN_OLD              1
00099 #define OPEN_NEW_COMPRESSED   2
00100 #define OPEN_NEW_UNCOMPRESSED 3
00101 #define OPEN_NEW_RANDOM       4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines