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

#include <Fw/DataStructures/ExternalStack.hpp>

Inheritance diagram for Fw::ExternalStack< T >:
Fw::StackBase< T > Fw::SizedContainer

Public Member Functions

 ExternalStack ()=default
 Zero-argument constructor. More...
 
 ExternalStack (T *items, FwSizeType capacity)
 Constructor providing typed backing storage. More...
 
 ExternalStack (ByteArray data, FwSizeType capacity)
 Constructor providing untyped backing storage. More...
 
 ExternalStack (const ExternalStack< T > &stack)
 Copy constructor. More...
 
 ~ExternalStack () override=default
 Destructor. More...
 
ExternalStack< T > & operator= (const ExternalStack< T > &stack)
 operator= More...
 
void clear () override
 Clear the stack. More...
 
void setStorage (T *items, FwSizeType capacity)
 Set the storage (typed data) More...
 
void setStorage (ByteArray data, FwSizeType capacity)
 Set the storage (untyped data) More...
 
Success push (const T &e) override
 
const T & at (FwSizeType index) const override
 
Success pop (T &e) override
 
FwSizeType getSize () const override
 
FwSizeType getCapacity () 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
 

Static Public Member Functions

static constexpr U8 getByteArrayAlignment ()
 
static constexpr FwSizeType getByteArraySize (FwSizeType capacity)
 

Friends

template<typename TT >
class ExternalStackTester
 

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

Definition at line 17 of file ExternalStack.hpp.

Constructor & Destructor Documentation

◆ ExternalStack() [1/4]

template<typename T>
Fw::ExternalStack< T >::ExternalStack ( )
default

Zero-argument constructor.

◆ ExternalStack() [2/4]

template<typename T>
Fw::ExternalStack< T >::ExternalStack ( T *  items,
FwSizeType  capacity 
)
inline

Constructor providing typed backing storage.

Parameters
itemsThe items
capacityThe capacity

Definition at line 34 of file ExternalStack.hpp.

◆ ExternalStack() [3/4]

template<typename T>
Fw::ExternalStack< T >::ExternalStack ( ByteArray  data,
FwSizeType  capacity 
)
inline

Constructor providing untyped backing storage.

Parameters
dataThe data
capacityThe capacity

Definition at line 42 of file ExternalStack.hpp.

◆ ExternalStack() [4/4]

template<typename T>
Fw::ExternalStack< T >::ExternalStack ( const ExternalStack< T > &  stack)
inline

Copy constructor.

Definition at line 50 of file ExternalStack.hpp.

◆ ~ExternalStack()

template<typename T>
Fw::ExternalStack< T >::~ExternalStack ( )
overridedefault

Destructor.

Member Function Documentation

◆ at()

template<typename T>
const T& Fw::ExternalStack< T >::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 106 of file ExternalStack.hpp.

◆ clear()

template<typename T>
void Fw::ExternalStack< T >::clear ( )
inlineoverridevirtual

Clear the stack.

Implements Fw::SizedContainer.

Definition at line 70 of file ExternalStack.hpp.

◆ getByteArrayAlignment()

template<typename T>
static constexpr U8 Fw::ExternalStack< T >::getByteArrayAlignment ( )
inlinestatic

Get the alignment of the storage for an ExternalStack

Returns
The alignment

Definition at line 141 of file ExternalStack.hpp.

◆ getByteArraySize()

template<typename T>
static constexpr FwSizeType Fw::ExternalStack< T >::getByteArraySize ( FwSizeType  capacity)
inlinestatic

Get the size of the storage for an ExternalStack of the specified capacity, as a byte array

Returns
The byte array size
Parameters
capacityThe capacity

Definition at line 146 of file ExternalStack.hpp.

◆ getCapacity()

template<typename T>
FwSizeType Fw::ExternalStack< T >::getCapacity ( ) const
inlineoverridevirtual

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

Returns
The capacity

Implements Fw::SizedContainer.

Definition at line 132 of file ExternalStack.hpp.

◆ getSize()

template<typename T>
FwSizeType Fw::ExternalStack< T >::getSize ( ) const
inlineoverridevirtual

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

Returns
The size

Implements Fw::SizedContainer.

Definition at line 128 of file ExternalStack.hpp.

◆ operator=()

template<typename T>
ExternalStack<T>& Fw::ExternalStack< T >::operator= ( const ExternalStack< T > &  stack)
inline

operator=

Definition at line 61 of file ExternalStack.hpp.

◆ pop()

template<typename T>
Success Fw::ExternalStack< T >::pop ( T &  e)
inlineoverridevirtual

Pop an element (remove from the right)

Returns
SUCCESS if element popped
Parameters
eThe element (output)

Implements Fw::StackBase< T >.

Definition at line 115 of file ExternalStack.hpp.

◆ push()

template<typename T>
Success Fw::ExternalStack< T >::push ( const T &  e)
inlineoverridevirtual

Push an element (push on the right)

Returns
SUCCESS if element pushed
Parameters
eThe element (output)

Implements Fw::StackBase< T >.

Definition at line 90 of file ExternalStack.hpp.

◆ setStorage() [1/2]

template<typename T>
void Fw::ExternalStack< T >::setStorage ( T *  items,
FwSizeType  capacity 
)
inline

Set the storage (typed data)

Parameters
itemsThe items
capacityThe capacity

Definition at line 73 of file ExternalStack.hpp.

◆ setStorage() [2/2]

template<typename T>
void Fw::ExternalStack< T >::setStorage ( ByteArray  data,
FwSizeType  capacity 
)
inline

Set the storage (untyped data)

Parameters
dataThe data
capacityThe capacity

Definition at line 81 of file ExternalStack.hpp.

Friends And Related Function Documentation

◆ ExternalStackTester

template<typename T>
template<typename TT >
friend class ExternalStackTester
friend

Definition at line 23 of file ExternalStack.hpp.


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