distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
StaticRawFifoQueue.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_STATICRAWFIFOQUEUE_HPP_
13 #define INCLUDE_DISTORTOS_STATICRAWFIFOQUEUE_HPP_
14 
15 #include "RawFifoQueue.hpp"
16 
18 
19 namespace distortos
20 {
21 
31 template<size_t ElementSize, size_t QueueSize>
33 {
34 public:
35 
40  explicit StaticRawFifoQueue() :
41  RawFifoQueue{{storage_.data(), internal::dummyDeleter<uint8_t>}, ElementSize, QueueSize}
42  {
43 
44  }
45 
50  constexpr static size_t getCapacity()
51  {
52  return QueueSize;
53  }
54 
59  constexpr static size_t getElementSize()
60  {
61  return ElementSize;
62  }
63 
64 private:
65 
67  std::array<uint8_t, ElementSize * QueueSize> storage_;
68 };
69 
70 } // namespace distortos
71 
72 #endif // INCLUDE_DISTORTOS_STATICRAWFIFOQUEUE_HPP_
RawFifoQueue class is very similar to FifoQueue, but optimized for binary serializable types (like PO...
Definition: RawFifoQueue.hpp:30
static constexpr size_t getCapacity()
Definition: StaticRawFifoQueue.hpp:50
RawFifoQueue class header.
Top-level namespace of distortos project.
Definition: buttons.hpp:33
StaticRawFifoQueue class is a variant of RawFifoQueue that has automatic storage for queue's contents...
Definition: StaticRawFifoQueue.hpp:32
std::array< uint8_t, ElementSize *QueueSize > storage_
storage for queue's contents
Definition: StaticRawFifoQueue.hpp:67
static constexpr size_t getElementSize()
Definition: StaticRawFifoQueue.hpp:59
StaticRawFifoQueue()
StaticRawFifoQueue's constructor.
Definition: StaticRawFifoQueue.hpp:40
dummyDeleter() declaration