GNU Astronomy Utilities



12.3.8.6 List of size_t and double

The list structure below is useful when you need to keep floating point values and indices (most common usage of size_t in Gnuastro) together within a higher-level program.

Type (C struct): gal_list_sizetf64_t

Each node in this singly-linked list contains a size_t value and a floating point value with a type of double-precision floating point.

typedef struct gal_list_sizetf64_t
{
  size_t i;
  double v;
  struct gal_list_sizetf64_t *next;
} gal_list_sizetf64_t;
Function:
void
gal_list_sizetf64_add (gal_list_sizetf64_t **list, size_t index, double value)

Allocate space for a new node in list, to store the index and value into it. As a simply-linked list, the added node will be placed at the top of the list.

Function:
void
gal_list_sizetf64_pop (gal_list_sizetf64_t **list, size_t *index, double *value)

Pop a node from the top of list, return the node’s index and value in the respective places that index and value point to. This function will also free the allocated space for the popped node and after this function, list will point to the next node (which has a larger tosort element).

Function:
void
gal_list_sizetf64_free (gal_list_sizetf64_t **list)

Free any element within the input list.

Type (C struct): gal_list_sizetsizetf64_t

Each node in this singly-linked list contains a size_t value and a floating point value with a type of double-precision floating point.