12 #ifndef INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_MESSAGEQUEUEBASE_HPP_ 13 #define INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_MESSAGEQUEUEBASE_HPP_ 45 constexpr
Entry(
const uint8_t priorityy,
void*
const storagee) :
76 using ValueStorage =
typename std::aligned_storage<
sizeof(T),
alignof(T)>::type;
230 #endif // INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_MESSAGEQUEUEBASE_HPP_
int pop(const SemaphoreFunctor &waitSemaphoreFunctor, uint8_t &priority, const QueueFunctor &functor)
Implementation of pop() using type-erased functor.
Definition: MessageQueueBase.cpp:157
constexpr DescendingPriority()
DescendingPriority's constructor.
Definition: MessageQueueBase.hpp:88
Semaphore is the basic synchronization primitive.
Definition: Semaphore.hpp:30
SortedIntrusiveForwardList template class header.
const EntryStorageUniquePointer entryStorageUniquePointer_
storage for queue entries
Definition: MessageQueueBase.hpp:214
Definition: TypeErasedFunctor.hpp:19
IntrusiveForwardList class is an intrusive linear singly linked list.
Definition: IntrusiveForwardList.hpp:855
FreeEntryList freeEntryList_
list of "free" entries
Definition: MessageQueueBase.hpp:223
void * storage
storage for the entry
Definition: MessageQueueBase.hpp:60
int push(const SemaphoreFunctor &waitSemaphoreFunctor, uint8_t priority, const QueueFunctor &functor)
Implementation of push() using type-erased functor.
Definition: MessageQueueBase.cpp:163
MessageQueueBase class implements basic functionality of MessageQueue template class.
Definition: MessageQueueBase.hpp:31
size_t getCapacity() const
Definition: MessageQueueBase.hpp:151
IntrusiveForwardListNode class is the node that is needed for the object to be linked in IntrusiveFor...
Definition: IntrusiveForwardList.hpp:38
estd::IntrusiveForwardListNode node
node for intrusive forward list
Definition: MessageQueueBase.hpp:54
IntrusiveForwardList< Entry, NodePointer, Entry > UnsortedIntrusiveForwardList
unsorted intrusive forward list used internally
Definition: SortedIntrusiveForwardList.hpp:45
constexpr Entry(const uint8_t priorityy, void *const storagee)
Entry's constructor.
Definition: MessageQueueBase.hpp:45
const ValueStorageUniquePointer valueStorageUniquePointer_
storage for queue elements
Definition: MessageQueueBase.hpp:217
EntryList entryList_
list of available entries, sorted in descending order of priority
Definition: MessageQueueBase.hpp:220
Value getMaxValue() const
Definition: Semaphore.hpp:71
int popPush(const SemaphoreFunctor &waitSemaphoreFunctor, const InternalFunctor &internalFunctor, Semaphore &waitSemaphore, Semaphore &postSemaphore)
Implementation of pop() and push() using type-erased internal functor.
Definition: MessageQueueBase.cpp:174
MessageQueueBase(EntryStorageUniquePointer &&entryStorageUniquePointer, ValueStorageUniquePointer &&valueStorageUniquePointer, size_t elementSize, size_t maxElements)
MessageQueueBase's constructor.
Definition: MessageQueueBase.cpp:135
Top-level namespace of distortos project.
Definition: buttons.hpp:33
~MessageQueueBase()
MessageQueueBase's destructor.
Definition: MessageQueueBase.cpp:152
QueueFunctor class header.
typename std::aligned_storage< sizeof(T), alignof(T)>::type ValueStorage
Definition: MessageQueueBase.hpp:76
Semaphore popSemaphore_
semaphore guarding access to "pop" functions - its value is equal to the number of available elements
Definition: MessageQueueBase.hpp:208
SemaphoreFunctor is a type-erased interface for functors which execute some action on semaphore (wait...
Definition: SemaphoreFunctor.hpp:34
std::unique_ptr< EntryStorage[], void(&)(EntryStorage *)> EntryStorageUniquePointer
unique_ptr (with deleter) to EntryStorage[]
Definition: MessageQueueBase.hpp:67
functor which gives descending priority order of elements on the list
Definition: MessageQueueBase.hpp:82
typename std::aligned_storage< sizeof(Entry), alignof(Entry)>::type EntryStorage
type of uninitialized storage for Entry
Definition: MessageQueueBase.hpp:64
Semaphore pushSemaphore_
semaphore guarding access to "push" functions - its value is equal to the number of free slots
Definition: MessageQueueBase.hpp:211
uint8_t priority
priority of the entry
Definition: MessageQueueBase.hpp:57
QueueFunctor is a type-erased interface for functors which execute some action on queue's storage (li...
Definition: QueueFunctor.hpp:31
SemaphoreFunctor class header.
std::unique_ptr< void, void(&)(void *)> ValueStorageUniquePointer
unique_ptr (with deleter) to storage
Definition: MessageQueueBase.hpp:79
InternalFunctor is a type-erased interface for functors which execute common code of pop() and push()...
Definition: MessageQueueBase.hpp:122
bool operator()(const Entry &left, const Entry &right) const
DescendingPriority's function call operator.
Definition: MessageQueueBase.hpp:102
entry in the MessageQueueBase
Definition: MessageQueueBase.hpp:36