GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
segment.h
Go to the documentation of this file.
1 #ifndef GRASS_SEGMENT_H
2 #define GRASS_SEGMENT_H
3 
4 #include <grass/gis.h>
5 
6 #ifdef HAVE_UNISTD_H
7 #include <unistd.h>
8 #endif
9 
10 #ifdef HAVE_SYS_TYPES_H
11 #include <sys/types.h>
12 #endif
13 
14 struct aq { /* age queue */
15  int cur; /* segment number */
16  struct aq *younger, *older; /* pointer to next younger and next older */
17 } ;
18 
19 typedef struct
20 {
21  int open; /* open flag */
22  off_t nrows; /* rows in original data */
23  off_t ncols; /* cols in original data */
24  int len; /* bytes per data value */
25  int srows; /* rows in segments */
26  int scols; /* cols in segments */
27  int srowscols; /* rows x cols in segments */
28  int size; /* size in bytes of a segment */
29  int spr; /* segments per row */
30  int spill; /* cols in last segment in row */
31 
32  /* fast mode */
33  int fast_adrs; /* toggles fast address mode */
34  off_t scolbits; /* column bitshift */
35  off_t srowbits; /* row bitshift */
36  off_t segbits; /* segment bitshift */
37  int fast_seek; /* toggles fast seek mode */
38  int lenbits; /* data size bitshift */
39  int sizebits; /* segment size bitshift */
40  int (*address)();
41  int (*seek)();
42 
43  char *fname; /* segment file name */
44  int fd; /* file descriptor to read/write segment */
45  struct scb /* control blocks */
46  {
47  char *buf; /* data buffer */
48  char dirty; /* dirty flag */
49  struct aq *age; /* pointer to position in age queue */
50  int n; /* segment number */
51  } *scb;
52  int *load_idx; /* index of loaded segments */
53  int nfreeslots; /* number of free slots */
54  int *freeslot; /* array of free slots */
55  struct aq *agequeue, /* queue of age for order of access */
56  *youngest, /* youngest in age queue */
57  *oldest; /* oldest in age queue */
58  int nseg; /* number of segments in memory */
59  int cur; /* last accessed segment */
60  int offset; /* offset of data past header */
61 
62  char *cache; /* all in memory cache */
63 } SEGMENT;
64 
65 #include <grass/defs/segment.h>
66 
67 #endif /* GRASS_SEGMENT_H */
int fd
Definition: segment.h:44
int nseg
Definition: segment.h:58
int offset
Definition: segment.h:60
int open
Definition: segment.h:21
off_t srowbits
Definition: segment.h:35
off_t scolbits
Definition: segment.h:34
char * address
Definition: la.h:50
int len
Definition: segment.h:24
int spill
Definition: segment.h:30
int cur
Definition: segment.h:59
int size
Definition: segment.h:28
int lenbits
Definition: segment.h:38
Definition: segment.h:14
int * load_idx
Definition: segment.h:52
struct aq * age
Definition: segment.h:49
char * buf
Definition: segment.h:47
int fast_adrs
Definition: segment.h:33
struct aq * younger
Definition: segment.h:16
struct aq * older
Definition: segment.h:16
char * fname
Definition: segment.h:43
off_t ncols
Definition: segment.h:23
off_t nrows
Definition: segment.h:22
char dirty
Definition: segment.h:48
off_t segbits
Definition: segment.h:36
int sizebits
Definition: segment.h:39
char * cache
Definition: segment.h:62
int srowscols
Definition: segment.h:27
int srows
Definition: segment.h:25
struct aq * youngest
Definition: segment.h:55
int spr
Definition: segment.h:29
int scols
Definition: segment.h:26
int * freeslot
Definition: segment.h:54
int cur
Definition: segment.h:15
int fast_seek
Definition: segment.h:37
int nfreeslots
Definition: segment.h:53