GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71942
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
raster/close.c File Reference

Raster Library - Close raster file. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/glocale.h>
#include "R.h"
Include dependency graph for raster/close.c:

Go to the source code of this file.

Macros

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

Functions

void Rast_close (int fd)
 Close a raster map. More...
 
void Rast_unopen (int fd)
 Unopen a raster map. More...
 
void Rast__unopen_all (void)
 Unopen all raster maps. More...
 
void Rast__close_null (int fd)
 

Detailed Description

Raster Library - Close raster file.

(C) 1999-2009 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
USACERL and many others

Definition in file raster/close.c.

Macro Definition Documentation

#define FORMAT_FILE   "f_format"

Definition at line 33 of file raster/close.c.

#define NULL_FILE   "null"

Definition at line 35 of file raster/close.c.

#define NULLC_FILE   "nullcmpr"

Definition at line 37 of file raster/close.c.

Referenced by Rast__close_null().

#define QUANT_FILE   "f_quant"

Definition at line 34 of file raster/close.c.

Function Documentation

void Rast__unopen_all ( void  )

Unopen all raster maps.

Unopen all raster maps opened for write. Memory allocated for raster processing is freed, 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 remove temporary files.

Returns
void

Definition at line 129 of file raster/close.c.

References R__::fileinfo, R__::fileinfo_count, fileinfo::open_mode, OPEN_NEW_COMPRESSED, and OPEN_NEW_UNCOMPRESSED.

Referenced by Rast__error_handler().

void Rast_close ( 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
fdfile descriptor
Returns
void

Definition at line 72 of file raster/close.c.

References _, fd, R__::fileinfo, R__::fileinfo_count, G_fatal_error(), fileinfo::open_mode, and OPEN_OLD.

Referenced by close_band_files(), create_raster(), Gs_get_cat_label(), Gs_loadmap_as_bitmap(), Gs_loadmap_as_char(), Gs_loadmap_as_float(), Gs_loadmap_as_int(), Gs_loadmap_as_short(), I_insert_patch_to_cat_rast(), IL_create_bitmask(), IL_output_2d(), IL_resample_output_2d(), N_read_rast_to_array_2d(), N_write_array_2d_to_rast(), Rast_map_to_img_str(), and Rast_suppress_masking().

void Rast_unopen ( 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
fdfile descriptor
Returns
void

Definition at line 105 of file raster/close.c.

References _, fd, R__::fileinfo, R__::fileinfo_count, G_fatal_error(), fileinfo::open_mode, and OPEN_OLD.

Referenced by Rast__check_for_auto_masking().