arduino-audio-tools
Loading...
Searching...
No Matches
Stack.h
Go to the documentation of this file.
1#pragma once
3
4namespace audio_tools {
5
13template <class T>
14class Stack {
15 public:
16 Stack() = default;
17
18 bool push(T& data){
19 return l.push_back(data);
20 }
21
22 bool pop(T& data){
23 return l.pop_back(data);
24 }
25
26 bool peek(T& data){
27 if (size()==0) return false;
28 data = *(--l.end());
29 return true;
30 }
31
32 size_t size() {
33 return l.size();
34 }
35
36 bool clear() {
37 return l.clear();
38 }
39
40 bool empty() {
41 return l.empty();
42 }
43
44 void setAllocator(Allocator &allocator){
45 l.setAllocator(allocator);
46 }
47
48 protected:
50};
51
52
53}
Memory allocateator which uses malloc.
Definition Allocator.h:23
Double linked list.
Definition List.h:18
LIFO Stack which is based on a List.
Definition Stack.h:14
size_t size()
Definition Stack.h:32
bool empty()
Definition Stack.h:40
bool peek(T &data)
Definition Stack.h:26
bool pop(T &data)
Definition Stack.h:22
bool clear()
Definition Stack.h:36
bool push(T &data)
Definition Stack.h:18
void setAllocator(Allocator &allocator)
Definition Stack.h:44
List< T > l
Definition Stack.h:49
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition AudioCodecsBase.h:10
size_t writeData(Print *p_out, T *data, int samples, int maxSamples=512)
Definition AudioTypes.h:512