orx  stable
Portable Game Engine
orxLinkList.h
Go to the documentation of this file.
1 /* Orx - Portable Game Engine
2  *
3  * Copyright (c) 2008-2017 Orx-Project
4  *
5  * This software is provided 'as-is', without any express or implied
6  * warranty. In no event will the authors be held liable for any damages
7  * arising from the use of this software.
8  *
9  * Permission is granted to anyone to use this software for any purpose,
10  * including commercial applications, and to alter it and redistribute it
11  * freely, subject to the following restrictions:
12  *
13  * 1. The origin of this software must not be misrepresented; you must not
14  * claim that you wrote the original software. If you use this software
15  * in a product, an acknowledgment in the product documentation would be
16  * appreciated but is not required.
17  *
18  * 2. Altered source versions must be plainly marked as such, and must not be
19  * misrepresented as being the original software.
20  *
21  * 3. This notice may not be removed or altered from any source
22  * distribution.
23  */
24 
83 #ifndef _orxLINKLIST_H_
84 #define _orxLINKLIST_H_
85 
86 
87 #include "orxInclude.h"
88 
89 #include "debug/orxDebug.h"
90 
91 
94 typedef struct __orxLINKLIST_NODE_t
95 {
96  struct __orxLINKLIST_NODE_t *pstNext;
97  struct __orxLINKLIST_NODE_t *pstPrevious;
98  struct __orxLINKLIST_t *pstList;
101 
104 typedef struct __orxLINKLIST_t
105 {
108  orxU32 u32Counter;
110 } orxLINKLIST;
111 
112 
117 extern orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_Clean(orxLINKLIST *_pstList);
118 
119 
125 extern orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddStart(orxLINKLIST *_pstList, orxLINKLIST_NODE *_pstNode);
126 
132 extern orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddEnd(orxLINKLIST *_pstList, orxLINKLIST_NODE *_pstNode);
133 
139 extern orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddBefore(orxLINKLIST_NODE *_pstRefNode, orxLINKLIST_NODE *_pstNode);
140 
146 extern orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_AddAfter(orxLINKLIST_NODE *_pstRefNode, orxLINKLIST_NODE *_pstNode);
147 
152 extern orxDLLAPI orxSTATUS orxFASTCALL orxLinkList_Remove(orxLINKLIST_NODE *_pstNode);
153 
154 
155 /* *** LinkList inlined accessors *** */
156 
157 
162 static orxINLINE orxLINKLIST * orxLinkList_GetList(const orxLINKLIST_NODE *_pstNode)
163 {
164  /* Checks */
165  orxASSERT(_pstNode != orxNULL);
166 
167  /* Returns it */
168  return(_pstNode->pstList);
169 }
170 
175 static orxINLINE orxLINKLIST_NODE * orxLinkList_GetPrevious(const orxLINKLIST_NODE *_pstNode)
176 {
177  /* Checks */
178  orxASSERT(_pstNode != orxNULL);
179 
180  /* Returns it */
181  return((_pstNode->pstList != orxNULL) ? _pstNode->pstPrevious : (orxLINKLIST_NODE *)orxNULL);
182 }
183 
188 static orxINLINE orxLINKLIST_NODE * orxLinkList_GetNext(const orxLINKLIST_NODE *_pstNode)
189 {
190  /* Checks */
191  orxASSERT(_pstNode != orxNULL);
192 
193  /* Returns it */
194  return((_pstNode->pstList != orxNULL) ? _pstNode->pstNext : (orxLINKLIST_NODE *)orxNULL);
195 }
196 
197 
202 static orxINLINE orxLINKLIST_NODE * orxLinkList_GetFirst(const orxLINKLIST *_pstList)
203 {
204  /* Checks */
205  orxASSERT(_pstList != orxNULL);
206 
207  /* Returns it */
208  return(_pstList->pstFirst);
209 }
210 
215 static orxINLINE orxLINKLIST_NODE * orxLinkList_GetLast(const orxLINKLIST *_pstList)
216 {
217  /* Checks */
218  orxASSERT(_pstList != orxNULL);
219 
220  /* Returns it */
221  return(_pstList->pstLast);
222 }
223 
228 static orxINLINE orxU32 orxLinkList_GetCounter(const orxLINKLIST *_pstList)
229 {
230  /* Checks */
231  orxASSERT(_pstList != orxNULL);
232 
233  /* Returns it */
234  return(_pstList->u32Counter);
235 }
236 
237 #endif /* _orxLINKLIST_H_ */
238 
orxU32 u32Counter
Definition: orxLinkList.h:108
struct __orxLINKLIST_NODE_t * pstNext
Definition: orxLinkList.h:96
orxLINKLIST_NODE * pstLast
Definition: orxLinkList.h:107
orxSTATUS
Definition: orxType.h:243
struct __orxLINKLIST_t * pstList
Definition: orxLinkList.h:98
orxLINKLIST_NODE * pstFirst
Definition: orxLinkList.h:106
#define orxDLLAPI
Definition: orxDecl.h:387
struct __orxLINKLIST_NODE_t * pstPrevious
Definition: orxLinkList.h:97
#define orxASSERT(TEST,...)
Definition: orxDebug.h:298

Generated for orx by doxygen 1.5.6