GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
rewind_nat.c
Go to the documentation of this file.
1 /*!
2  \file lib/vector/Vlib/rewind.c
3 
4  \brief Vector library - rewind data (native format)
5 
6  Higher level functions for reading/writing/manipulating vectors.
7 
8  (C) 2001-2009, 2011-2012 by the GRASS Development Team
9 
10  This program is free software under the GNU General Public License
11  (>=v2). Read the file COPYING that comes with GRASS for details.
12 
13  \author Original author CERL, probably Dave Gerdes or Mike Higgins.
14  \author Update to GRASS 5.7 Radim Blazek and David D. Gray.
15  */
16 
17 #include <grass/vector.h>
18 
19 /*! \brief Rewind vector map to cause reads to start at beginning on
20  non-topological level (level 1) - native format - internal use only
21 
22  \param Map pointer to Map_info struct
23 
24  \return 0 on success
25  \return -1 on error
26  */
27 int V1_rewind_nat(struct Map_info *Map)
28 {
29  return dig_fseek(&(Map->dig_fp), Map->head.head_size, SEEK_SET);
30 }
31 
32 /*! \brief Rewind vector map to cause reads to start at beginning on
33  topological level (level 2) - native format - internal use only
34 
35  \param Map pointer to Map_info struct
36 
37  \return 0 on success
38  \return -1 on error
39  */
40 int V2_rewind_nat(struct Map_info *Map)
41 {
42  Map->next_line = 1;
43  return V1_rewind_nat(Map); /* make sure level 1 reads are reset too */
44 }
int dig_fseek(struct gvfile *file, off_t offset, int whence)
Set struct gvfile position.
Definition: file.c:60
int V2_rewind_nat(struct Map_info *Map)
Rewind vector map to cause reads to start at beginning on topological level (level 2) - native format...
Definition: rewind_nat.c:40
int V1_rewind_nat(struct Map_info *Map)
Rewind vector map to cause reads to start at beginning on non-topological level (level 1) - native fo...
Definition: rewind_nat.c:27
Vector map info.
Definition: dig_structs.h:1243
struct gvfile dig_fp
GV file pointer (native format only)
Definition: dig_structs.h:1395
struct dig_head head
Header info.
Definition: dig_structs.h:1388
plus_t next_line
Feature id for sequential access.
Definition: dig_structs.h:1338
long head_size
Coor header size.
Definition: dig_structs.h:348