arduino-audio-tools
Loading...
Searching...
No Matches
src
AudioTools
CoreAudio
AudioBasic
Collections
Stack.h
Go to the documentation of this file.
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
}
List.h
audio_tools::Allocator
Memory allocateator which uses malloc.
Definition
Allocator.h:23
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::Stack::size
size_t size()
Definition
Stack.h:32
audio_tools::Stack::empty
bool empty()
Definition
Stack.h:40
audio_tools::Stack::Stack
Stack()=default
audio_tools::Stack::peek
bool peek(T &data)
Definition
Stack.h:26
audio_tools::Stack::pop
bool pop(T &data)
Definition
Stack.h:22
audio_tools::Stack::clear
bool clear()
Definition
Stack.h:36
audio_tools::Stack::push
bool push(T &data)
Definition
Stack.h:18
audio_tools::Stack::setAllocator
void setAllocator(Allocator &allocator)
Definition
Stack.h:44
audio_tools::Stack::l
List< T > l
Definition
Stack.h:49
audio_tools
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition
AudioCodecsBase.h:10
audio_tools::writeData
size_t writeData(Print *p_out, T *data, int samples, int maxSamples=512)
Definition
AudioTypes.h:512
Generated by
1.9.8