libcstl
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions
dlist.h File Reference

Go to the source code of this file.

Data Structures

struct  cstl_dlist_node
 Node to anchor an element within a list. More...
 
struct  cstl_dlist
 List object. More...
 

Macros

#define CSTL_DLIST_INITIALIZER(NAME, TYPE, MEMB)
 Constant initialization of a list object.
 
#define DECLARE_CSTL_DLIST(NAME, TYPE, MEMB)
 (Statically) declare and initialize a list
 

Enumerations

enum  cstl_dlist_foreach_dir_t { CSTL_DLIST_FOREACH_DIR_FWD , CSTL_DLIST_FOREACH_DIR_REV }
 The direction in which to traverse the list during cstl_dlist_foreach() More...
 

Functions

static void cstl_dlist_init (struct cstl_dlist *const l, const size_t off)
 Initialize a list object.
 
static size_t cstl_dlist_size (const struct cstl_dlist *const l)
 Get the number of objects in the list.
 
void cstl_dlist_insert (struct cstl_dlist *l, void *before, void *obj)
 Insert a new object into the list.
 
void cstl_dlist_erase (struct cstl_dlist *l, void *obj)
 Remove an object from the list.
 
void * cstl_dlist_front (struct cstl_dlist *l)
 Get a pointer to the first object in the list.
 
void * cstl_dlist_back (struct cstl_dlist *l)
 Get a pointer to the last object in the list.
 
void cstl_dlist_push_front (struct cstl_dlist *l, void *obj)
 Insert a new object at the front of the list.
 
void cstl_dlist_push_back (struct cstl_dlist *l, void *obj)
 Insert a new object at the back of the list.
 
void * cstl_dlist_pop_front (struct cstl_dlist *l)
 Remove the first item in the list and return it.
 
void * cstl_dlist_pop_back (struct cstl_dlist *l)
 Remove the last item in the list and return it.
 
void cstl_dlist_reverse (struct cstl_dlist *l)
 Reverse the order of items in the list.
 
void cstl_dlist_sort (struct cstl_dlist *l, cstl_compare_func_t *cmp, void *priv)
 Sort the items in a list.
 
void cstl_dlist_concat (struct cstl_dlist *list, struct cstl_dlist *more)
 Append one list to the end of another.
 
int cstl_dlist_foreach (struct cstl_dlist *l, cstl_visit_func_t *visit, void *priv, cstl_dlist_foreach_dir_t dir)
 Call a user-supplied function for each object in a list.
 
void * cstl_dlist_find (const struct cstl_dlist *l, const void *obj, cstl_compare_func_t *cmp, void *priv, cstl_dlist_foreach_dir_t dir)
 Perform a linear search for an object.
 
void cstl_dlist_clear (struct cstl_dlist *l, cstl_xtor_func_t *clr)
 Remove objects from and reinitialize a list.
 
void cstl_dlist_swap (struct cstl_dlist *a, struct cstl_dlist *b)
 Swap the list objects at the two given locations.