/src/gdal/frmts/pcraster/libcsf/setmv.c
Line | Count | Source |
1 | | #include "csf.h" |
2 | | #include "csfimpl.h" |
3 | | |
4 | | /* set a memory location to a missing value |
5 | | * SetMV sets a memory location to a missing value |
6 | | * (using the application cell representation). |
7 | | * SetMV is quite slow but handy as in the example |
8 | | * below. In general one should use assignment for |
9 | | * integers (e.g. v = MV_UINT1) or the macro's |
10 | | * SET_MV_REAL4 and SET_MV_REAL8 |
11 | | * |
12 | | * EXAMPLE |
13 | | * .so examples/border.tr |
14 | | */ |
15 | | void SetMV( |
16 | | const MAP *m, /* map handle */ |
17 | | void *c) /* write-only. location set to missing value */ |
18 | 0 | { |
19 | 0 | SetMVcellRepr(m->appCR, c); |
20 | 0 | } |
21 | | |
22 | | /* set a memory location to a missing value |
23 | | * SetMVcellRepr sets a memory location to a missing value |
24 | | * (using the application cell representation). |
25 | | * In general one should use assignment for |
26 | | * integers (e.g. v = MV_UINT1) or the macro's |
27 | | * SET_MV_REAL4 and SET_MV_REAL8 |
28 | | * |
29 | | */ |
30 | | void SetMVcellRepr( |
31 | | CSF_CR cellRepr, /* cell representation, one of the CR_* constants */ |
32 | | void *c) /* write-only. location set to missing value */ |
33 | 0 | { |
34 | 0 | switch (cellRepr) |
35 | 0 | { |
36 | 0 | case CR_INT1 : *((INT1 *)c) = MV_INT1; |
37 | 0 | break; |
38 | 0 | case CR_INT2 : *((INT2 *)c) = MV_INT2; |
39 | 0 | break; |
40 | 0 | case CR_INT4 : *((INT4 *)c) = MV_INT4; |
41 | 0 | break; |
42 | 0 | case CR_UINT1 : *((UINT1 *)c) = MV_UINT1; |
43 | 0 | break; |
44 | 0 | case CR_UINT2 : *((UINT2 *)c) = MV_UINT2; |
45 | 0 | break; |
46 | 0 | case CR_REAL8 : |
47 | 0 | ((UINT4 *)c)[1] = MV_UINT4; |
48 | 0 | *((UINT4 *)c) = MV_UINT4; |
49 | 0 | break; |
50 | 0 | default : POSTCOND( |
51 | 0 | cellRepr == CR_REAL4 || |
52 | 0 | cellRepr == CR_UINT4 ); |
53 | 0 | *((UINT4 *)c) = MV_UINT4; |
54 | 0 | } |
55 | 0 | } |