libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_doubly_linked_list.h File Reference

Go to the source code of this file.

Data Structures

struct  GblDoublyLinkedListNode
 

Macros

#define GBL_DOUBLY_LINKED_LIST_NPOS
 
#define GBL_DOUBLY_LINKED_LIST_NODE_INITIALIZER()
 
#define GBL_DOUBLY_LINKED_LIST_NODE(name)
 
#define GBL_DOUBLY_LINKED_LIST_ENTRY(node, structure, field)
 

Typedefs

typedef GblLinkedListCmpFn GblDoublyLinkedListCmpFn
 

Functions

void GblDoublyLinkedList_init (GblDoublyLinkedListNode *pSelf)
 
void GblDoublyLinkedList_move (GblDoublyLinkedListNode *pSelf, GblDoublyLinkedListNode *pHead)
 
GblBool GblDoublyLinkedList_empty (const GblDoublyLinkedListNode *pSelf)
 
size_t GblDoublyLinkedList_count (const GblDoublyLinkedListNode *pSelf)
 
GblDoublyLinkedListNodeGblDoublyLinkedList_at (const GblDoublyLinkedListNode *pSelf, intptr_t index)
 
GblDoublyLinkedListNodeGblDoublyLinkedList_front (const GblDoublyLinkedListNode *pSelf)
 
GblDoublyLinkedListNodeGblDoublyLinkedList_back (const GblDoublyLinkedListNode *pSelf)
 
GblBool GblDoublyLinkedList_contains (const GblDoublyLinkedListNode *pSelf, GblDoublyLinkedListNode *pNode)
 
size_t GblDoublyLinkedList_find (const GblDoublyLinkedListNode *pSelf, GblDoublyLinkedListNode *pNode)
 
GblDoublyLinkedListNodeGblDoublyLinkedList_middle (const GblDoublyLinkedListNode *pSelf)
 
GblDoublyLinkedListNodeGblDoublyLinkedList_beforeMiddle (const GblDoublyLinkedListNode *pSelf)
 
void GblDoublyLinkedList_pushBack (GblDoublyLinkedListNode *pSelf, GblDoublyLinkedListNode *pNode)
 
void GblDoublyLinkedList_pushFront (GblDoublyLinkedListNode *pSelf, GblDoublyLinkedListNode *pNode)
 
void GblDoublyLinkedList_moveBack (GblDoublyLinkedListNode *pSelf, GblDoublyLinkedListNode *pNode)
 
void GblDoublyLinkedList_moveFront (GblDoublyLinkedListNode *pSelf, GblDoublyLinkedListNode *pNode)
 
GblBool GblDoublyLinkedList_join (GblDoublyLinkedListNode *pSelf, intptr_t idx, GblDoublyLinkedListNode *pList)
 
void GblDoublyLinkedList_joinBack (GblDoublyLinkedListNode *pSelf, GblDoublyLinkedListNode *pList)
 
void GblDoublyLinkedList_joinFront (GblDoublyLinkedListNode *pSelf, GblDoublyLinkedListNode *pList)
 
void GblDoublyLinkedList_joinSorted (GblDoublyLinkedListNode *pSelf, GblDoublyLinkedListNode *pList, GblDoublyLinkedListCmpFn pCmpFn, void *pClosure)
 
GblBool GblDoublyLinkedList_insert (GblDoublyLinkedListNode *pSelf, intptr_t idx, GblDoublyLinkedListNode *pNode)
 
void GblDoublyLinkedList_insertBefore (GblDoublyLinkedListNode *pNode1, GblDoublyLinkedListNode *pNode2)
 
void GblDoublyLinkedList_insertAfter (GblDoublyLinkedListNode *pNode1, GblDoublyLinkedListNode *pNode2)
 
GblDoublyLinkedListNodeGblDoublyLinkedList_popBack (GblDoublyLinkedListNode *pSelf)
 
GblDoublyLinkedListNodeGblDoublyLinkedList_popFront (GblDoublyLinkedListNode *pSelf)
 
GblBool GblDoublyLinkedList_swap (GblDoublyLinkedListNode *pNode1, GblDoublyLinkedListNode *pNode2)
 
void GblDoublyLinkedList_remove (GblDoublyLinkedListNode *pNode)
 
GblDoublyLinkedListNodeGblDoublyLinkedList_removeBefore (GblDoublyLinkedListNode *pNode)
 
GblDoublyLinkedListNodeGblDoublyLinkedList_removeAfter (GblDoublyLinkedListNode *pNode)
 
GblBool GblDoublyLinkedList_replace (GblDoublyLinkedListNode *pNode1, GblDoublyLinkedListNode *pNode2)
 
void GblDoublyLinkedList_splitAfter (GblDoublyLinkedListNode *pSelf, GblDoublyLinkedListNode *pHead2, GblDoublyLinkedListNode *pAfter)
 
GblDoublyLinkedListNodeGblDoublyLinkedList_erase (GblDoublyLinkedListNode *pSelf, intptr_t index)
 
void GblDoublyLinkedList_clear (GblDoublyLinkedListNode *pSelf)
 
void GblDoublyLinkedList_mergeSort (GblDoublyLinkedListNode *pSelf, GblDoublyLinkedListCmpFn pCmpFn, void *pClosure)
 
void GblDoublyLinkedList_rotate (GblDoublyLinkedListNode *pSelf, intptr_t n)
 
void GblDoublyLinkedList_reverse (GblDoublyLinkedListNode *pSelf)
 

Detailed Description

GblDoublyLinkedListNode structure and related functions.

Intrustive doubly linked list structure with vector-style API.

GblDoublyLinkedListNode is the low-level API around managing manually allocated, intrusive linked list structures with the list nodes embedded within their containing structures.

Operation Time Complexity
iteration O(N)
insertion/removal (middle) O(N)
insertion/removal (front or back) O(1)
access (front or back) O(1)
random access (middle) O(N)
Note
For more a more user-friendly, high-level, abstract, non-intrusive circularly linked list structure which can be filled with arbitrary data and whose allocations are managed automatically, see the GblRingList API, built upon this one.
See also
GblRingList
Todo:
  • epic BSD-style for loop macros
Author
Falco Girgis

Definition in file gimbal_doubly_linked_list.h.

Macro Definition Documentation

◆ GBL_DOUBLY_LINKED_LIST_NPOS

#define GBL_DOUBLY_LINKED_LIST_NPOS

Definition at line 18 of file gimbal_doubly_linked_list.h.

◆ GBL_DOUBLY_LINKED_LIST_NODE_INITIALIZER

#define GBL_DOUBLY_LINKED_LIST_NODE_INITIALIZER ( )

Definition at line 19 of file gimbal_doubly_linked_list.h.

◆ GBL_DOUBLY_LINKED_LIST_NODE

#define GBL_DOUBLY_LINKED_LIST_NODE (   name)

Definition at line 20 of file gimbal_doubly_linked_list.h.

◆ GBL_DOUBLY_LINKED_LIST_ENTRY

#define GBL_DOUBLY_LINKED_LIST_ENTRY (   node,
  structure,
  field 
)

Definition at line 21 of file gimbal_doubly_linked_list.h.

Typedef Documentation

◆ GblDoublyLinkedListCmpFn

typedef GblLinkedListCmpFn GblDoublyLinkedListCmpFn

Definition at line 25 of file gimbal_doubly_linked_list.h.