GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72735
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vector/Vlib/list.c File Reference

Vector library - list definition. More...

#include <stdlib.h>
#include <grass/vector.h>
Include dependency graph for vector/Vlib/list.c:

Go to the source code of this file.

Functions

struct ilistVect_new_list (void)
 Creates and initializes a struct ilist. More...
 
int Vect_reset_list (struct ilist *list)
 Reset ilist structure. More...
 
void Vect_destroy_list (struct ilist *list)
 Frees all memory associated with a struct ilist, including the struct itself. More...
 
int Vect_list_append (struct ilist *list, int val)
 Append new item to the end of list if not yet present. More...
 
int Vect_list_append_list (struct ilist *alist, const struct ilist *blist)
 Append new items to the end of list if not yet present. More...
 
int Vect_list_delete (struct ilist *list, int val)
 Remove a given value (item) from list. More...
 
int Vect_list_delete_list (struct ilist *alist, const struct ilist *blist)
 Delete list from existing list. More...
 
int Vect_val_in_list (const struct ilist *list, int val)
 Find a given item in the list. More...
 
struct boxlistVect_new_boxlist (int have_boxes)
 Creates and initializes a struct boxlist. More...
 
int Vect_reset_boxlist (struct boxlist *list)
 Reset boxlist structure. More...
 
void Vect_destroy_boxlist (struct boxlist *list)
 Frees all memory associated with a struct boxlist, including the struct itself. More...
 
int Vect_boxlist_append (struct boxlist *list, int id, const struct bound_box *box)
 Append new item to the end of list if not yet present. More...
 
int Vect_boxlist_append_boxlist (struct boxlist *alist, const struct boxlist *blist)
 Append new items to the end of list if not yet present. More...
 
int Vect_boxlist_delete (struct boxlist *list, int id)
 Remove a given value (item) from list. More...
 
int Vect_boxlist_delete_boxlist (struct boxlist *alist, const struct boxlist *blist)
 Delete list from existing list. More...
 
int Vect_val_in_boxlist (const struct boxlist *list, int id)
 Find a given item in the list. More...
 

Detailed Description

Vector library - list definition.

Higher level functions for reading/writing/manipulating vectors.

(C) 2001-2009 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Original author CERL, probably Dave Gerdes or Mike Higgins.
Update to GRASS 5.7 Radim Blazek and David D. Gray
Update to GRASS 7 Markus Metz

Definition in file vector/Vlib/list.c.

Function Documentation

int Vect_boxlist_append ( struct boxlist list,
int  id,
const struct bound_box box 
)

Append new item to the end of list if not yet present.

Parameters
[in,out]listpointer to ilist structure
idnew item to append to the end of list
boxbounding box
Returns
0 on success
1 on error

Definition at line 288 of file vector/Vlib/list.c.

References boxlist::alloc_values, boxlist::box, boxlist::have_boxes, boxlist::id, boxlist::n_values, and NULL.

Referenced by Vect_boxlist_append_boxlist().

int Vect_boxlist_append_boxlist ( struct boxlist alist,
const struct boxlist blist 
)

Append new items to the end of list if not yet present.

Parameters
[in,out]alistpointer to boxlist structure where items will be appended
blistpointer to boxlist structure with new items
Returns
0 on success
1 on error

Definition at line 330 of file vector/Vlib/list.c.

References bound_box::B, boxlist::box, bound_box::E, boxlist::have_boxes, boxlist::id, bound_box::N, boxlist::n_values, NULL, bound_box::S, bound_box::T, Vect_boxlist_append(), and bound_box::W.

int Vect_boxlist_delete ( struct boxlist list,
int  id 
)

Remove a given value (item) from list.

Parameters
[in,out]listpointer to boxlist structure
idto remove
Returns
0 on success
1 on error

Definition at line 361 of file vector/Vlib/list.c.

References boxlist::box, boxlist::have_boxes, boxlist::id, boxlist::n_values, and NULL.

Referenced by Vect_boxlist_delete_boxlist().

int Vect_boxlist_delete_boxlist ( struct boxlist alist,
const struct boxlist blist 
)

Delete list from existing list.

Parameters
[in,out]alistpointer to original boxlist structure,
blistpointer to boxlist structure with items to delete
Returns
0 on success
1 on error

Definition at line 393 of file vector/Vlib/list.c.

References boxlist::id, boxlist::n_values, NULL, and Vect_boxlist_delete().

void Vect_destroy_boxlist ( struct boxlist list)

Frees all memory associated with a struct boxlist, including the struct itself.

Parameters
[in,out]listpointer to ilist structure

Definition at line 265 of file vector/Vlib/list.c.

References boxlist::alloc_values, boxlist::box, G_free(), boxlist::id, and NULL.

Referenced by Vect_find_line_list(), Vect_net_build_graph(), Vect_net_ttb_build_graph(), Vect_net_ttb_shortest_path(), Vect_overlay_and(), Vect_snap_line(), and Vedit_render_map().

void Vect_destroy_list ( struct ilist list)

Frees all memory associated with a struct ilist, including the struct itself.

Parameters
[in,out]listpointer to ilist structure

Definition at line 70 of file vector/Vlib/list.c.

References ilist::alloc_values, G_free(), NULL, and ilist::value.

Referenced by NetA_betweenness_closeness(), Vect_find_line(), Vect_merge_lines(), Vect_overlay_and(), Vect_remove_small_areas_nat(), Vect_snap_lines(), Vect_topo_check(), Vedit_connect_lines(), Vedit_delete_area(), Vedit_extend_lines(), Vedit_select_by_query(), and Vedit_split_lines().

int Vect_list_append_list ( struct ilist alist,
const struct ilist blist 
)

Append new items to the end of list if not yet present.

Parameters
[in,out]alistpointer to ilist structure where items will be appended
blistpointer to ilist structure with new items
Returns
0 on success
1 on error

Definition at line 124 of file vector/Vlib/list.c.

References ilist::n_values, NULL, ilist::value, and Vect_list_append().

int Vect_list_delete ( struct ilist list,
int  val 
)

Remove a given value (item) from list.

Parameters
[in,out]listpointer to ilist structure
valto remove
Returns
0 on success
1 on error

Definition at line 146 of file vector/Vlib/list.c.

References ilist::n_values, NULL, and ilist::value.

Referenced by Vect_list_delete_list().

int Vect_list_delete_list ( struct ilist alist,
const struct ilist blist 
)

Delete list from existing list.

Parameters
[in,out]alistpointer to original ilist structure,
blistpointer to ilist structure with items to delete
Returns
0 on success
1 on error

Definition at line 175 of file vector/Vlib/list.c.

References ilist::n_values, NULL, ilist::value, and Vect_list_delete().

struct boxlist* Vect_new_boxlist ( int  have_boxes)

Creates and initializes a struct boxlist.

This structure is used as container for bounding boxes with id. The library routines handle all memory allocation.

Parameters
have_boxesif set to 0, the list will hold only ids and no boxes
Returns
pointer to struct boxlist
NULL on error

Definition at line 225 of file vector/Vlib/list.c.

References boxlist::alloc_values, boxlist::box, boxlist::have_boxes, boxlist::id, boxlist::n_values, and NULL.

Referenced by Vect_attach_centroids(), Vect_attach_isles(), Vect_find_area(), Vect_find_island(), Vect_find_line_list(), Vect_isle_find_area(), Vect_net_build_graph(), Vect_net_ttb_build_graph(), Vect_net_ttb_shortest_path(), Vect_overlay_and(), Vect_remove_duplicates(), Vect_select_lines_by_polygon(), Vect_snap_line(), and Vedit_render_map().

struct ilist* Vect_new_list ( void  )

Creates and initializes a struct ilist.

This structure is used as container for integer values. The library routines handle all memory allocation.

Returns
pointer to struct ilist
NULL on error

Definition at line 32 of file vector/Vlib/list.c.

References ilist::alloc_values, ilist::n_values, NULL, and ilist::value.

Referenced by NetA_betweenness_closeness(), Vect_find_line(), Vect_find_node(), Vect_merge_lines(), Vect_overlay_and(), Vect_remove_small_areas_ext(), Vect_remove_small_areas_nat(), Vect_select_areas_by_polygon(), Vect_snap_lines(), Vect_topo_check(), Vect_write_ascii(), Vedit_connect_lines(), Vedit_delete_area(), Vedit_extend_lines(), Vedit_merge_lines(), Vedit_select_by_query(), and Vedit_split_lines().

int Vect_reset_boxlist ( struct boxlist list)

Reset boxlist structure.

To make sure boxlist structure is clean to be re-used. List must have previously been created with Vect_new_boxlist().

Parameters
[in,out]listpointer to struct boxlist
Returns
0

Definition at line 252 of file vector/Vlib/list.c.

References boxlist::n_values.

Referenced by Vect_remove_duplicates(), Vect_select_lines_by_box(), and Vect_snap_line().

int Vect_val_in_boxlist ( const struct boxlist list,
int  id 
)

Find a given item in the list.

Parameters
listpointer to boxlist structure
idvalue of item
Returns
1 if an item is found
0 no found item in the list

Definition at line 415 of file vector/Vlib/list.c.

References boxlist::id, boxlist::n_values, and NULL.

int Vect_val_in_list ( const struct ilist list,
int  val 
)

Find a given item in the list.

Parameters
listpointer to ilist structure
valvalue of item
Returns
1 if an item is found
0 no found item in the list

Definition at line 197 of file vector/Vlib/list.c.

References ilist::n_values, NULL, and ilist::value.

Referenced by Vect_find_line_list(), Vect_overlay_and(), Vedit_merge_lines(), and Vedit_select_by_query().