Previous: Doubly linked ordered list of size_t, Up: Linked lists [Contents][Index]
gal_data_t
Gnuastro’s generic data container has a next
element which enables
it to be used as a singly-linked list (see Generic data container (gal_data_t
)). The ability to connect the different data containers offers
great advantages. For example each column in a table in an independent
dataset: with its own name, units, numeric data type (see Numeric data types). Another application is in Tessellating an input dataset into
separate tiles or only studying particular regions, or tiles, of a larger
dataset (see Tessellation and Tessellation library (tile.h)). Each
independent tile over the dataset can be connected to the others as a
linked list and thus any number of tiles can be represented with one
variable.
**list
, gal_data_t *newnode
)Add an already allocated dataset (newnode
) to top of
list
. Note that if newnode->next!=NULL
(newnode
is
itself a list), then list
will be added to its end.
In this example multiple images are linked together as a list:
int quietmmap=1; size_t minmapsize=-1; gal_data_t *tmp, *list=NULL; tmp = gal_fits_img_read("file1.fits", "1", minmapsize, quietmmap); gal_list_data_add( &list, tmp ); tmp = gal_fits_img_read("file2.fits", "1", minmapsize, quietmmap); gal_list_data_add( &list, tmp );
**list
, void *array
, uint8_t type
, size_t ndim
, size_t *dsize
, struct wcsprm *wcs
, int clear
, size_t minmapsize
, int quietmmap
, char *name
, char *unit
, char *comment
)Allocate a new dataset (with gal_data_alloc
in Dataset allocation) and put it as the first element of list
. Note that if
this is the first node to be added to the list, list
must be
NULL
.
**list
)Pop the top node from list
and return it.
**list
)Reverse the order of the list such that the top node in the list before calling this function becomes the bottom node after it.
*list
, size_t *num
)Allocate and return an array of gal_data_t *
pointers with the same
number of elements as the nodes in list
. The pointers will be put in
the same order that the list is parsed. Hence the N-th element in the array
will point to the same dataset that the N-th node in the list points to.
*list
)Return the number of nodes in list
.
*list
)Return a pointer to the last node in list
.
*list
)Free all the datasets in list
along with all the allocated spaces in
each.
Previous: Doubly linked ordered list of size_t, Up: Linked lists [Contents][Index]
GNU Astronomy Utilities 0.13 manual, September 2020.