tinyOS  v1.00
双向链表

tinyOS所用的双向链表数据结构 More...

Data Structures

struct  _tNode
 
struct  _tList
 

Macros

#define tNodeParent(node, parent, name)   (parent *)((uint32_t)node - (uint32_t)&((parent *)0)->name)
 
#define firstNode   headNode.nextNode
 
#define lastNode   headNode.preNode
 

Typedefs

typedef struct _tNode tNode
 
typedef struct _tList tList
 

Functions

void tNodeInit (tNode *node)
 
void tListInit (tList *list)
 
uint32_t tListCount (tList *list)
 
tNodetListFirst (tList *list)
 
tNodetListLast (tList *list)
 
tNodetListPre (tList *list, tNode *node)
 
tNodetListNext (tList *list, tNode *node)
 
void tListRemoveAll (tList *list)
 
void tListAddFirst (tList *list, tNode *node)
 
void tListAddLast (tList *list, tNode *node)
 
tNodetListRemoveFirst (tList *list)
 
void tListInsertAfter (tList *list, tNode *nodeAfter, tNode *nodeToInsert)
 
void tListRemove (tList *list, tNode *node)
 

Detailed Description

tinyOS所用的双向链表数据结构

Author
01课堂 lishutong
Date
2017-06-01
Version
1.0

Macro Definition Documentation

◆ firstNode

#define firstNode   headNode.nextNode

Definition at line 25 of file tList.c.

◆ lastNode

#define lastNode   headNode.preNode

Definition at line 26 of file tList.c.

◆ tNodeParent

#define tNodeParent (   node,
  parent,
  name 
)    (parent *)((uint32_t)node - (uint32_t)&((parent *)0)->name)

Definition at line 48 of file tLib.h.

Typedef Documentation

◆ tList

typedef struct _tList tList

◆ tNode

typedef struct _tNode tNode

Function Documentation

◆ tListAddFirst()

void tListAddFirst ( tList list,
tNode node 
)

将指定结点插入到链表开始处

Parameters
list操作的链表
node待插入的结点

Definition at line 134 of file tList.c.

◆ tListAddLast()

void tListAddLast ( tList list,
tNode node 
)

将指定结点插入到链表最后

Parameters
list操作的链表
node待插入的结点

Definition at line 148 of file tList.c.

Here is the caller graph for this function:

◆ tListCount()

uint32_t tListCount ( tList list)

返回链表中结点的数量

Parameters
list查询的链表
Returns
结点数量

Definition at line 43 of file tList.c.

Here is the caller graph for this function:

◆ tListFirst()

tNode * tListFirst ( tList list)

返回链表中首个结点

Parameters
list查询的链表
Returns
首个结点,如果没有,返回0

Definition at line 52 of file tList.c.

Here is the caller graph for this function:

◆ tListInit()

void tListInit ( tList list)

初始化链表

Parameters
list等待初始化的链表

Definition at line 32 of file tList.c.

Here is the caller graph for this function:

◆ tListInsertAfter()

void tListInsertAfter ( tList list,
tNode nodeAfter,
tNode nodeToInsert 
)

将指定结点插入到某个结点之后

Parameters
list操作的链表
nodeAfter参考结点
nodeToInsert等待插入的结点

Definition at line 185 of file tList.c.

◆ tListLast()

tNode * tListLast ( tList list)

返回链表中最后结点

Parameters
list查询的链表
Returns
最后结点,如果没有,返回0

Definition at line 66 of file tList.c.

◆ tListNext()

tNode * tListNext ( tList list,
tNode node 
)

返回链表中指定结点的后一结点

Parameters
list查询的链表
node查询的结点
Returns
后一结点,如果没有,返回0

Definition at line 95 of file tList.c.

Here is the caller graph for this function:

◆ tListPre()

tNode * tListPre ( tList list,
tNode node 
)

返回链表中指定结点的前一结点

Parameters
list查询的链表
node查询的结点
Returns
前一结点,如果没有,返回0

Definition at line 81 of file tList.c.

◆ tListRemove()

void tListRemove ( tList list,
tNode node 
)

移除链表中指定结点

Parameters
list操作的链表
node等待队列的结点

Definition at line 200 of file tList.c.

Here is the caller graph for this function:

◆ tListRemoveAll()

void tListRemoveAll ( tList list)

清空链表中的所有结点

Parameters
list等待清空的链表

Definition at line 107 of file tList.c.

◆ tListRemoveFirst()

tNode * tListRemoveFirst ( tList list)

移除链表的第一个结点

Parameters
list操作的链表
Returns
移除的结点,如果没有,返回0

Definition at line 162 of file tList.c.

Here is the caller graph for this function:

◆ tNodeInit()

void tNodeInit ( tNode node)

初始化结构

Parameters
node等待初始化的结点

Definition at line 19 of file tList.c.

Here is the caller graph for this function: