arduino-audio-tools
Queue.h
1 #pragma once
2 #include "AudioBasic/Collections/List.h"
3 
4 namespace audio_tools {
5 
13 template <class T>
14 class Queue {
15  public:
16  Queue() = default;
17 
18  bool enqueue(T& data){
19  return l.push_front(data);
20  }
21 
22  bool peek(T& data){
23  if (l.end()->prior==nullptr) return false;
24  data = *(l.end()->prior);
25  return true;
26  }
27 
28  bool dequeue(T& data){
29  return l.pop_back(data);
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 }
Memory allocateator which uses malloc.
Definition: Allocator.h:22
Double linked list.
Definition: List.h:18
FIFO Queue which is based on a List.
Definition: Queue.h:14
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition: AnalogAudio.h:10