arduino-audio-tools
src
AudioTools
CoreAudio
AudioBasic
Collections
Stack.h
1
#pragma once
2
#include "AudioTools/CoreAudio/AudioBasic/Collections/List.h"
3
4
namespace
audio_tools
{
5
13
template
<
class
T>
14
class
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
:
49
List<T>
l;
50
};
51
52
53
}
audio_tools::Allocator
Memory allocateator which uses malloc.
Definition:
Allocator.h:22
audio_tools::List
Double linked list.
Definition:
List.h:18
audio_tools::Stack
LIFO Stack which is based on a List.
Definition:
Stack.h:14
audio_tools
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition:
AudioConfig.h:823
Generated by
1.9.1