GRASS 8 Programmer's Manual 8.6.0dev(2026)-ddeab64dbf
Loading...
Searching...
No Matches
raster/put_row.c
Go to the documentation of this file.
1/*!
2 \file lib/raster/put_row.c
3
4 \brief Raster library - Put raster row
5
6 (C) 2003-2009 by the GRASS Development Team
7
8 This program is free software under the GNU General Public License
9 (>=v2). Read the file COPYING that comes with GRASS for details.
10
11 \author Original author CERL
12 */
13
14/**********************************************************************
15
16 **********************************************************************/
17
18#include <string.h>
19
20#include <sys/types.h>
21#include <sys/stat.h>
22#include <unistd.h>
23#include <fcntl.h>
24#include <errno.h>
25
26#include <grass/config.h>
27#include <grass/raster.h>
28#include <grass/glocale.h>
29
30#include "R.h"
31
32static void put_raster_row(int, const void *, RASTER_MAP_TYPE, int);
33
34/*!
35 \brief Writes the next row for cell/fcell/dcell file
36
37 Writes the next row for the cell file opened on 'fd' from 'buf' All
38 writes go into NEW files that exactly match the current window. The
39 file must have been opened with Rast_open_new() and be written
40 sequentially, ie no skipping rows.
41
42 When the null values are embedded into the data, corresponding cells
43 are changed to 0's and the corresponding null value row is written
44 into null file.
45
46 A map cannot be copied using Rast_get_row() and
47 Rast_put_row(). The former resamples the data of the original
48 map into a row buffer that matches the current window. The later
49 writes out rows associated with the window.
50
51 Keeps track of the minimum and maximum cell value for use in
52 updating the range file upon close of the cell file. HOWEVER when
53 nulls are not embedded, the cells are considered 0's as far as
54 updating range is concerned, even if the corresponding cell is null
55 in the resulting null file, so programmer should be carefult to set
56 all the null values using Rast_set_null_value() or
57 G_insert_d_null_values() or G_insert_f_null_values().
58
59 \param fd file descriptor where data is to be written
60 \param buf buffer holding data
61 \param data_type raster map type (CELL_TYPE, FCELL_TYPE, DCELL_TYPE)
62
63 \return void
64 */
65void Rast_put_row(int fd, const void *buf, RASTER_MAP_TYPE data_type)
66{
67 put_raster_row(fd, buf, data_type, 0);
68}
69
70/*!
71 \brief Writes the next row for cell file (CELL version)
72
73 See Rast_put_row() for details.
74
75 \param fd file descriptor where data is to be written
76 \param buf buffer holding data
77
78 \return void
79 */
80void Rast_put_c_row(int fd, const CELL *buf)
81{
82 Rast_put_row(fd, buf, CELL_TYPE);
83}
84
85/*!
86 \brief Writes the next row for fcell file (FCELL version)
87
88 See Rast_put_row() for details.
89
90 \param fd file descriptor where data is to be written
91 \param buf buffer holding data
92
93 \return void
94 */
95void Rast_put_f_row(int fd, const FCELL *buf)
96{
97 Rast_put_row(fd, buf, FCELL_TYPE);
98}
99
100/*!
101 \brief Writes the next row for dcell file (DCELL version)
102
103 See Rast_put_row() for details.
104
105 \param fd file descriptor where data is to be written
106 \param buf buffer holding data
107
108 \return void
109 */
110void Rast_put_d_row(int fd, const DCELL *buf)
111{
112 Rast_put_row(fd, buf, DCELL_TYPE);
113}
114
115static void write_data(int fd, int row, unsigned char *buf, int n)
116{
117 struct fileinfo *fcb = &R__.fileinfo[fd];
118 ssize_t nwrite = fcb->nbytes * n;
119
120 if (write(fcb->data_fd, buf, nwrite) != nwrite)
122 _("Error writing uncompressed FP data for row %d of <%s>: %s"), row,
124}
125
126static void write_data_compressed(int fd, int row, unsigned char *buf, int n,
127 int compressor)
128{
129 struct fileinfo *fcb = &R__.fileinfo[fd];
130 int nwrite = fcb->nbytes * n;
131
132 if (G_write_compressed(fcb->data_fd, buf, nwrite, compressor) < 0)
134 _("Error writing compressed FP data for row %d of <%s>: %s"), row,
136}
137
138static void set_file_pointer(int fd, int row)
139{
140 struct fileinfo *fcb = &R__.fileinfo[fd];
141
142 fcb->row_ptr[row] = lseek(fcb->data_fd, 0L, SEEK_CUR);
143 if (fcb->row_ptr[row] == -1) {
144 int err = errno;
145 G_fatal_error(_("File read/write operation failed: %s (%d)"),
146 strerror(err), err);
147 }
148}
149
150static void convert_float(float *work_buf, char *null_buf, const FCELL *rast,
151 int n)
152{
153 int i;
154
155 for (i = 0; i < n; i++) {
156 FCELL f;
157
158 /* substitute embedded null vals by 0's */
159 if (Rast_is_f_null_value(&rast[i])) {
160 f = 0.;
161 null_buf[i] = 1;
162 }
163 else
164 f = rast[i];
165
166 G_xdr_put_float(&work_buf[i], &f);
167 }
168}
169
170static void convert_double(double *work_buf, char *null_buf, const DCELL *rast,
171 int n)
172{
173 int i;
174
175 for (i = 0; i < n; i++) {
176 DCELL d;
177
178 /* substitute embedded null vals by 0's */
179 if (Rast_is_d_null_value(&rast[i])) {
180 d = 0.;
181 null_buf[i] = 1;
182 }
183 else
184 d = rast[i];
185
186 G_xdr_put_double(&work_buf[i], &d);
187 }
188}
189
190/* writes data to fcell file for either full or partial rows */
191static void put_fp_data(int fd, char *null_buf, const void *rast, int row,
192 int n, RASTER_MAP_TYPE data_type)
193{
194 struct fileinfo *fcb = &R__.fileinfo[fd];
195 int compressed = (fcb->open_mode == OPEN_NEW_COMPRESSED);
196 int size = fcb->nbytes * fcb->cellhd.cols;
197 void *work_buf;
198
199 if (row < 0 || row >= fcb->cellhd.rows)
200 return;
201
202 if (n <= 0)
203 return;
204
205 work_buf = G_malloc(size + 1);
206
207 if (compressed)
208 set_file_pointer(fd, row);
209
210 if (data_type == FCELL_TYPE)
211 convert_float(work_buf, null_buf, rast, n);
212 else
213 convert_double(work_buf, null_buf, rast, n);
214
215 if (compressed)
216 write_data_compressed(fd, row, work_buf, n, fcb->cellhd.compressed);
217 else
218 write_data(fd, row, work_buf, n);
219
221}
222
223static void convert_int(unsigned char *wk, char *null_buf, const CELL *rast,
224 int n, int len, int zeros_r_nulls)
225{
226 int i;
227
228 /* transform CELL data into non-machine dependent multi-byte format */
229
230 for (i = 0; i < n; i++) {
231 CELL v = rast[i];
232 int neg;
233 int k;
234
235 /* substitute embedded null vals by 0's */
236 if (Rast_is_c_null_value(&v)) {
237 v = 0;
238 null_buf[i] = 1;
239 }
240 else if (zeros_r_nulls && !v)
241 null_buf[i] = 1;
242
243 /* negatives */
244 if (v < 0) {
245 neg = 1;
246 v = -v;
247 }
248 else
249 neg = 0;
250
251 /* copy byte by byte */
252 for (k = len - 1; k >= 0; k--) {
253 wk[k] = v & 0xff;
254 v >>= 8;
255 }
256
257 /* set negative bit in first byte */
258 if (neg)
259 wk[0] |= 0x80;
260
261 wk += len;
262 }
263}
264
265static int count_bytes(const unsigned char *wk, int n, int len)
266{
267 int i, j;
268
269 for (i = 0; i < len - 1; i++)
270 for (j = 0; j < n; j++)
271 if (wk[j * len + i] != 0)
272 return len - i;
273
274 return 1;
275}
276
277static void trim_bytes(unsigned char *wk, int n, int slen, int trim)
278{
279 unsigned char *wk2 = wk;
280 int i, j;
281
282 for (i = 0; i < n; i++) {
283 for (j = 0; j < trim; j++)
284 wk++;
285 for (; j < slen; j++)
286 *wk2++ = *wk++;
287 }
288}
289
290static int same(const unsigned char *x, const unsigned char *y, int n)
291{
292 return (memcmp(x, y, n) == 0);
293}
294
295static int count_run(const unsigned char *src, int n, int nbytes)
296{
297 const unsigned char *cur = src + nbytes;
298 int i;
299
300 for (i = 1; i < n; i++) {
301 if (i == 255 || !same(cur, src, nbytes))
302 return i;
303
304 cur += nbytes;
305 }
306
307 return n;
308}
309
310static int rle_compress(unsigned char *dst, unsigned char *src, int n,
311 int nbytes)
312{
313 int nwrite = 0;
314 int total = nbytes * n;
315
316 while (n > 0) {
317 int count;
318
319 nwrite += nbytes + 1;
320 if (nwrite >= total)
321 return 0;
322
323 count = count_run(src, n, nbytes);
324
325 *dst++ = count;
326 memcpy(dst, src, nbytes);
327 dst += nbytes;
328
329 src += count * nbytes;
330 n -= count;
331 }
332
333 return (nwrite >= total) ? 0 : nwrite;
334}
335
336static void put_data(int fd, char *null_buf, const CELL *cell, int row, int n,
337 int zeros_r_nulls)
338{
339 struct fileinfo *fcb = &R__.fileinfo[fd];
340 int compressed = (fcb->open_mode == OPEN_NEW_COMPRESSED);
341 int len = compressed ? (int)sizeof(CELL) : fcb->nbytes;
342 unsigned char *work_buf, *wk;
344
345 if (row < 0 || row >= fcb->cellhd.rows)
346 return;
347
348 if (n <= 0)
349 return;
350
351 work_buf = G_malloc(fcb->cellhd.cols * sizeof(CELL) + 1);
352 wk = work_buf;
353
354 if (compressed)
355 set_file_pointer(fd, row);
356
357 if (compressed)
358 wk++;
359
360 convert_int(wk, null_buf, cell, n, len, zeros_r_nulls);
361
362 if (compressed) {
363 int nbytes = count_bytes(wk, n, len);
364 unsigned char *compressed_buf;
365 int total, cmax;
366
367 if (fcb->nbytes < nbytes)
368 fcb->nbytes = nbytes;
369
370 /* first trim away zero high bytes */
371 if (nbytes < len)
372 trim_bytes(wk, n, len, len - nbytes);
373
374 total = nbytes * n;
375 /* get upper bound of compressed size */
376 if (fcb->cellhd.compressed == 1)
377 cmax = total;
378 else
379 cmax = G_compress_bound(total, fcb->cellhd.compressed);
380 compressed_buf = G_malloc(cmax + 1);
381
383
384 /* then compress the data */
385 if (fcb->cellhd.compressed == 1)
386 nwrite = rle_compress(compressed_buf + 1, work_buf + 1, n, nbytes);
387 else {
388 nwrite = G_compress(work_buf + 1, total, compressed_buf + 1, cmax,
389 fcb->cellhd.compressed);
390 }
391
392 if (nwrite >= total)
393 nwrite = 0;
394
395 if (nwrite > 0) {
396 nwrite++;
397
398 if (write(fcb->data_fd, compressed_buf, nwrite) != nwrite)
400 _("Error writing compressed data for row %d of <%s>: %s"),
401 row, fcb->name, strerror(errno));
402 }
403 else {
404 nwrite = nbytes * n + 1;
405 if (write(fcb->data_fd, work_buf, nwrite) != nwrite)
407 _("Error writing compressed data for row %d of <%s>: %s"),
408 row, fcb->name, strerror(errno));
409 }
410
412 }
413 else {
414 nwrite = fcb->nbytes * n;
415
416 if (write(fcb->data_fd, work_buf, nwrite) != nwrite)
418 _("Error writing uncompressed data for row %d of <%s>: %s"),
419 row, fcb->name, strerror(errno));
420 }
421
423}
424
425static void put_data_gdal(int fd, const void *rast, int row, int n,
427{
428 struct fileinfo *fcb = &R__.fileinfo[fd];
429 int size = Rast_cell_size(map_type);
430 DCELL null_val = fcb->gdal->null_val;
431 const void *src;
432 void *work_buf, *dst;
434 CPLErr err;
435 int i;
436
437 if (row < 0 || row >= fcb->cellhd.rows)
438 return;
439
440 if (n <= 0)
441 return;
442
443 work_buf = G_malloc(n * size);
444
446 switch (map_type) {
447 case CELL_TYPE:
449 break;
450 case FCELL_TYPE:
452 break;
453 case DCELL_TYPE:
455 break;
456 }
457
458 src = rast;
459 dst = work_buf;
460
461 for (i = 0; i < n; i++) {
462 if (Rast_is_null_value(src, map_type) ||
463 (zeros_r_nulls && !*(CELL *)src))
464 Rast_set_d_value(dst, null_val, map_type);
465 else
466 memcpy(dst, src, size);
467 src = G_incr_void_ptr(src, size);
468 dst = G_incr_void_ptr(dst, size);
469 }
470
471 err = Rast_gdal_raster_IO(fcb->gdal->band, GF_Write, 0, row, n, 1, work_buf,
472 n, 1, datatype, 0, 0);
473
475
476 if (err != CE_None)
477 G_fatal_error(_("Error writing data via GDAL for row %d of <%s>"), row,
478 fcb->name);
479}
480
481static void put_raster_data(int fd, char *null_buf, const void *rast, int row,
483{
484 struct fileinfo *fcb = &R__.fileinfo[fd];
485
486 if (fcb->gdal)
487 put_data_gdal(fd, rast, row, n, zeros_r_nulls, map_type);
488 else if (map_type == CELL_TYPE)
489 put_data(fd, null_buf, rast, row, n, zeros_r_nulls);
490 else
491 put_fp_data(fd, null_buf, rast, row, n, map_type);
492}
493
494static void put_null_value_row(int fd, const char *flags)
495{
496 struct fileinfo *fcb = &R__.fileinfo[fd];
497
498 if (fcb->gdal)
500 _("GDAL output doesn't support writing null rows separately"));
501
502 if (fcb->null_fd < 0)
503 G_fatal_error(_("No null file for <%s>"), fcb->name);
504
505 Rast__convert_01_flags(flags, fcb->null_bits, fcb->cellhd.cols);
506
507 Rast__write_null_bits(fd, fcb->null_bits);
508}
509
510static void write_null_bits_compressed(const unsigned char *flags, int row,
511 size_t size, int fd)
512{
513 struct fileinfo *fcb = &R__.fileinfo[fd];
514 unsigned char *compressed_buf;
516 size_t cmax;
517 int res;
518
519 fcb->null_row_ptr[row] = lseek(fcb->null_fd, 0L, SEEK_CUR);
520 if (fcb->null_row_ptr[row] == -1) {
521 int err = errno;
522 G_fatal_error(_("File read/write operation failed: %s (%d)"),
523 strerror(err), err);
524 }
525
526 /* get upper bound of compressed size */
527 cmax = G_compress_bound(size, 3);
528 compressed_buf = G_malloc(cmax);
529
530 /* compress null bits file with LZ4, see lib/gis/compress.h */
531 nwrite = G_compress((unsigned char *)flags, size, compressed_buf, cmax, 3);
532
533 if (nwrite > 0 && (size_t)nwrite < size) {
534 if ((res = write(fcb->null_fd, compressed_buf, nwrite)) < 0 ||
535 (unsigned int)res != nwrite)
537 _("Error writing compressed null data for row %d of <%s>: %s"),
538 row, fcb->name, strerror(errno));
539 }
540 else {
541 if ((res = write(fcb->null_fd, flags, size)) < 0 ||
542 (unsigned int)res != size)
544 _("Error writing compressed null data for row %d of <%s>: %s"),
545 row, fcb->name, strerror(errno));
546 }
547
549}
550
551/*!
552 \brief Write null data
553
554 \param flags ?
555 \param row row number
556 \param col col number
557 \param fd file descriptor of cell data file
558
559 \return void
560 */
561void Rast__write_null_bits(int fd, const unsigned char *flags)
562{
563 struct fileinfo *fcb = &R__.fileinfo[fd];
564 int row = fcb->null_cur_row++;
565 off_t offset;
566 size_t size;
567 int res;
568
569 size = Rast__null_bitstream_size(fcb->cellhd.cols);
570
571 if (fcb->null_row_ptr) {
572 write_null_bits_compressed(flags, row, size, fd);
573 return;
574 }
575
576 offset = (off_t)size * row;
577
578 if (lseek(fcb->null_fd, offset, SEEK_SET) == -1)
579 G_fatal_error(_("Error writing null row %d of <%s>"), row, fcb->name);
580
581 if ((res = write(fcb->null_fd, flags, size)) < 0 ||
582 (unsigned int)res != size)
583 G_fatal_error(_("Error writing null row %d of <%s>: %s"), row,
585}
586
587static void convert_and_write_if(int fd, const void *vbuf)
588{
589 const CELL *buf = vbuf;
590 struct fileinfo *fcb = &R__.fileinfo[fd];
591 FCELL *p = (FCELL *)fcb->data;
592 int i;
593
594 for (i = 0; i < fcb->cellhd.cols; i++)
595 if (Rast_is_c_null_value(&buf[i]))
596 Rast_set_f_null_value(&p[i], 1);
597 else
598 p[i] = (FCELL)buf[i];
599
600 Rast_put_f_row(fd, p);
601}
602
603static void convert_and_write_df(int fd, const void *vbuf)
604{
605 const DCELL *buf = vbuf;
606 struct fileinfo *fcb = &R__.fileinfo[fd];
607 FCELL *p = (FCELL *)fcb->data;
608 int i;
609
610 for (i = 0; i < fcb->cellhd.cols; i++)
611 if (Rast_is_d_null_value(&buf[i]))
612 Rast_set_f_null_value(&p[i], 1);
613 else
614 p[i] = (FCELL)buf[i];
615
616 Rast_put_f_row(fd, p);
617}
618
619static void convert_and_write_id(int fd, const void *vbuf)
620{
621 const CELL *buf = vbuf;
622 struct fileinfo *fcb = &R__.fileinfo[fd];
623 DCELL *p = (DCELL *)fcb->data;
624 int i;
625
626 for (i = 0; i < fcb->cellhd.cols; i++)
627 if (Rast_is_c_null_value(&buf[i]))
628 Rast_set_d_null_value(&p[i], 1);
629 else
630 p[i] = (DCELL)buf[i];
631
632 Rast_put_d_row(fd, p);
633}
634
635static void convert_and_write_fd(int fd, const void *vbuf)
636{
637 const FCELL *buf = vbuf;
638 struct fileinfo *fcb = &R__.fileinfo[fd];
639 DCELL *p = (DCELL *)fcb->data;
640 int i;
641
642 for (i = 0; i < fcb->cellhd.cols; i++)
643 if (Rast_is_f_null_value(&buf[i]))
644 Rast_set_d_null_value(&p[i], 1);
645 else
646 p[i] = (DCELL)buf[i];
647
648 Rast_put_d_row(fd, p);
649}
650
651static void convert_and_write_fi(int fd, const void *vbuf)
652{
653 const FCELL *buf = vbuf;
654 struct fileinfo *fcb = &R__.fileinfo[fd];
655 CELL *p = (CELL *)fcb->data;
656 int i;
657
658 for (i = 0; i < fcb->cellhd.cols; i++)
659 if (Rast_is_f_null_value(&buf[i]))
660 Rast_set_c_null_value(&p[i], 1);
661 else
662 p[i] = (CELL)buf[i];
663
664 Rast_put_c_row(fd, p);
665}
666
667static void convert_and_write_di(int fd, const void *vbuf)
668{
669 const DCELL *buf = vbuf;
670 struct fileinfo *fcb = &R__.fileinfo[fd];
671 CELL *p = (CELL *)fcb->data;
672 int i;
673
674 for (i = 0; i < fcb->cellhd.cols; i++)
675 if (Rast_is_d_null_value(&buf[i]))
676 Rast_set_c_null_value(&p[i], 1);
677 else
678 p[i] = (CELL)buf[i];
679
680 Rast_put_c_row(fd, p);
681}
682
683/*!
684 \brief converts a buffer of zero's and ones to bitstream.
685
686 Stores this bitstream in memory. (the null rows from memory are
687 written into null file after the limit is reached, and the place for
688 new null rows to be kept in memory is freed. Should not be used by
689 application programs.
690
691 \param fd file descriptor where data is to be written
692 \param buf buffer holding null data
693
694 \return void
695 */
696static void put_raster_row(int fd, const void *buf, RASTER_MAP_TYPE data_type,
697 int zeros_r_nulls)
698{
699 static void (*convert_and_write_FtypeOtype[3][3])(int, const void *) = {
700 {NULL, convert_and_write_if, convert_and_write_id},
701 {convert_and_write_fi, NULL, convert_and_write_fd},
702 {convert_and_write_di, convert_and_write_df, NULL}};
703 struct fileinfo *fcb = &R__.fileinfo[fd];
704 char *null_buf;
705
706 switch (fcb->open_mode) {
707 case OPEN_OLD:
708 G_fatal_error(_("put_raster_row: raster map <%s> not open for write - "
709 "request ignored"),
710 fcb->name);
711 break;
714 break;
715 default:
717 _("put_raster_row: unopened file descriptor - request ignored"));
718 break;
719 }
720
721 if (fcb->map_type != data_type) {
722 convert_and_write_FtypeOtype[data_type][fcb->map_type](fd, buf);
723 return;
724 }
725
726 null_buf = G_malloc(fcb->cellhd.cols);
727 G_zero(null_buf, fcb->cellhd.cols);
728
729 put_raster_data(fd, null_buf, buf, fcb->cur_row, fcb->cellhd.cols,
730 zeros_r_nulls, data_type);
731
732 /* only for integer maps */
733 if (data_type == CELL_TYPE) {
734 if (fcb->want_histogram)
735 Rast_update_cell_stats(buf, fcb->cellhd.cols, &fcb->statf);
736 Rast__row_update_range(buf, fcb->cellhd.cols, &fcb->range,
738 }
739 else
740 Rast_row_update_fp_range(buf, fcb->cellhd.cols, &fcb->fp_range,
741 data_type);
742
743 fcb->cur_row++;
744
745 /* write the null row for the data row */
746 if (!fcb->gdal)
747 put_null_value_row(fd, null_buf);
748
750}
#define OPEN_NEW_COMPRESSED
Definition R.h:102
#define OPEN_NEW_UNCOMPRESSED
Definition R.h:103
#define OPEN_OLD
Definition R.h:101
#define NULL
Definition ccmath.h:32
AMI_err name(char **stream_name)
Definition ami_stream.h:426
struct compressor_list compressor[]
Definition compress.h:53
void G_xdr_put_float(void *, const float *)
Definition gis/xdr.c:84
void G_zero(void *, int)
Zero out a buffer, buf, of length i.
Definition gis/zero.c:23
void G_free(void *)
Free allocated memory.
Definition gis/alloc.c:147
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
#define G_malloc(n)
Definition defs/gis.h:139
int G_compress(unsigned char *, int, unsigned char *, int, int)
Definition compress.c:218
void G_xdr_put_double(void *, const double *)
Definition gis/xdr.c:94
int G_write_compressed(int, unsigned char *, int, int)
Definition compress.c:323
#define G_incr_void_ptr(ptr, size)
Definition defs/gis.h:81
int G_compress_bound(int, int)
Definition compress.c:202
int Rast_is_null_value(const void *, RASTER_MAP_TYPE)
To check if a raster value is set to NULL.
Definition null_val.c:176
void Rast__row_update_range(const CELL *, int, struct Range *, int)
Update range structure based on raster row.
int Rast__null_bitstream_size(int)
Determines null bitstream size.
Definition alloc_cell.c:146
#define Rast_is_f_null_value(fcellVal)
void Rast_set_d_null_value(DCELL *, int)
To set a number of DCELL raster values to NULL.
Definition null_val.c:153
void Rast_set_f_null_value(FCELL *, int)
To set a number of FCELL raster values to NULL.
Definition null_val.c:138
void Rast__convert_01_flags(const char *, unsigned char *, int)
?
Definition null_val.c:420
void Rast_set_d_value(void *, DCELL, RASTER_MAP_TYPE)
Places a DCELL raster value.
void Rast_set_c_null_value(CELL *, int)
To set a number of CELL raster values to NULL.
Definition null_val.c:124
int Rast_update_cell_stats(const CELL *, int, struct Cell_stats *)
Add data to cell stats.
Definition cell_stats.c:62
size_t Rast_cell_size(RASTER_MAP_TYPE)
Returns size of a raster cell in bytes.
Definition alloc_cell.c:37
#define Rast_is_d_null_value(dcellVal)
#define Rast_is_c_null_value(cellVal)
void Rast_row_update_fp_range(const void *, int, struct FPRange *, RASTER_MAP_TYPE)
Update range structure based on raster row (floating-point)
Header file for msvc/fcntl.c.
CPLErr Rast_gdal_raster_IO(GDALRasterBandH band, GDALRWFlag rw_flag, int x_off, int y_off, int x_size, int y_size, void *buffer, int buf_x_size, int buf_y_size, GDALDataType buf_type, int pixel_size, int line_size)
Input/output function for GDAL links.
Definition gdal.c:427
float FCELL
Definition gis.h:636
double DCELL
Definition gis.h:635
int CELL
Definition gis.h:634
#define _(str)
Definition glocale.h:10
int count
void Rast_put_d_row(int fd, const DCELL *buf)
Writes the next row for dcell file (DCELL version)
void Rast_put_row(int fd, const void *buf, RASTER_MAP_TYPE data_type)
Writes the next row for cell/fcell/dcell file.
void Rast__write_null_bits(int fd, const unsigned char *flags)
Write null data.
void Rast_put_f_row(int fd, const FCELL *buf)
Writes the next row for fcell file (FCELL version)
void Rast_put_c_row(int fd, const CELL *buf)
Writes the next row for cell file (CELL version)
#define FCELL_TYPE
Definition raster.h:12
#define DCELL_TYPE
Definition raster.h:13
#define CELL_TYPE
Definition raster.h:11
int RASTER_MAP_TYPE
Definition raster.h:25
Definition R.h:82
struct fileinfo * fileinfo
Definition R.h:96
Definition R.h:48
RASTER_MAP_TYPE map_type
Definition R.h:67
int nbytes
Definition R.h:66
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)
#define write
Definition unistd.h:6