GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-bea8435a9e
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 (void)
 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().

◆ 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 69 of file map_list.c.

References G_free(), and NULL.

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 103 of file map_list.c.

References G_realloc.

◆ 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 133 of file map_list.c.

◆ tgis_new_map_list()

tgisMapList* tgis_new_map_list ( void  )

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 54 of file map_list.c.

References G_malloc, list, NULL, and tgis_init_map_list().