F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Fw::Stack< T, C > Class Template Referencefinal

#include <Fw/DataStructures/Stack.hpp>

Inheritance diagram for Fw::Stack< T, C >:
Fw::StackBase< T > Fw::SizedContainer

Public Member Functions

 Stack ()
 Zero-argument constructor. More...
 
 Stack (const Stack< T, C > &stack)
 Copy constructor. More...
 
 ~Stack () override=default
 Destructor. More...
 
Stack< T, C > & operator= (const Stack< T, C > &stack)
 operator= More...
 
void clear () override
 Clear the stack. More...
 
Success push (const T &e) override
 
Success pop (T &e) override
 
FwSizeType getSize () const override
 
FwSizeType getCapacity () const override
 
const T & at (FwSizeType index) const override
 
- Public Member Functions inherited from Fw::StackBase< T >
void copyDataFrom (const StackBase< T > &stack)
 Copy data from another stack. More...
 
Success peek (T &e, FwSizeType index=0) const
 
- Public Member Functions inherited from Fw::SizedContainer
bool isEmpty () const
 
bool isFull () const
 

Friends

template<typename TT , FwSizeType CC>
class StackTester
 

Additional Inherited Members

- Protected Member Functions inherited from Fw::StackBase< T >
 StackBase ()
 Zero-argument constructor. More...
 
virtual ~StackBase ()=default
 Destructor. More...
 
- Protected Member Functions inherited from Fw::SizedContainer
 SizedContainer ()
 Zero-argument constructor. More...
 
virtual ~SizedContainer ()=default
 Destructor. More...
 

Detailed Description

template<typename T, FwSizeType C>
class Fw::Stack< T, C >

Definition at line 16 of file Stack.hpp.

Constructor & Destructor Documentation

◆ Stack() [1/2]

template<typename T, FwSizeType C>
Fw::Stack< T, C >::Stack ( )
inline

Zero-argument constructor.

Definition at line 37 of file Stack.hpp.

◆ Stack() [2/2]

template<typename T, FwSizeType C>
Fw::Stack< T, C >::Stack ( const Stack< T, C > &  stack)
inline

Copy constructor.

Definition at line 40 of file Stack.hpp.

◆ ~Stack()

template<typename T, FwSizeType C>
Fw::Stack< T, C >::~Stack ( )
overridedefault

Destructor.

Member Function Documentation

◆ at()

template<typename T, FwSizeType C>
const T& Fw::Stack< T, C >::at ( FwSizeType  index) const
inlineoverridevirtual

Get an item at an index. Index 0 is the rightmost (latest) element in the stack. Increasing indices go from right to left. Fails an assertion if the index is out of range.

Returns
The item
Parameters
indexThe index

Implements Fw::StackBase< T >.

Definition at line 86 of file Stack.hpp.

◆ clear()

template<typename T, FwSizeType C>
void Fw::Stack< T, C >::clear ( )
inlineoverridevirtual

Clear the stack.

Implements Fw::SizedContainer.

Definition at line 57 of file Stack.hpp.

◆ getCapacity()

template<typename T, FwSizeType C>
FwSizeType Fw::Stack< T, C >::getCapacity ( ) const
inlineoverridevirtual

Get the capacity (maximum number of items stored in the stack)

Returns
The capacity

Implements Fw::SizedContainer.

Definition at line 79 of file Stack.hpp.

◆ getSize()

template<typename T, FwSizeType C>
FwSizeType Fw::Stack< T, C >::getSize ( ) const
inlineoverridevirtual

Get the size (number of items stored in the stack)

Returns
The size

Implements Fw::SizedContainer.

Definition at line 75 of file Stack.hpp.

◆ operator=()

template<typename T, FwSizeType C>
Stack<T, C>& Fw::Stack< T, C >::operator= ( const Stack< T, C > &  stack)
inline

operator=

Definition at line 51 of file Stack.hpp.

◆ pop()

template<typename T, FwSizeType C>
Success Fw::Stack< T, C >::pop ( T &  e)
inlineoverridevirtual

Pop an item (remove from the right)

Returns
SUCCESS if item popped
Parameters
eThe item (output)

Implements Fw::StackBase< T >.

Definition at line 68 of file Stack.hpp.

◆ push()

template<typename T, FwSizeType C>
Success Fw::Stack< T, C >::push ( const T &  e)
inlineoverridevirtual

Push an item (push on the right)

Returns
SUCCESS if item pushed
Parameters
eThe item (output)

Implements Fw::StackBase< T >.

Definition at line 61 of file Stack.hpp.

Friends And Related Function Documentation

◆ StackTester

template<typename T, FwSizeType C>
template<typename TT , FwSizeType CC>
friend class StackTester
friend

Definition at line 21 of file Stack.hpp.


The documentation for this class was generated from the following file: