distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
StaticRawMessageQueue.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_STATICRAWMESSAGEQUEUE_HPP_
13 #define INCLUDE_DISTORTOS_STATICRAWMESSAGEQUEUE_HPP_
14 
16 
18 
19 namespace distortos
20 {
21 
31 template<size_t ElementSize, size_t QueueSize>
33 {
34 public:
35 
40  explicit StaticRawMessageQueue() :
41  RawMessageQueue{{entryStorage_.data(), internal::dummyDeleter<EntryStorage>},
42  {valueStorage_.data(), internal::dummyDeleter<uint8_t>}, ElementSize, QueueSize}
43  {
44 
45  }
46 
51  constexpr static size_t getCapacity()
52  {
53  return QueueSize;
54  }
55 
60  constexpr static size_t getElementSize()
61  {
62  return ElementSize;
63  }
64 
65 private:
66 
68  std::array<EntryStorage, QueueSize> entryStorage_;
69 
71  std::array<uint8_t, ElementSize * QueueSize> valueStorage_;
72 };
73 
74 } // namespace distortos
75 
76 #endif // INCLUDE_DISTORTOS_STATICRAWMESSAGEQUEUE_HPP_
std::array< uint8_t, ElementSize *QueueSize > valueStorage_
storage for queue's contents
Definition: StaticRawMessageQueue.hpp:71
RawMessageQueue class is very similar to MessageQueue, but optimized for binary serializable types (l...
Definition: RawMessageQueue.hpp:33
static constexpr size_t getCapacity()
Definition: StaticRawMessageQueue.hpp:51
RawMessageQueue class header.
std::array< EntryStorage, QueueSize > entryStorage_
storage for queue's entries
Definition: StaticRawMessageQueue.hpp:68
StaticRawMessageQueue()
StaticRawMessageQueue's constructor.
Definition: StaticRawMessageQueue.hpp:40
StaticRawMessageQueue class is a variant of RawMessageQueue that has automatic storage for queue's co...
Definition: StaticRawMessageQueue.hpp:32
Top-level namespace of distortos project.
Definition: buttons.hpp:33
static constexpr size_t getElementSize()
Definition: StaticRawMessageQueue.hpp:60
dummyDeleter() declaration