GRASS 8 Programmer's Manual 8.6.0dev(2026)-f6f2c534ea
Loading...
Searching...
No Matches
vector/Vlib/rewind.c
Go to the documentation of this file.
1/*!
2 \file lib/vector/Vlib/rewind.c
3
4 \brief Vector library - rewind data
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 \author Level 3 by Martin Landa <landa.martin gmail.com>
16 */
17
18#include <grass/vector.h>
19#include <grass/glocale.h>
20
21static int rew_dummy(struct Map_info *Map UNUSED)
22{
23 return -1;
24}
25
26#if !defined HAVE_POSTGRES
27static int format(struct Map_info *Map UNUSED)
28{
29 G_fatal_error(_("Requested format is not compiled in this version"));
30 return 0;
31}
32#endif
33
34static int (*Rewind_array[][4])(struct Map_info *) = {
35 {rew_dummy, V1_rewind_nat, V2_rewind_nat, rew_dummy},
36 {rew_dummy, V1_rewind_ogr, V2_rewind_ogr, rew_dummy},
37 {rew_dummy, V1_rewind_ogr, V2_rewind_ogr, rew_dummy}
38#ifdef HAVE_POSTGRES
39 ,
41#else
42 ,
43 {rew_dummy, format, format, rew_dummy}
44#endif
45};
46
47/*!
48 \brief Rewind vector map to cause reads to start at beginning
49
50 \param Map pointer to Map_info structure
51
52 \return 0 on success
53 \return -1 on error
54 */
56{
57 if (!VECT_OPEN(Map))
58 return -1;
59
60 G_debug(1, "Vect_Rewind(): name = %s level = %d", Map->name, Map->level);
61
62 return (*Rewind_array[Map->format][Map->level])(Map);
63}
AMI_err name(char **stream_name)
Definition ami_stream.h:426
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
int V2_rewind_ogr(struct Map_info *)
Rewind vector map (OGR layer) to cause reads to start at beginning on topological level (level 2)
Definition rewind_ogr.c:54
int V2_rewind_nat(struct Map_info *)
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 *)
Rewind vector map to cause reads to start at beginning on non-topological level (level 1) - native fo...
Definition rewind_nat.c:27
int V1_rewind_pg(struct Map_info *)
Rewind vector map (PostGIS layer) to cause reads to start at beginning (level 1)
Definition rewind_pg.c:34
int V1_rewind_ogr(struct Map_info *)
Rewind vector map (OGR layer) to cause reads to start at beginning (level 1)
Definition rewind_ogr.c:30
int V2_rewind_pg(struct Map_info *)
Rewind vector map (PostGIS layer) to cause reads to start at beginning on topological level (level 2)
Definition rewind_pg.c:70
#define VECT_OPEN(Map)
Check if vector map is open.
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
Definition gis.h:46
#define _(str)
Definition glocale.h:10
Vector map info.
int format
Map format (native, ogr, postgis)
int Vect_rewind(struct Map_info *Map)
Rewind vector map to cause reads to start at beginning.