GRASS Programmer's Manual  6.4.2(2012)
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(
00035     GDALRasterBandH, GDALRWFlag,
00036     int, int, int, int,
00037     void *, int, int, GDALDataType,
00038     int, int);
00039 #endif
00040 
00041 struct fileinfo                 /* Information for opened cell files */
00042 {
00043     int open_mode;              /* see defines below            */
00044     struct Cell_head cellhd;    /* Cell header                  */
00045     struct Reclass reclass;     /* Table reclass                */
00046     struct Cell_stats statf;    /* Cell stats                   */
00047     struct Range range;         /* Range structure              */
00048     struct FPRange fp_range;    /* float Range structure        */
00049     int want_histogram;
00050     int reclass_flag;           /* Automatic reclass flag       */
00051     off_t *row_ptr;             /* File row addresses           */
00052     COLUMN_MAPPING *col_map;    /* Data to window col mapping   */
00053     double C1, C2;              /* Data to window row constants */
00054     int cur_row;                /* Current data row in memory   */
00055     int null_cur_row;           /* Current null row in memory   */
00056     int cur_nbytes;             /* nbytes per cell for current row */
00057     unsigned char *data;        /* Decompressed data buffer     */
00058     int nbytes;                 /* bytes per cell               */
00059     RASTER_MAP_TYPE map_type;   /* type: int, float or double map */
00060     char *temp_name;            /* Temporary name for NEW files */
00061     char *null_temp_name;       /* Temporary name for NEW NULL files */
00062     int null_file_exists;       /* for existing raster maps     */
00063     char *name;                 /* Name of open file            */
00064     char *mapset;               /* Mapset of open file          */
00065     int io_error;               /* io error warning given       */
00066     XDR xdrstream;              /* xdr stream for reading fp    */
00067     unsigned char *NULL_ROWS[NULL_ROWS_INMEM];
00068     unsigned char *null_work_buf;       /* data buffer for reading null rows    */
00069     int min_null_row;           /* Minimum row null row number in memory */
00070     struct Quant quant;
00071     struct GDAL_link *gdal;
00072 };
00073 
00074 struct G__                      /*  Structure of library globals */
00075 {
00076     int fp_nbytes;              /* size of cell in floating maps */
00077     RASTER_MAP_TYPE fp_type;    /* type for writing floating maps */
00078     struct Cell_head window;    /* Contains the current window          */
00079     int window_set;             /* Flag: window set?                    */
00080     int mask_fd;                /* File descriptor for automatic mask   */
00081     int auto_mask;              /* Flag denoting automatic masking      */
00082     CELL *mask_buf;
00083     char *null_buf;             /* buffer for reading null rows         */
00084     CELL *temp_buf;
00085     unsigned char *compressed_buf;      /* Pre/post compressed data buffer      */
00086     int compressed_buf_size;    /* sizeof compressed_buf                */
00087     unsigned char *work_buf;    /* work data buffer                     */
00088     int work_buf_size;          /* sizeof work_buf                      */
00089     int null_buf_size;          /* sizeof null_buf                      */
00090     int mask_buf_size;          /* sizeof mask_buf                      */
00091     int temp_buf_size;          /* sizeof temp_buf                      */
00092     int want_histogram;
00093 
00094     int fileinfo_count;
00095     struct fileinfo *fileinfo;
00096 };
00097 
00098 extern struct G__ G__;          /* allocated in gisinit */
00099 
00100 #define OPEN_OLD              1
00101 #define OPEN_NEW_COMPRESSED   2
00102 #define OPEN_NEW_UNCOMPRESSED 3
00103 #define OPEN_NEW_RANDOM       4
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines