orx 1.16
Portable Game Engine
Loading...
Searching...
No Matches
OrxLinkList

Data Structures

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_GetCount (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:

#define orxBANK_KU32_FLAG_NONE
Definition orxBank.h:59
struct __orxBANK_t orxBANK
Definition orxBank.h:56
orxDLLAPI orxBANK *orxFASTCALL orxBank_Create(orxU32 _u32Count, orxU32 _u32Size, orxU32 _u32Flags, orxMEMORY_TYPE _eMemType)
@ orxMEMORY_TYPE_MAIN
Definition orxMemory.h:96

You can then instantiate it this way:

orxFOO *pstNode = (orxFOO *)orxBank_Allocate(pstBank);
pstNode->u32Data = 205;
orxDLLAPI void *orxFASTCALL orxBank_Allocate(orxBANK *_pstBank)

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

◆ orxLinkList_AddAfter()

orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddAfter ( orxLINKLIST_NODE * _pstRefNode,
orxLINKLIST_NODE * _pstNode )
extern

Adds a node after another one

Parameters
[in]_pstRefNodeReference node (add after this one)
[in]_pstNodeNode to add
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxLinkList_AddBefore()

orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddBefore ( orxLINKLIST_NODE * _pstRefNode,
orxLINKLIST_NODE * _pstNode )
extern

Adds a node before another one

Parameters
[in]_pstRefNodeReference node (add before this one)
[in]_pstNodeNode to add
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxLinkList_AddEnd()

orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddEnd ( orxLINKLIST * _pstList,
orxLINKLIST_NODE * _pstNode )
extern

Adds a node at the end of a list

Parameters
[in]_pstListConcerned list
[in]_pstNodeNode to add
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxLinkList_AddStart()

orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddStart ( orxLINKLIST * _pstList,
orxLINKLIST_NODE * _pstNode )
extern

Adds a node at the start of a list

Parameters
[in]_pstListConcerned list
[in]_pstNodeNode to add
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxLinkList_Clean()

orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_Clean ( orxLINKLIST * _pstList)
extern

Cleans a linklist

Parameters
[in]_pstListConcerned list
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxLinkList_GetCount()

orxINLINE orxU32 orxLinkList_GetCount ( const orxLINKLIST * _pstList)
static

Gets a list count

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

Definition at line 228 of file orxLinkList.h.

◆ orxLinkList_GetFirst()

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.

◆ orxLinkList_GetLast()

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.

◆ orxLinkList_GetList()

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.

◆ orxLinkList_GetNext()

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.

◆ orxLinkList_GetPrevious()

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.

◆ orxLinkList_Remove()

orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_Remove ( orxLINKLIST_NODE * _pstNode)
extern

Removes a node from its list

Parameters
[in]_pstNodeConcerned node
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

Generated for orx by doxygen 1.8.11