Linklist module Module that handles linklists
Link List - How to
This module provides an easy and powerful interface for manipulating linked lists.
Data definition
Using this data structure as an example:
typedef struct __orxFOO_t
{
orxU32 u32Data; Data
} orxFOO;
Data without link
Creating a bank to allocate memory storage:
You can then instantiate it this way:
Having this basic behavior, you can add list linking to it.
Linked list item definition
To do so, you need to include in your structure an orxLINKLIST_NODE member as FIRST MEMBER:
typedef struct __orxFOO_t
{
orxU32 u32Data;
} orxFOO;
Use of link list
Your data structure can now be linked in lists:
- Note
- As the first member of your data structure is a linked list node, you can cast your structure to orxLINKLIST_NODE and reciprocally.
Adds a node after another one
- Parameters
-
[in] | _pstRefNode | Reference node (add after this one) |
[in] | _pstNode | Node to add |
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
Adds a node before another one
- Parameters
-
[in] | _pstRefNode | Reference node (add before this one) |
[in] | _pstNode | Node to add |
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
Adds a node at the end of a list
- Parameters
-
[in] | _pstList | Concerned list |
[in] | _pstNode | Node to add |
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
Adds a node at the start of a list
- Parameters
-
[in] | _pstList | Concerned list |
[in] | _pstNode | Node to add |
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
Cleans a linklist
- Parameters
-
[in] | _pstList | Concerned list |
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
static orxINLINE orxU32 orxLinkList_GetCount |
( |
const orxLINKLIST * |
_pstList | ) |
|
|
static |
Gets a list count
- Parameters
-
[in] | _pstList | Concerned list |
- Returns
- Number of nodes in list
Definition at line 228 of file orxLinkList.h.
Removes a node from its list
- Parameters
-
[in] | _pstNode | Concerned node |
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE