distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
DynamicFifoQueue.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_DYNAMICFIFOQUEUE_HPP_
13 #define INCLUDE_DISTORTOS_DYNAMICFIFOQUEUE_HPP_
14 
15 #include "FifoQueue.hpp"
16 
18 
19 namespace distortos
20 {
21 
30 template<typename T>
31 class DynamicFifoQueue : public FifoQueue<T>
32 {
33 public:
34 
36  using typename FifoQueue<T>::Storage;
37 
44  explicit DynamicFifoQueue(size_t queueSize);
45 };
46 
47 template<typename T>
48 DynamicFifoQueue<T>::DynamicFifoQueue(const size_t queueSize) :
49  FifoQueue<T>{{new Storage[queueSize], internal::storageDeleter<Storage>}, queueSize}
50 {
51 
52 }
53 
54 } // namespace distortos
55 
56 #endif // INCLUDE_DISTORTOS_DYNAMICFIFOQUEUE_HPP_
typename std::aligned_storage< sizeof(T), alignof(T)>::type Storage
type of uninitialized storage for data
Definition: FifoQueue.hpp:49
FifoQueue class is a simple FIFO queue for thread-thread, thread-interrupt or interrupt-interrupt com...
Definition: FifoQueue.hpp:44
storageDeleter() definition
Top-level namespace of distortos project.
Definition: buttons.hpp:33
DynamicFifoQueue(size_t queueSize)
DynamicFifoQueue's constructor.
Definition: DynamicFifoQueue.hpp:48
DynamicFifoQueue class is a variant of FifoQueue that has dynamic storage for queue's contents.
Definition: DynamicFifoQueue.hpp:31
FifoQueue class header.