le_doublyLinkedList.h
Go to the documentation of this file.
1 
179 #ifndef LEGATO_DOUBLY_LINKED_LIST_INCLUDE_GUARD
180 #define LEGATO_DOUBLY_LINKED_LIST_INCLUDE_GUARD
181 
182 
183 //--------------------------------------------------------------------------------------------------
192 //--------------------------------------------------------------------------------------------------
193 typedef struct le_dls_Link
194 {
195  struct le_dls_Link* nextPtr;
196  struct le_dls_Link* prevPtr;
197 }
199 
200 
201 //--------------------------------------------------------------------------------------------------
208 //--------------------------------------------------------------------------------------------------
209 typedef struct
210 {
212 }
214 
215 
216 //--------------------------------------------------------------------------------------------------
221 //--------------------------------------------------------------------------------------------------
222 #define LE_DLS_LIST_INIT (le_dls_List_t){NULL}
223 
224 
225 //--------------------------------------------------------------------------------------------------
230 //--------------------------------------------------------------------------------------------------
231 #define LE_DLS_LINK_INIT (le_dls_Link_t){NULL, NULL}
232 
233 
234 //--------------------------------------------------------------------------------------------------
238 //--------------------------------------------------------------------------------------------------
239 void le_dls_Stack
240 (
241  le_dls_List_t* listPtr,
242  le_dls_Link_t* newLinkPtr
243 );
244 
245 
246 //--------------------------------------------------------------------------------------------------
250 //--------------------------------------------------------------------------------------------------
251 void le_dls_Queue
252 (
253  le_dls_List_t* listPtr,
254  le_dls_Link_t* newLinkPtr
255 );
256 
257 
258 //--------------------------------------------------------------------------------------------------
263 //--------------------------------------------------------------------------------------------------
264 void le_dls_AddAfter
265 (
266  le_dls_List_t* listPtr,
267  le_dls_Link_t* currentLinkPtr,
268  le_dls_Link_t* newLinkPtr
269 );
270 
271 
272 //--------------------------------------------------------------------------------------------------
277 //--------------------------------------------------------------------------------------------------
278 void le_dls_AddBefore
279 (
280  le_dls_List_t* listPtr,
281  le_dls_Link_t* currentLinkPtr,
282  le_dls_Link_t* newLinkPtr
283 );
284 
285 
286 //--------------------------------------------------------------------------------------------------
294 //--------------------------------------------------------------------------------------------------
296 (
297  le_dls_List_t* listPtr
298 );
299 
300 
301 //--------------------------------------------------------------------------------------------------
309 //--------------------------------------------------------------------------------------------------
311 (
312  le_dls_List_t* listPtr
313 );
314 
315 
316 //--------------------------------------------------------------------------------------------------
321 //--------------------------------------------------------------------------------------------------
322 void le_dls_Remove
323 (
324  le_dls_List_t* listPtr,
325  le_dls_Link_t* linkToRemovePtr
326 );
327 
328 
329 //--------------------------------------------------------------------------------------------------
337 //--------------------------------------------------------------------------------------------------
339 (
340  const le_dls_List_t* listPtr
341 );
342 
343 
344 //--------------------------------------------------------------------------------------------------
352 //--------------------------------------------------------------------------------------------------
354 (
355  const le_dls_List_t* listPtr
356 );
357 
358 
359 //--------------------------------------------------------------------------------------------------
366 //--------------------------------------------------------------------------------------------------
367 static inline bool le_dls_IsEmpty
368 (
369  const le_dls_List_t* listPtr
370 )
371 //--------------------------------------------------------------------------------------------------
372 {
373  return (le_dls_Peek(listPtr) == NULL);
374 }
375 
376 
377 //--------------------------------------------------------------------------------------------------
388 //--------------------------------------------------------------------------------------------------
390 (
391  const le_dls_List_t* listPtr,
392  const le_dls_Link_t* currentLinkPtr
393 );
394 
395 
396 //--------------------------------------------------------------------------------------------------
406 //--------------------------------------------------------------------------------------------------
408 (
409  const le_dls_List_t* listPtr,
410  const le_dls_Link_t* currentLinkPtr
411 );
412 
413 
414 //--------------------------------------------------------------------------------------------------
419 //--------------------------------------------------------------------------------------------------
420 void le_dls_Swap
421 (
422  le_dls_List_t* listPtr,
423  le_dls_Link_t* linkPtr,
424  le_dls_Link_t* otherLinkPtr
425 );
426 
427 
428 //--------------------------------------------------------------------------------------------------
436 //--------------------------------------------------------------------------------------------------
437 bool le_dls_IsInList
438 (
439  const le_dls_List_t* listPtr,
440  const le_dls_Link_t* linkPtr
441 );
442 
443 
444 //--------------------------------------------------------------------------------------------------
451 //--------------------------------------------------------------------------------------------------
452 size_t le_dls_NumLinks
453 (
454  const le_dls_List_t* listPtr
455 );
456 
457 
458 //--------------------------------------------------------------------------------------------------
466 //--------------------------------------------------------------------------------------------------
468 (
469  const le_dls_List_t* listPtr
470 );
471 
472 #endif // LEGATO_DOUBLY_LINKED_LIST_INCLUDE_GUARD
473 
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:209
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:211
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:368
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)