7 #ifndef Fw_ExternalStack_HPP 8 #define Fw_ExternalStack_HPP 22 template <
typename TT>
63 this->m_items = stack.m_items;
64 this->m_size = stack.m_size;
70 void clear()
override { this->m_size = 0; }
76 this->m_items.setStorage(items, capacity);
84 this->m_items.setStorage(data, capacity);
94 this->m_items[this->m_size] = e;
108 FW_ASSERT(index < this->m_size, static_cast<FwAssertArgType>(index),
109 static_cast<FwAssertArgType>(this->m_size));
110 return this->m_items[this->m_size - 1 - index];
118 if (this->m_size > 0) {
void setStorage(ByteArray data, FwSizeType capacity)
Set the storage (untyped data)
Success push(const T &e) override
PlatformSizeType FwSizeType
void clear() override
Clear the stack.
ExternalStack(ByteArray data, FwSizeType capacity)
Constructor providing untyped backing storage.
static constexpr FwSizeType getByteArraySize(FwSizeType capacity)
ExternalStack(T *items, FwSizeType capacity)
Constructor providing typed backing storage.
FwSizeType getSize() const override
void setStorage(T *items, FwSizeType capacity)
Set the storage (typed data)
~ExternalStack() override=default
Destructor.
ExternalStack< T > & operator=(const ExternalStack< T > &stack)
operator=
friend class ExternalStackTester
ExternalStack(const ExternalStack< T > &stack)
Copy constructor.
A variable-length byte array.
const T & at(FwSizeType index) const override
static constexpr U8 getByteArrayAlignment()
uint8_t U8
8-bit unsigned integer
ExternalStack()=default
Zero-argument constructor.
FwSizeType getCapacity() const override
static constexpr U8 getByteArrayAlignment()
static constexpr FwSizeType getByteArraySize(FwSizeType size)
Success pop(T &e) override