GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
map_list.c File Reference
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/temporal.h>
Include dependency graph for map_list.c:

Go to the source code of this file.

Functions

void tgis_free_map_list (tgisMapList *list)
 Free allocated memory of an integer list. More...
 
tgisMapListtgis_new_map_list ()
 Return a new integer list. More...
 
void tgis_init_map_list (tgisMapList *list)
 Init a tgisMapList and free allocated memory. More...
 
void tgis_map_list_add (tgisMapList *list, tgisMap *map)
 Add a map to tgisMapList. More...
 
void tgis_map_list_insert (tgisMapList *list, char *name, char *mapset, struct TimeStamp *ts)
 Insert map information into tgisMapList. More...
 

Function Documentation

◆ tgis_free_map_list()

void tgis_free_map_list ( tgisMapList list)

Free allocated memory of an integer list.

Parameters
listThe pointer to an integer list

Definition at line 28 of file map_list.c.

References G_free(), _tgisMap::mapset, _tgisMapList::n_values, _tgisMap::name, and _tgisMapList::values.

◆ tgis_init_map_list()

void tgis_init_map_list ( tgisMapList list)

Init a tgisMapList and free allocated memory.

Parameters
listThe pointer to a tgisMapList

Definition at line 67 of file map_list.c.

References _tgisMapList::alloc_values, G_free(), _tgisMap::mapset, _tgisMapList::n_values, _tgisMap::name, NULL, and _tgisMapList::values.

Referenced by tgis_new_map_list().

◆ tgis_map_list_add()

void tgis_map_list_add ( tgisMapList list,
tgisMap map 
)

Add a map to tgisMapList.

This function adds a tgisMap to the list but does not check for duplicates. In case reallocation fails, G_fatal_error() will be invoked by the allocation function.

The content of the map will not be copied, the pointer to the map will be stored.

Parameters
listThe tgisMapList pointer
mapA pointer to a tgisMap struct that should be added

Definition at line 100 of file map_list.c.

References _tgisMapList::alloc_values, G_realloc, _tgisMapList::n_values, and _tgisMapList::values.

◆ tgis_map_list_insert()

void tgis_map_list_insert ( tgisMapList list,
char *  name,
char *  mapset,
struct TimeStamp ts 
)

Insert map information into tgisMapList.

This function allocates a tgisMap, fills it with the provided information and adds it to the list. In case allocation fails, G_fatal_error() will be invoked by the allocation function.

All arguments are deep copied to the new allocated tgisMap struct.

Parameters
listThe tgisMapList pointer
nameThe name of the map
mapsetThe name of the mapset
tsA pointer to the timestamp of the map

Definition at line 130 of file map_list.c.

◆ tgis_new_map_list()

tgisMapList* tgis_new_map_list ( )

Return a new integer list.

G_fatal_error() will be invoked by the allocation function.

Returns
list The pointer to a new allocated integer list

Definition at line 53 of file map_list.c.

References G_malloc, list, NULL, tgis_init_map_list(), and _tgisMapList::values.