ObjectQueue.h
Go to the documentation of this file.
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * ObjectQueue.h
8  *
9  * @author Slavey Karadzhov <slaff@attachix.com>
10  *
11  * @author: 12 Aug 2018 - Mikee47 <mike@sillyhouse.net>
12  * This was in 'Structures.h' and called 'SimpleConcurrentQueue'.
13  *
14  ****/
15 
16 #pragma once
17 
18 #include "WString.h"
19 #include "WHashMap.h"
20 #include "FIFO.h"
21 
25 template <typename T, int rawSize> class ObjectQueue : public FIFO<T*, rawSize>
26 {
27 public:
28  virtual ~ObjectQueue() = default;
29 
30  T* peek() const
31  {
32  return this->count() ? FIFO<T*, rawSize>::peek() : nullptr;
33  }
34 
35  T* dequeue()
36  {
37  return this->count() ? FIFO<T*, rawSize>::dequeue() : nullptr;
38  }
39 };
Definition: FIFO.h:25
unsigned int count() const override
Definition: FIFO.h:37
T peek() const
Definition: FIFO.h:98
T dequeue()
Definition: FIFO.h:88
FIFO for objects.
Definition: ObjectQueue.h:26
T * dequeue()
Definition: ObjectQueue.h:35
T * peek() const
Definition: ObjectQueue.h:30
virtual ~ObjectQueue()=default