libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy::StackBase< T > Class Template Reference

Detailed Description

template<typename T>
class daisy::StackBase< T >

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

#include <Stack.h>

Inheritance diagram for daisy::StackBase< T >:
daisy::Stack< daisy::UiPage *, kMaxNumPages > daisy::Stack< daisy::UiCanvasDescriptor, kMaxNumCanvases > daisy::Stack< T, capacity >

Public Member Functions

StackBase< T > & operator= (const StackBase< T > &other)
 
 ~StackBase ()
 
bool PushBack (const T &elementToAdd)
 
int PushBack (std::initializer_list< T > valuesToAdd)
 
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 Member Functions

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

Constructor & Destructor Documentation

◆ StackBase() [1/2]

template<typename T >
daisy::StackBase< T >::StackBase ( T *  buffer,
size_t  bufferSize 
)
inlineprotected

◆ StackBase() [2/2]

template<typename T >
daisy::StackBase< T >::StackBase ( T *  buffer,
size_t  bufferSize,
std::initializer_list< T >  valuesToAdd 
)
inlineprotected

◆ ~StackBase()

template<typename T >
daisy::StackBase< T >::~StackBase ( )
inline

Member Function Documentation

◆ Clear()

template<typename T >
void daisy::StackBase< T >::Clear ( )
inline

clears the buffer

◆ Contains()

template<typename T >
bool daisy::StackBase< T >::Contains ( const T &  element)
inline

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

◆ CountEqualTo()

template<typename T >
size_t daisy::StackBase< T >::CountEqualTo ( const T &  element)
inline

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

◆ GetCapacity()

template<typename T >
size_t daisy::StackBase< T >::GetCapacity ( ) const
inline

returns the total capacity

◆ GetNumElements()

template<typename T >
size_t daisy::StackBase< T >::GetNumElements ( ) const
inline

returns the number of elements in the buffer

◆ Insert()

template<typename T >
bool daisy::StackBase< T >::Insert ( uint32_t  idx,
const T &  item 
)
inline

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

◆ IsEmpty()

template<typename T >
bool daisy::StackBase< T >::IsEmpty ( ) const
inline

returns true, if the buffer is empty

◆ IsFull()

template<typename T >
bool daisy::StackBase< T >::IsFull ( ) const
inline

returns true, if the buffer is Full

◆ operator=()

template<typename T >
StackBase< T > & daisy::StackBase< T >::operator= ( const StackBase< T > &  other)
inline

Copies all elements from another Stack

◆ operator[]() [1/2]

template<typename T >
T & daisy::StackBase< T >::operator[] ( uint32_t  idx)
inline

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

◆ operator[]() [2/2]

template<typename T >
const T & daisy::StackBase< T >::operator[] ( uint32_t  idx) const
inline

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

◆ PopBack()

template<typename T >
T daisy::StackBase< T >::PopBack ( )
inline

removes and returns an element from the back of the buffer

◆ PushBack() [1/2]

template<typename T >
bool daisy::StackBase< T >::PushBack ( const T &  elementToAdd)
inline

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

◆ PushBack() [2/2]

template<typename T >
int daisy::StackBase< T >::PushBack ( std::initializer_list< T >  valuesToAdd)
inline

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

◆ Remove()

template<typename T >
bool daisy::StackBase< T >::Remove ( uint32_t  idx)
inline

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

◆ RemoveAllEqualTo()

template<typename T >
int daisy::StackBase< T >::RemoveAllEqualTo ( const T &  element)
inline

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


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