All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
le_doublyLinkedList.h
Go to the documentation of this file.
1 
191 #ifndef LEGATO_DOUBLY_LINKED_LIST_INCLUDE_GUARD
192 #define LEGATO_DOUBLY_LINKED_LIST_INCLUDE_GUARD
193 
194 
195 //--------------------------------------------------------------------------------------------------
204 //--------------------------------------------------------------------------------------------------
205 typedef struct le_dls_Link
206 {
207  struct le_dls_Link* nextPtr;
208  struct le_dls_Link* prevPtr;
209 }
211 
212 
213 //--------------------------------------------------------------------------------------------------
220 //--------------------------------------------------------------------------------------------------
221 typedef struct
222 {
224 }
226 
227 
228 //--------------------------------------------------------------------------------------------------
233 //--------------------------------------------------------------------------------------------------
234 #define LE_DLS_LIST_INIT (le_dls_List_t){NULL}
235 
236 
237 //--------------------------------------------------------------------------------------------------
242 //--------------------------------------------------------------------------------------------------
243 #define LE_DLS_LINK_INIT (le_dls_Link_t){NULL, NULL}
244 
245 
246 //--------------------------------------------------------------------------------------------------
250 //--------------------------------------------------------------------------------------------------
251 void le_dls_Stack
252 (
253  le_dls_List_t* listPtr,
254  le_dls_Link_t* newLinkPtr
255 );
256 
257 
258 //--------------------------------------------------------------------------------------------------
262 //--------------------------------------------------------------------------------------------------
263 void le_dls_Queue
264 (
265  le_dls_List_t* listPtr,
266  le_dls_Link_t* newLinkPtr
267 );
268 
269 
270 //--------------------------------------------------------------------------------------------------
275 //--------------------------------------------------------------------------------------------------
276 void le_dls_AddAfter
277 (
278  le_dls_List_t* listPtr,
279  le_dls_Link_t* currentLinkPtr,
280  le_dls_Link_t* newLinkPtr
281 );
282 
283 
284 //--------------------------------------------------------------------------------------------------
289 //--------------------------------------------------------------------------------------------------
290 void le_dls_AddBefore
291 (
292  le_dls_List_t* listPtr,
293  le_dls_Link_t* currentLinkPtr,
294  le_dls_Link_t* newLinkPtr
295 );
296 
297 
298 //--------------------------------------------------------------------------------------------------
306 //--------------------------------------------------------------------------------------------------
308 (
309  le_dls_List_t* listPtr
310 );
311 
312 
313 //--------------------------------------------------------------------------------------------------
321 //--------------------------------------------------------------------------------------------------
323 (
324  le_dls_List_t* listPtr
325 );
326 
327 
328 //--------------------------------------------------------------------------------------------------
333 //--------------------------------------------------------------------------------------------------
334 void le_dls_Remove
335 (
336  le_dls_List_t* listPtr,
337  le_dls_Link_t* linkToRemovePtr
338 );
339 
340 
341 //--------------------------------------------------------------------------------------------------
349 //--------------------------------------------------------------------------------------------------
351 (
352  const le_dls_List_t* listPtr
353 );
354 
355 
356 //--------------------------------------------------------------------------------------------------
364 //--------------------------------------------------------------------------------------------------
366 (
367  const le_dls_List_t* listPtr
368 );
369 
370 
371 //--------------------------------------------------------------------------------------------------
378 //--------------------------------------------------------------------------------------------------
379 static inline bool le_dls_IsEmpty
380 (
381  const le_dls_List_t* listPtr
382 )
383 //--------------------------------------------------------------------------------------------------
384 {
385  return (le_dls_Peek(listPtr) == NULL);
386 }
387 
388 
389 //--------------------------------------------------------------------------------------------------
400 //--------------------------------------------------------------------------------------------------
402 (
403  const le_dls_List_t* listPtr,
404  const le_dls_Link_t* currentLinkPtr
405 );
406 
407 
408 //--------------------------------------------------------------------------------------------------
418 //--------------------------------------------------------------------------------------------------
420 (
421  const le_dls_List_t* listPtr,
422  const le_dls_Link_t* currentLinkPtr
423 );
424 
425 
426 //--------------------------------------------------------------------------------------------------
431 //--------------------------------------------------------------------------------------------------
432 void le_dls_Swap
433 (
434  le_dls_List_t* listPtr,
435  le_dls_Link_t* linkPtr,
436  le_dls_Link_t* otherLinkPtr
437 );
438 
439 
440 //--------------------------------------------------------------------------------------------------
448 //--------------------------------------------------------------------------------------------------
449 bool le_dls_IsInList
450 (
451  const le_dls_List_t* listPtr,
452  const le_dls_Link_t* linkPtr
453 );
454 
455 
456 //--------------------------------------------------------------------------------------------------
463 //--------------------------------------------------------------------------------------------------
464 size_t le_dls_NumLinks
465 (
466  const le_dls_List_t* listPtr
467 );
468 
469 
470 //--------------------------------------------------------------------------------------------------
478 //--------------------------------------------------------------------------------------------------
480 (
481  const le_dls_List_t* listPtr
482 );
483 
484 #endif // LEGATO_DOUBLY_LINKED_LIST_INCLUDE_GUARD
485 
void le_dls_AddAfter(le_dls_List_t *listPtr, le_dls_Link_t *currentLinkPtr, le_dls_Link_t *newLinkPtr)
le_dls_Link_t * le_dls_PeekTail(const le_dls_List_t *listPtr)
le_dls_Link_t * le_dls_PeekPrev(const le_dls_List_t *listPtr, const le_dls_Link_t *currentLinkPtr)
bool le_dls_IsListCorrupted(const le_dls_List_t *listPtr)
void le_dls_AddBefore(le_dls_List_t *listPtr, le_dls_Link_t *currentLinkPtr, le_dls_Link_t *newLinkPtr)
void le_dls_Queue(le_dls_List_t *listPtr, le_dls_Link_t *newLinkPtr)
le_dls_Link_t * le_dls_PopTail(le_dls_List_t *listPtr)
Definition: le_doublyLinkedList.h:221
le_dls_Link_t * le_dls_Pop(le_dls_List_t *listPtr)
void le_dls_Stack(le_dls_List_t *listPtr, le_dls_Link_t *newLinkPtr)
le_dls_Link_t * headLinkPtr
Link to list head.
Definition: le_doublyLinkedList.h:223
bool le_dls_IsInList(const le_dls_List_t *listPtr, const le_dls_Link_t *linkPtr)
size_t le_dls_NumLinks(const le_dls_List_t *listPtr)
void le_dls_Swap(le_dls_List_t *listPtr, le_dls_Link_t *linkPtr, le_dls_Link_t *otherLinkPtr)
le_dls_Link_t * le_dls_Peek(const le_dls_List_t *listPtr)
static bool le_dls_IsEmpty(const le_dls_List_t *listPtr)
Definition: le_doublyLinkedList.h:380
le_dls_Link_t * le_dls_PeekNext(const le_dls_List_t *listPtr, const le_dls_Link_t *currentLinkPtr)
void le_dls_Remove(le_dls_List_t *listPtr, le_dls_Link_t *linkToRemovePtr)