Skip to content

daisy::StackBase

More...

#include <Stack.h>

Inherited by daisy::Stack< daisy::UiPage *, kMaxNumPages >, daisy::Stack< daisy::UiCanvasDescriptor, kMaxNumCanvases >, daisy::Stack< T, capacity >

Public Functions

Name
StackBase< T > & operator=(const StackBase< T > & other)
~StackBase()
bool PushBack(const T & elementToAdd)
int PushBack(std::initializer_list< T > valuesToAdd)
T PopBack()
void Clear()
T & operator[](uint32_t idx)
const T & operator[](uint32_t idx) const
bool Remove(uint32_t idx)
int RemoveAllEqualTo(const T & element)
bool Insert(uint32_t idx, const T & item)
bool Contains(const T & element)
size_t CountEqualTo(const T & element)
bool IsEmpty() const
bool IsFull() const
size_t GetNumElements() const
size_t GetCapacity() const

Protected Functions

Name
StackBase(T * buffer, size_t bufferSize)
StackBase(T * buffer, size_t bufferSize, std::initializer_list< T > valuesToAdd)

Detailed Description

template <typename T >
class daisy::StackBase;

Capacity-independent base class for Stack. Use Stack instead.

Public Functions Documentation

function operator=

inline StackBase< T > & operator=(
    const StackBase< T > & other
)

Copies all elements from another Stack


function ~StackBase

inline ~StackBase()

function PushBack

inline bool PushBack(
    const T & elementToAdd
)

Adds an element to the back of the buffer, returning true on success


function PushBack

inline int PushBack(
    std::initializer_list< T > valuesToAdd
)

Adds multiple elements and returns the number of elements that were added


function PopBack

inline T PopBack()

removes and returns an element from the back of the buffer


function Clear

inline void Clear()

clears the buffer


function operator[]

inline T & operator[](
    uint32_t idx
)

returns an element at the given index without checking for the index to be within range.


function operator[]

inline const T & operator[](
    uint32_t idx
) const

returns an element at the given index without checking for the index to be within range.


function Remove

inline bool Remove(
    uint32_t idx
)

removes a single element from the buffer and returns true if successfull


function RemoveAllEqualTo

inline int RemoveAllEqualTo(
    const T & element
)

removes all elements from the buffer for which (buffer(index) == element) returns true and returns the number of elements that were removed.


function Insert

inline bool Insert(
    uint32_t idx,
    const T & item
)

adds a single element to the buffer and returns true if successfull


function Contains

inline bool Contains(
    const T & element
)

Returns true if the buffer contains an element equal to the provided value


function CountEqualTo

inline size_t CountEqualTo(
    const T & element
)

Returns the number of elements in the buffer that are equal to the provided value


function IsEmpty

inline bool IsEmpty() const

returns true, if the buffer is empty


function IsFull

inline bool IsFull() const

returns true, if the buffer is Full


function GetNumElements

inline size_t GetNumElements() const

returns the number of elements in the buffer


function GetCapacity

inline size_t GetCapacity() const

returns the total capacity


Protected Functions Documentation

function StackBase

inline StackBase(
    T * buffer,
    size_t bufferSize
)

function StackBase

inline StackBase(
    T * buffer,
    size_t bufferSize,
    std::initializer_list< T > valuesToAdd
)

Updated on 2024-01-03 at 19:41:00 +0000