Thread safe class that manages a last in first out singly linked list. More...
Public Member Functions | |
MPLastInFirstOut () noexcept | |
Default constructor. | |
MPLastInFirstOut (ForwardLink *pRoot) noexcept | |
Default constructor. | |
void | clear (void) noexcept |
Discard the linked list. | |
uint_t | is_empty (void) const noexcept |
Default constructor. | |
uintptr_t | size (void) noexcept |
Count the number of entries in this linked list. | |
void | add_first (ForwardLink *pNewRoot) noexcept |
Insert an entry to the head of the list. | |
void | add_last (ForwardLink *pNewTail) noexcept |
Insert an entry to the end of the list. | |
ForwardLink * | remove_first (void) noexcept |
Remove an entry from the head of the list. | |
ForwardLink * | take_list (void) noexcept |
Assigns ownership of the linked list. | |
eError | remove (ForwardLink *pEntry) noexcept |
Remove an item from the linked list. | |
void | reverse_list (void) noexcept |
Reverse the singly linked list. | |
void | lock (void) noexcept |
Lock the singly linked list. | |
void | unlock (void) noexcept |
Unlock the singly linked list. | |
Protected Attributes | |
Mutex | m_Lock |
Critical section for thread safety. | |
Protected Attributes inherited from Burger::LastInFirstOut | |
ForwardLink * | m_pRoot |
Root pointer to the singly linked list. | |
Private Member Functions | |
MPLastInFirstOut (const MPLastInFirstOut &)=delete | |
MPLastInFirstOut & | operator= (const MPLastInFirstOut &)=delete |
MPLastInFirstOut (MPLastInFirstOut &&)=delete | |
MPLastInFirstOut & | operator= (MPLastInFirstOut &&)=delete |
Additional Inherited Members | |
Protected Member Functions inherited from Burger::LastInFirstOut | |
LastInFirstOut () noexcept | |
Default constructor. | |
LastInFirstOut (ForwardLink *pRoot) noexcept | |
Default constructor. | |
void | clear (void) noexcept |
Discard the linked list. | |
uint_t | is_empty (void) const noexcept |
Default constructor. | |
ForwardLink * | get_root (void) const noexcept |
Get the head of the list. | |
uintptr_t | size (void) const noexcept |
Count the number of entries in this linked list. | |
void | add_first (ForwardLink *pNewRoot) noexcept |
Insert an entry to the head of the list. | |
void | add_last (ForwardLink *pNewTail) noexcept |
Insert an entry to the end of the list. | |
ForwardLink * | remove_first (void) noexcept |
Remove an entry from the head of the list. | |
ForwardLink * | take_list (void) noexcept |
Assigns ownership of the linked list. | |
eError | remove (ForwardLink *pEntry) noexcept |
Remove an item from the linked list. | |
void | reverse_list (void) noexcept |
Reverse the singly linked list. | |
Thread safe class that manages a last in first out singly linked list.
This class holds a linked list that is treated as a last in first out stack with a Mutex to ensure thread safety.
|
privatedelete |
|
privatedelete |
|
noexcept |
|
noexcept |
Default constructor.
Construct the class with an supplied list
pRoot | Pointer to the linked list to initialize this class with |
|
noexcept |
Insert an entry to the head of the list.
Insert a linked list into the head of the stored linked list.
pNewRoot | Pointer to the new head of the list |
|
noexcept |
Insert an entry to the end of the list.
Insert a linked list into the tail of the stored linked list.
pNewTail | Pointer to the list that will be appended to the current linked list |
|
noexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Lock the singly linked list.
Obtain the lock on the Mutex so that the application can traverse or otherwise manipulate the linked list.
|
privatedelete |
|
privatedelete |
|
noexcept |
Remove an item from the linked list.
Traverse the linked list until the pointer is found and then unlink it from the list. The pointer is not deleted, just unlinked.
pEntry | Item to remove from the linked list |
|
noexcept |
Remove an entry from the head of the list.
Remove the pointer from the root of the linked list. Sets the new root with the second entry of the linked list if there is a second entry.
|
noexcept |
Reverse the singly linked list.
Traverse the singly linked list and reverse the linkage so that the order of the entries are in the opposite order.
|
noexcept |
Count the number of entries in this linked list.
Traverse the linked list until the end is reached and return the number of entries found.
|
noexcept |
Assigns ownership of the linked list.
Returns the head pointer of the linked list and sets the linked list in this class to being empty. The calling function is assigned ownership of the entire list.
|
inlinenoexcept |
Unlock the singly linked list.
Release the lock on the Mutex so that the linked list can be used by other threads.
|
protected |
Critical section for thread safety.