le_singlyLinkedList.h
Go to the documentation of this file.
1 
170 #ifndef LEGATO_SINGLY_LINKED_LIST_INCLUDE_GUARD
171 #define LEGATO_SINGLY_LINKED_LIST_INCLUDE_GUARD
172 
173 
174 //--------------------------------------------------------------------------------------------------
183 //--------------------------------------------------------------------------------------------------
184 typedef struct le_sls_Link
185 {
186  struct le_sls_Link* nextPtr;
187 }
189 
190 
191 //--------------------------------------------------------------------------------------------------
198 //--------------------------------------------------------------------------------------------------
199 typedef struct
200 {
202 }
204 
205 
206 //--------------------------------------------------------------------------------------------------
211 //--------------------------------------------------------------------------------------------------
212 #define LE_SLS_LIST_INIT (le_sls_List_t){NULL}
213 
214 
215 //--------------------------------------------------------------------------------------------------
220 //--------------------------------------------------------------------------------------------------
221 #define LE_SLS_LINK_INIT (le_sls_Link_t){NULL}
222 
223 
224 //--------------------------------------------------------------------------------------------------
228 //--------------------------------------------------------------------------------------------------
229 void le_sls_Stack
230 (
231  le_sls_List_t* listPtr,
232  le_sls_Link_t* newLinkPtr
233 );
234 
235 
236 //--------------------------------------------------------------------------------------------------
240 //--------------------------------------------------------------------------------------------------
241 void le_sls_Queue
242 (
243  le_sls_List_t* listPtr,
244  le_sls_Link_t* newLinkPtr
245 );
246 
247 
248 //--------------------------------------------------------------------------------------------------
253 //--------------------------------------------------------------------------------------------------
254 void le_sls_AddAfter
255 (
256  le_sls_List_t* listPtr,
257  le_sls_Link_t* currentLinkPtr,
258  le_sls_Link_t* newLinkPtr
259 );
260 
261 
262 //--------------------------------------------------------------------------------------------------
271 //--------------------------------------------------------------------------------------------------
273 (
274  le_sls_List_t* listPtr,
275  le_sls_Link_t* currentLinkPtr
276 );
278 
279 
280 //--------------------------------------------------------------------------------------------------
288 //--------------------------------------------------------------------------------------------------
290 (
291  le_sls_List_t* listPtr
292 );
293 
294 
295 //--------------------------------------------------------------------------------------------------
303 //--------------------------------------------------------------------------------------------------
305 (
306  const le_sls_List_t* listPtr
307 );
308 
309 
310 //------------------------------------------------------------------------------------------------------------
318 //------------------------------------------------------------------------------------------------------------
320 (
321  const le_sls_List_t* listPtr
322 );
323 
324 
325 //--------------------------------------------------------------------------------------------------
336 //--------------------------------------------------------------------------------------------------
338 (
339  const le_sls_List_t* listPtr,
340  const le_sls_Link_t* currentLinkPtr
341 );
342 
343 
344 //--------------------------------------------------------------------------------------------------
351 //--------------------------------------------------------------------------------------------------
352 static inline bool le_sls_IsEmpty
353 (
354  const le_sls_List_t* listPtr
355 )
356 //--------------------------------------------------------------------------------------------------
357 {
358  return (le_sls_Peek(listPtr) == NULL);
359 }
360 
361 
362 //--------------------------------------------------------------------------------------------------
370 //--------------------------------------------------------------------------------------------------
371 bool le_sls_IsInList
372 (
373  const le_sls_List_t* listPtr,
374  const le_sls_Link_t* linkPtr
375 );
376 
377 
378 //--------------------------------------------------------------------------------------------------
386 //--------------------------------------------------------------------------------------------------
387 static inline bool le_sls_IsHead
388 (
389  const le_sls_List_t* listPtr,
390  const le_sls_Link_t* linkPtr
391 )
392 {
393  return (le_sls_Peek(listPtr) == linkPtr);
394 }
395 
396 
397 //--------------------------------------------------------------------------------------------------
405 //--------------------------------------------------------------------------------------------------
406 static inline bool le_sls_IsTail
407 (
408  const le_sls_List_t* listPtr,
409  const le_sls_Link_t* linkPtr
410 )
411 {
412  return (le_sls_PeekTail(listPtr) == linkPtr);
413 }
414 
415 
416 //--------------------------------------------------------------------------------------------------
423 //--------------------------------------------------------------------------------------------------
424 size_t le_sls_NumLinks
425 (
426  const le_sls_List_t* listPtr
427 );
428 
429 
430 //--------------------------------------------------------------------------------------------------
438 //--------------------------------------------------------------------------------------------------
440 (
441  const le_sls_List_t* listPtr
442 );
443 
444 
445 #endif // LEGATO_SINGLY_LINKED_LIST_INCLUDE_GUARD
446 
static bool le_sls_IsHead(const le_sls_List_t *listPtr, const le_sls_Link_t *linkPtr)
Definition: le_singlyLinkedList.h:388
void le_sls_Queue(le_sls_List_t *listPtr, le_sls_Link_t *newLinkPtr)
static bool le_sls_IsEmpty(const le_sls_List_t *listPtr)
Definition: le_singlyLinkedList.h:353
bool le_sls_IsInList(const le_sls_List_t *listPtr, const le_sls_Link_t *linkPtr)
static bool le_sls_IsTail(const le_sls_List_t *listPtr, const le_sls_Link_t *linkPtr)
Definition: le_singlyLinkedList.h:407
le_sls_Link_t * le_sls_RemoveAfter(le_sls_List_t *listPtr, le_sls_Link_t *currentLinkPtr)
le_sls_Link_t * le_sls_PeekNext(const le_sls_List_t *listPtr, const le_sls_Link_t *currentLinkPtr)
le_sls_Link_t * le_sls_Peek(const le_sls_List_t *listPtr)
le_sls_Link_t * le_sls_Pop(le_sls_List_t *listPtr)
void le_sls_AddAfter(le_sls_List_t *listPtr, le_sls_Link_t *currentLinkPtr, le_sls_Link_t *newLinkPtr)
bool le_sls_IsListCorrupted(const le_sls_List_t *listPtr)
le_sls_Link_t * tailLinkPtr
Tail link pointer.
Definition: le_singlyLinkedList.h:201
le_sls_Link_t * le_sls_PeekTail(const le_sls_List_t *listPtr)
size_t le_sls_NumLinks(const le_sls_List_t *listPtr)
Definition: le_singlyLinkedList.h:199
void le_sls_Stack(le_sls_List_t *listPtr, le_sls_Link_t *newLinkPtr)