Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
Burger::LastInFirstOut Class Reference

Class that manages a last in first out singly linked list. More...

Inheritance diagram for Burger::LastInFirstOut:
Inheritance graph
[legend]
Collaboration diagram for Burger::LastInFirstOut:
Collaboration graph
[legend]

Public Member Functions

 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.
 
ForwardLinkget_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.
 
ForwardLinkremove_first (void) noexcept
 Remove an entry from the head of the list.
 
ForwardLinktake_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.
 

Protected Attributes

ForwardLinkm_pRoot
 Root pointer to the singly linked list.
 

Private Member Functions

 LastInFirstOut (const LastInFirstOut &)=delete
 
LastInFirstOutoperator= (const LastInFirstOut &)=delete
 
 LastInFirstOut (LastInFirstOut &&)=delete
 
LastInFirstOutoperator= (LastInFirstOut &&)=delete
 

Detailed Description

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.

This class is not reentrant, use MPLastInFirstOut instead.

See also
MPLastInFirstOut

Constructor & Destructor Documentation

◆ LastInFirstOut() [1/4]

Burger::LastInFirstOut::LastInFirstOut ( const LastInFirstOut & )
privatedelete

◆ LastInFirstOut() [2/4]

Burger::LastInFirstOut::LastInFirstOut ( LastInFirstOut && )
privatedelete

◆ LastInFirstOut() [3/4]

Burger::LastInFirstOut::LastInFirstOut ( )
inlinenoexcept

Default constructor.


Construct the class with an empty list

See also
LastInFirstOut(ForwardLink *)

◆ LastInFirstOut() [4/4]

Burger::LastInFirstOut::LastInFirstOut ( ForwardLink * pRoot)
inlinenoexcept

Default constructor.


Construct the class with an supplied list

Parameters
pRootPointer to the linked list to initialize this class with
See also
LastInFirstOut()

Member Function Documentation

◆ add_first()

void BURGER_API Burger::LastInFirstOut::add_first ( ForwardLink * pNewRoot)
noexcept

Insert an entry to the head of the list.


Insert a linked list into the head of the stored linked list.

Parameters
pNewRootPointer to the new head of the list
See also
add_last(ForwardLink *) or remove_first(void)

◆ add_last()

void BURGER_API Burger::LastInFirstOut::add_last ( ForwardLink * pNewTail)
noexcept

Insert an entry to the end of the list.


Insert a linked list into the tail of the stored linked list.

Parameters
pNewTailPointer to the list that will be appended to the current linked list
See also
add_first(ForwardLink *)

◆ clear()

void Burger::LastInFirstOut::clear ( void )
inlinenoexcept

Discard the linked list.


Set the root pointer to nullptr. No deallocations are performed.

See also
get_root(void) const

◆ get_root()

Burger::ForwardLink * Burger::LastInFirstOut::get_root ( void ) const
inlinenoexcept

Get the head of the list.


Return the head of the linked list for manual traversal.

Returns
nullptr if there is nothing in the list, or a valid pointer to the head of the list.
See also
clear(void)

◆ is_empty()

Burger::LastInFirstOut::is_empty ( void ) const
inlinenoexcept

Default constructor.


Returns
TRUE if there are entries in the linked list.
See also
clear(void)

◆ operator=() [1/2]

LastInFirstOut & Burger::LastInFirstOut::operator= ( const LastInFirstOut & )
privatedelete

◆ operator=() [2/2]

LastInFirstOut & Burger::LastInFirstOut::operator= ( LastInFirstOut && )
privatedelete

◆ remove()

Burger::eError BURGER_API Burger::LastInFirstOut::remove ( ForwardLink * pEntry)
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.

Parameters
pEntryItem to remove from the linked list
Returns
Zero on success, kErrorItemNotFound if the pointer wasn't in the list

◆ remove_first()

Burger::ForwardLink *BURGER_API Burger::LastInFirstOut::remove_first ( void )
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.

Returns
The unlinked head pointer or nullptr if the list was empty.
See also
add_first(ForwardLink *)

◆ reverse_list()

void Burger::LastInFirstOut::reverse_list ( void )
inlinenoexcept

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.

See also
Burger::reverse_list(ForwardLink *)

◆ size()

uintptr_t BURGER_API Burger::LastInFirstOut::size ( void ) const
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.

Returns
The number of elements in this linked list, can be zero.
See also
is_empty(void) const

◆ take_list()

Burger::ForwardLink *BURGER_API Burger::LastInFirstOut::take_list ( void )
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.

Returns
The pointer to the entire linked list or nullptr if the list was empty.
See also
clear(void)

Member Data Documentation

◆ m_pRoot

ForwardLink* Burger::LastInFirstOut::m_pRoot
protected

Root pointer to the singly linked list.