Base Framework
Public Member Functions | Protected Attributes | List of all members
Stack< TYPE >::StackImpl Class Reference

Inherits ReferenceCountedObject.

Public Member Functions

 StackImpl () noexcept
 
 StackImpl (const StackImpl &copy)
 
MemorySize getSize () const noexcept
 
bool isEmpty () const noexcept
 
StackNodegetTop () noexcept
 
const StackNodegetTop () const noexcept
 
const TYPE & peek (MemorySize index=0) const
 
void push (const TYPE &value)
 
TYPE pop ()
 
void pop (MemorySize count)
 
void removeAll () noexcept
 
 ~StackImpl () noexcept
 
- Public Member Functions inherited from ReferenceCountedObject
 ReferenceCountedObject () noexcept
 
 ReferenceCountedObject (const ReferenceCountedObject &copy) noexcept
 
 ReferenceCountedObject (ReferenceCountedObject &&move) noexcept
 
ReferenceCountedObjectoperator= (const ReferenceCountedObject &copy) noexcept
 
ReferenceCountedObjectoperator= (ReferenceCountedObject &&move) noexcept
 
MemorySize getNumberOfReferences_INTERNAL () const noexcept
 
virtual bool useGarbageCollector () const noexcept
 
- Public Member Functions inherited from DynamicObject
 DynamicObject () noexcept
 
bool isValidObject () const noexcept
 
virtual ~DynamicObject () noexcept(false)
 
 _COM_AZURE_DEV__BASE__OVERRIDE_ALLOC ()
 

Protected Attributes

StackNodetop = nullptr
 
StackNodebottom = nullptr
 
MemorySize size = 0
 

Constructor & Destructor Documentation

◆ StackImpl() [1/2]

template<class TYPE >
Stack< TYPE >::StackImpl::StackImpl ( )
inlinenoexcept

Initialize an empty stack.

◆ StackImpl() [2/2]

template<class TYPE >
Stack< TYPE >::StackImpl::StackImpl ( const StackImpl copy)
inline

Initialize stack from other stack.

◆ ~StackImpl()

template<class TYPE >
Stack< TYPE >::StackImpl::~StackImpl ( )
inlinenoexcept

Destroys the stack.

Member Function Documentation

◆ getSize()

template<class TYPE >
MemorySize Stack< TYPE >::StackImpl::getSize ( ) const
inlinenoexcept

Returns the number of elements on the stack.

◆ getTop() [1/2]

template<class TYPE >
const StackNode* Stack< TYPE >::StackImpl::getTop ( ) const
inlinenoexcept

Returns the top node of the stack.

◆ getTop() [2/2]

template<class TYPE >
StackNode* Stack< TYPE >::StackImpl::getTop ( )
inlinenoexcept

Returns the top node of the stack.

◆ isEmpty()

template<class TYPE >
bool Stack< TYPE >::StackImpl::isEmpty ( ) const
inlinenoexcept

Returns true if the stack is empty.

◆ peek()

template<class TYPE >
const TYPE& Stack< TYPE >::StackImpl::peek ( MemorySize  index = 0) const
inline

Returns the element at the specified index from the top. Raises OutOfRange if index is invalid.

Parameters
indexIndex of the element. Default is 0 corresponding to the top.

◆ pop()

template<class TYPE >
void Stack< TYPE >::StackImpl::pop ( MemorySize  count)
inline

Pops the specified number of elements from the stack. Raises OutOfRange if the stack does not contain the specified number of elements.

Parameters
countThe number of elements to pop of the stack.

◆ push()

template<class TYPE >
void Stack< TYPE >::StackImpl::push ( const TYPE &  value)
inline

Pushes an element onto the stack.

Parameters
valueThe value to be pushed.

◆ removeAll()

template<class TYPE >
void Stack< TYPE >::StackImpl::removeAll ( )
inlinenoexcept

Removes all the elements from the stack.

Member Data Documentation

◆ bottom

template<class TYPE >
StackNode* Stack< TYPE >::StackImpl::bottom = nullptr
protected

The node at the bottom of the stack.

◆ size

template<class TYPE >
MemorySize Stack< TYPE >::StackImpl::size = 0
protected

The number of elements on the stack.

◆ top

template<class TYPE >
StackNode* Stack< TYPE >::StackImpl::top = nullptr
protected

The node on the top of the stack.