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

#include <Fw/DataStructures/StackBase.hpp>

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

Public Member Functions

virtual const T & at (FwSizeType index) const =0
 
void copyDataFrom (const StackBase< T > &stack)
 Copy data from another stack. More...
 
virtual Success push (const T &e)=0
 
Success peek (T &e, FwSizeType index=0) const
 
virtual Success pop (T &e)=0
 
- Public Member Functions inherited from Fw::SizedContainer
virtual void clear ()=0
 Clear the container. More...
 
virtual FwSizeType getSize () const =0
 
virtual FwSizeType getCapacity () const =0
 
bool isEmpty () const
 
bool isFull () const
 

Protected Member Functions

 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>
class Fw::StackBase< T >

Definition at line 17 of file StackBase.hpp.

Constructor & Destructor Documentation

◆ StackBase()

template<typename T>
Fw::StackBase< T >::StackBase ( )
inlineprotected

Zero-argument constructor.

Definition at line 33 of file StackBase.hpp.

◆ ~StackBase()

template<typename T>
virtual Fw::StackBase< T >::~StackBase ( )
protectedvirtualdefault

Destructor.

Member Function Documentation

◆ at()

template<typename T>
virtual const T& Fw::StackBase< T >::at ( FwSizeType  index) const
pure virtual

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

Implemented in Fw::ExternalStack< T >, Fw::ExternalStack< Index >, and Fw::Stack< T, C >.

◆ copyDataFrom()

template<typename T>
void Fw::StackBase< T >::copyDataFrom ( const StackBase< T > &  stack)
inline

Copy data from another stack.

Parameters
stackThe stack

Definition at line 62 of file StackBase.hpp.

◆ peek()

template<typename T>
Success Fw::StackBase< T >::peek ( T &  e,
FwSizeType  index = 0 
) const
inline

Peek an item at an index Indices go from left to right in the range [0, size)

Returns
SUCCESS if item exists
Parameters
eThe item (output)
indexThe index (input)

Definition at line 83 of file StackBase.hpp.

◆ pop()

template<typename T>
virtual Success Fw::StackBase< T >::pop ( T &  e)
pure virtual

Pop an item (remove from the right)

Returns
SUCCESS if item popped
Parameters
eThe item (output)

Implemented in Fw::ExternalStack< T >, Fw::ExternalStack< Index >, and Fw::Stack< T, C >.

◆ push()

template<typename T>
virtual Success Fw::StackBase< T >::push ( const T &  e)
pure virtual

Push an item (add to the right)

Returns
SUCCESS if item pushed
Parameters
eThe item (output)

Implemented in Fw::ExternalStack< T >, Fw::ExternalStack< Index >, and Fw::Stack< T, C >.


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