orx  stable
Portable Game Engine
OrxLinkList

Data Structures

struct  orxLINKLIST
 
struct  orxLINKLIST_NODE
 

Functions

orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddAfter (orxLINKLIST_NODE *_pstRefNode, orxLINKLIST_NODE *_pstNode)
 
orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddBefore (orxLINKLIST_NODE *_pstRefNode, orxLINKLIST_NODE *_pstNode)
 
orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddEnd (orxLINKLIST *_pstList, orxLINKLIST_NODE *_pstNode)
 
orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddStart (orxLINKLIST *_pstList, orxLINKLIST_NODE *_pstNode)
 
orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_Clean (orxLINKLIST *_pstList)
 
static orxINLINE orxU32 orxLinkList_GetCounter (const orxLINKLIST *_pstList)
 
static orxINLINE orxLINKLIST_NODEorxLinkList_GetFirst (const orxLINKLIST *_pstList)
 
static orxINLINE orxLINKLIST_NODEorxLinkList_GetLast (const orxLINKLIST *_pstList)
 
static orxINLINE orxLINKLISTorxLinkList_GetList (const orxLINKLIST_NODE *_pstNode)
 
static orxINLINE orxLINKLIST_NODEorxLinkList_GetNext (const orxLINKLIST_NODE *_pstNode)
 
static orxINLINE orxLINKLIST_NODEorxLinkList_GetPrevious (const orxLINKLIST_NODE *_pstNode)
 
orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_Remove (orxLINKLIST_NODE *_pstNode)
 

Detailed Description

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:

orxFOO *pstNode = (orxFOO *)orxBank_Allocate(pstBank);
pstNode->u32Data = 205;

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:

orxLINKLIST stList;
orxLinkList_AddEnd(&stList, (orxLINKLIST_NODE *)pstNode);
Note
As the first member of your data structure is a linked list node, you can cast your structure to orxLINKLIST_NODE and reciprocally.

Function Documentation

orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddAfter ( orxLINKLIST_NODE _pstRefNode,
orxLINKLIST_NODE _pstNode 
)

Adds a node after another one

Parameters
[in]_pstRefNodeReference node (add after this one)
[in]_pstNodeNode to add
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddBefore ( orxLINKLIST_NODE _pstRefNode,
orxLINKLIST_NODE _pstNode 
)

Adds a node before another one

Parameters
[in]_pstRefNodeReference node (add before this one)
[in]_pstNodeNode to add
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddEnd ( orxLINKLIST _pstList,
orxLINKLIST_NODE _pstNode 
)

Adds a node at the end of a list

Parameters
[in]_pstListConcerned list
[in]_pstNodeNode to add
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddStart ( orxLINKLIST _pstList,
orxLINKLIST_NODE _pstNode 
)

Adds a node at the start of a list

Parameters
[in]_pstListConcerned list
[in]_pstNodeNode to add
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_Clean ( orxLINKLIST _pstList)

Cleans a linklist

Parameters
[in]_pstListConcerned list
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
static orxINLINE orxU32 orxLinkList_GetCounter ( const orxLINKLIST _pstList)
static

Gets a list counter

Parameters
[in]_pstListConcerned list
Returns
Number of nodes in list

Definition at line 228 of file orxLinkList.h.

static orxINLINE orxLINKLIST_NODE* orxLinkList_GetFirst ( const orxLINKLIST _pstList)
static

Gets a list first node

Parameters
[in]_pstListConcerned list
Returns
orxLINKLIST_NODE / orxNULL

Definition at line 202 of file orxLinkList.h.

static orxINLINE orxLINKLIST_NODE* orxLinkList_GetLast ( const orxLINKLIST _pstList)
static

Gets a list last node

Parameters
[in]_pstListConcerned list
Returns
orxLINKLIST_NODE / orxNULL

Definition at line 215 of file orxLinkList.h.

static orxINLINE orxLINKLIST* orxLinkList_GetList ( const orxLINKLIST_NODE _pstNode)
static

Gets a node list

Parameters
[in]_pstNodeConcerned node
Returns
orxLINKLIST / orxNULL

Definition at line 162 of file orxLinkList.h.

static orxINLINE orxLINKLIST_NODE* orxLinkList_GetNext ( const orxLINKLIST_NODE _pstNode)
static

Gets next node in list

Parameters
[in]_pstNodeConcerned node
Returns
orxLINKLIST_NODE / orxNULL

Definition at line 188 of file orxLinkList.h.

static orxINLINE orxLINKLIST_NODE* orxLinkList_GetPrevious ( const orxLINKLIST_NODE _pstNode)
static

Gets previous node in list

Parameters
[in]_pstNodeConcerned node
Returns
orxLINKLIST_NODE / orxNULL

Definition at line 175 of file orxLinkList.h.

orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_Remove ( orxLINKLIST_NODE _pstNode)

Removes a node from its list

Parameters
[in]_pstNodeConcerned node
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

Generated for orx by doxygen 1.5.6