GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
closecell.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include "G.h"
Include dependency graph for closecell.c:

Go to the source code of this file.

Macros

#define FORMAT_FILE   "f_format"
 
#define QUANT_FILE   "f_quant"
 
#define NULL_FILE   "null"
 

Functions

int G_close_cell (int fd)
 close a raster map More...
 
int G_unopen_cell (int fd)
 unopen a raster map More...
 
int G__write_fp_format (int fd)
 

Macro Definition Documentation

#define FORMAT_FILE   "f_format"

Definition at line 37 of file closecell.c.

Referenced by G__write_fp_format().

#define NULL_FILE   "null"

Definition at line 39 of file closecell.c.

#define QUANT_FILE   "f_quant"

Definition at line 38 of file closecell.c.

Function Documentation

int G_close_cell ( int  fd)

close a raster map

The raster map opened on file descriptor fd is closed. Memory allocated for raster processing is freed. If open for writing, skeletal support files for the new raster map are created as well. Note. If a module wants to explicitly write support files (e.g., a specific color table) for a raster map it creates, it must do so after the raster map is closed. Otherwise the close will overwrite the support files. See Raster_Map_Layer_Support_Routines for routines which write raster support files.

If the map is a new floating point, move the .tmp file into the fcell element, create an empty file in the cell directory; write the floating-point range file; write a default quantization file quantization file is set here to round fp numbers (this is a default for now). create an empty category file, with max cat = max value (for backwards compatibility). Move the .tmp NULL-value bitmap file to the cell_misc directory.

Parameters
fd
Returns
int

Definition at line 71 of file closecell.c.

References fd, G__::fileinfo, G__::fileinfo_count, fileinfo::open_mode, and OPEN_OLD.

Referenced by G_set_window(), G_suppress_masking(), Gs_get_cat_label(), Gs_loadmap_as_bitmap(), Gs_loadmap_as_char(), Gs_loadmap_as_float(), Gs_loadmap_as_int(), Gs_loadmap_as_short(), IL_output_2d(), IL_resample_output_2d(), N_read_rast_to_array_2d(), and N_write_array_2d_to_rast().

int G_unopen_cell ( int  fd)

unopen a raster map

The raster map opened on file descriptor fd is closed. Memory allocated for raster processing is freed. If open for writing, the raster map is not created and the temporary file created when the raster map was opened is removed (see Creating_and_Opening_New_Raster_Files). This routine is useful when errors are detected and it is desired to not create the new raster map. While it is true that the raster map will not be created if the module exits without closing the file, the temporary file will not be removed at module exit. GRASS database management will eventually remove the temporary file, but the file can be quite large and will take up disk space until GRASS does remove it. Use this routine as a courtesy to the user.

Parameters
fd
Returns
int

Definition at line 104 of file closecell.c.

References fd, G__::fileinfo, G__::fileinfo_count, fileinfo::open_mode, and OPEN_OLD.

Referenced by G__check_for_auto_masking(), and N_write_array_2d_to_rast().