liba 0.1.15
An algorithm library based on C/C++
Loading...
Searching...
No Matches
circular doubly linked list
Collaboration diagram for circular doubly linked list:

Data Structures

struct  a_list
 instance structure for circular doubly linked list More...
 

Macros

#define A_LIST_INIT(node)
 
#define a_list_(_, x)
 cast a list pointer from another type pointer
 
#define a_list_entry(ptr, type, member)
 access the struct for this entry
 
#define a_list_entry_next(ptr, type, member)
 
#define a_list_entry_prev(ptr, type, member)
 
#define a_list_foreach_(it, ctx, next)
 iterate over a list
 
#define a_list_foreach_next(it, ctx)
 
#define a_list_foreach_prev(it, ctx)
 
#define a_list_forsafe_(it, at, ctx, next)
 iterate over a list safe against removal of list entry
 
#define a_list_forsafe_next(it, at, ctx)
 
#define a_list_forsafe_prev(it, at, ctx)
 

Typedefs

typedef struct a_list a_list
 instance structure for circular doubly linked list
 

Functions

void a_list_ctor (a_list *ctx)
 constructor for circular doubly linked list
 
void a_list_init (a_list *ctx)
 initialize for circular doubly linked list
 
void a_list_dtor (a_list *ctx)
 destructor for circular doubly linked list
 
void a_list_link (a_list *head, a_list *tail)
 link head node and tail node
 
void a_list_loop (a_list *head, a_list *tail)
 loop head node to tail node
 
void a_list_add_ (a_list *head1, a_list *tail1, a_list *head2, a_list *tail2)
 connect list1 and list2
 
void a_list_add_node (a_list *head, a_list *tail, a_list *node)
 insert a node to a list
 
void a_list_add_next (a_list *ctx, a_list *node)
 append a node to a list forward
 
void a_list_add_prev (a_list *ctx, a_list *node)
 append a node to a list backward
 
void a_list_del_ (a_list const *head, a_list const *tail)
 delete a section of a list
 
void a_list_del_node (a_list const *node)
 delete a node from a list
 
void a_list_del_next (a_list const *node)
 remove a node from a list forward
 
void a_list_del_prev (a_list const *node)
 remove a node from a list backward
 
void a_list_set_ (a_list const *head1, a_list const *tail1, a_list *head2, a_list *tail2)
 modify a section of a list
 
void a_list_set_node (a_list const *ctx, a_list *rhs)
 modify a node of a list
 
void a_list_mov_next (a_list *ctx, a_list const *rhs)
 moving a list from another list forward
 
void a_list_mov_prev (a_list *ctx, a_list const *rhs)
 moving a list from another list backward
 
void a_list_rot_next (a_list *ctx)
 rotate a node in the list backward
 
void a_list_rot_prev (a_list *ctx)
 rotate a node in the list forward
 
void a_list_swap_ (a_list *head1, a_list *tail1, a_list *head2, a_list *tail2)
 swap a section of one list and a section of another list
 
void a_list_swap_node (a_list *lhs, a_list *rhs)
 swap the node lhs and the node rhs
 

Detailed Description

Macro Definition Documentation

◆ a_list_

#define a_list_ ( _,
x )
Value:
a_cast_s(a_list _, a_cast_s(void _, x))
instance structure for circular doubly linked list
Definition list.h:25

cast a list pointer from another type pointer

Parameters
[in]_additional attributes of specified type
[in]xpoints to circular doubly linked list
Returns
a pointer to circular doubly linked list

◆ a_list_entry

#define a_list_entry ( ptr,
type,
member )
Value:
a_container_of(ptr, type, member)
#define a_container_of(ptr, type, member)
container of a structure member
Definition a.h:888

access the struct for this entry

Parameters
ptrthe &a_list pointer
typethe type of the struct this is embedded in
memberthe name of the a_list within the struct

◆ a_list_entry_next

#define a_list_entry_next ( ptr,
type,
member )
Value:
a_list_entry((ptr)->next, type, member)
#define a_list_entry(ptr, type, member)
access the struct for this entry
Definition list.h:43

◆ a_list_entry_prev

#define a_list_entry_prev ( ptr,
type,
member )
Value:
a_list_entry((ptr)->prev, type, member)

◆ a_list_foreach_

#define a_list_foreach_ ( it,
ctx,
next )
Value:
for (a_list *it = (ctx)->next; it != (ctx); it = it->next)

iterate over a list

Parameters
itthe &a_list to use as a loop counter
ctxpoints to circular doubly linked list
nextthe direction of loop iteration
  • next the backward iteration
  • prev the forward iteration

◆ a_list_foreach_next

#define a_list_foreach_next ( it,
ctx )
Value:
a_list_foreach_(it, ctx, next)
#define a_list_foreach_(it, ctx, next)
iterate over a list
Definition list.h:55

◆ a_list_foreach_prev

#define a_list_foreach_prev ( it,
ctx )
Value:
a_list_foreach_(it, ctx, prev)

◆ a_list_forsafe_

#define a_list_forsafe_ ( it,
at,
ctx,
next )
Value:
for (a_list *it = (ctx)->next, *at = it->next; it != (ctx); it = at, at = it->next)

iterate over a list safe against removal of list entry

Parameters
itthe &a_list to use as a loop counter
atanother &a_list to use as temporary storage
ctxpoints to circular doubly linked list
nextthe direction of loop iteration
  • next the backward iteration
  • prev the forward iteration

◆ a_list_forsafe_next

#define a_list_forsafe_next ( it,
at,
ctx )
Value:
a_list_forsafe_(it, at, ctx, next)
#define a_list_forsafe_(it, at, ctx, next)
iterate over a list safe against removal of list entry
Definition list.h:69

◆ a_list_forsafe_prev

#define a_list_forsafe_prev ( it,
at,
ctx )
Value:
a_list_forsafe_(it, at, ctx, prev)

◆ A_LIST_INIT

#define A_LIST_INIT ( node)
Value:
{&(node), &(node)}

Function Documentation

◆ a_list_add_()

void a_list_add_ ( a_list * head1,
a_list * tail1,
a_list * head2,
a_list * tail2 )

connect list1 and list2

Parameters
[in,out]head1the head node of the list1
[in,out]tail1the tail node of the list1
[in,out]head2the head node of the list2
[in,out]tail2the tail node of the list2

◆ a_list_add_next()

void a_list_add_next ( a_list * ctx,
a_list * node )

append a node to a list forward

Parameters
[in,out]ctxpoints to circular doubly linked list
[in]nodea circular doubly linked list node

◆ a_list_add_node()

void a_list_add_node ( a_list * head,
a_list * tail,
a_list * node )

insert a node to a list

Parameters
[in,out]headthe head node of a list
[in,out]tailthe tail node of a list
[in]nodea circular doubly linked list node

◆ a_list_add_prev()

void a_list_add_prev ( a_list * ctx,
a_list * node )

append a node to a list backward

Parameters
[in,out]ctxpoints to circular doubly linked list
[in]nodea circular doubly linked list node

◆ a_list_ctor()

void a_list_ctor ( a_list * ctx)

constructor for circular doubly linked list

Parameters
[in,out]ctxpoints to circular doubly linked list

◆ a_list_del_()

void a_list_del_ ( a_list const * head,
a_list const * tail )

delete a section of a list

Parameters
[in]headthe head node of a list
[in]tailthe tail node of a list

◆ a_list_del_next()

void a_list_del_next ( a_list const * node)

remove a node from a list forward

Parameters
[in]nodea circular doubly linked list node

◆ a_list_del_node()

void a_list_del_node ( a_list const * node)

delete a node from a list

Parameters
[in]nodea circular doubly linked list node

◆ a_list_del_prev()

void a_list_del_prev ( a_list const * node)

remove a node from a list backward

Parameters
[in]nodea circular doubly linked list node

◆ a_list_dtor()

void a_list_dtor ( a_list * ctx)

destructor for circular doubly linked list

Parameters
[in,out]ctxpoints to circular doubly linked list

◆ a_list_init()

void a_list_init ( a_list * ctx)

initialize for circular doubly linked list

Parameters
[in,out]ctxpoints to circular doubly linked list

◆ a_list_link()

void a_list_link ( a_list * head,
a_list * tail )

link head node and tail node

Parameters
[in,out]headthe head node of a list
[in,out]tailthe tail node of a list

◆ a_list_loop()

void a_list_loop ( a_list * head,
a_list * tail )

loop head node to tail node

Parameters
[in,out]headthe head node of a list
[in,out]tailthe tail node of a list

◆ a_list_mov_next()

void a_list_mov_next ( a_list * ctx,
a_list const * rhs )

moving a list from another list forward

Parameters
[in,out]ctxpoints to circular doubly linked list
[in]rhsanother circular doubly linked list

◆ a_list_mov_prev()

void a_list_mov_prev ( a_list * ctx,
a_list const * rhs )

moving a list from another list backward

Parameters
[in,out]ctxpoints to circular doubly linked list
[in]rhsanother circular doubly linked list

◆ a_list_rot_next()

void a_list_rot_next ( a_list * ctx)

rotate a node in the list backward

Parameters
[in,out]ctxpoints to circular doubly linked list

◆ a_list_rot_prev()

void a_list_rot_prev ( a_list * ctx)

rotate a node in the list forward

Parameters
[in,out]ctxpoints to circular doubly linked list

◆ a_list_set_()

void a_list_set_ ( a_list const * head1,
a_list const * tail1,
a_list * head2,
a_list * tail2 )

modify a section of a list

Parameters
[in]head1the head node of the list1
[in]tail1the tail node of the list1
[in,out]head2the head node of the list2
[in,out]tail2the tail node of the list2

◆ a_list_set_node()

void a_list_set_node ( a_list const * ctx,
a_list * rhs )

modify a node of a list

Parameters
[in]ctxthe current node
[in,out]rhsthe new node

◆ a_list_swap_()

void a_list_swap_ ( a_list * head1,
a_list * tail1,
a_list * head2,
a_list * tail2 )

swap a section of one list and a section of another list

Parameters
[in,out]head1the head node of the list1
[in,out]tail1the tail node of the list1
[in,out]head2the head node of the list2
[in,out]tail2the tail node of the list2

◆ a_list_swap_node()

void a_list_swap_node ( a_list * lhs,
a_list * rhs )

swap the node lhs and the node rhs

Parameters
[in,out]lhsthe node on the left
[in,out]rhsthe node on the right