MessageQueueBase class implements basic functionality of MessageQueue template class.
More...
#include "distortos/internal/synchronization/MessageQueueBase.hpp"
MessageQueueBase class implements basic functionality of MessageQueue template class.
◆ EntryList
◆ EntryStorage
type of uninitialized storage for Entry
◆ EntryStorageUniquePointer
unique_ptr (with deleter) to EntryStorage[]
◆ FreeEntryList
◆ ValueStorage
type of uninitialized storage for value
- Template Parameters
-
T | is the type of data in queue |
◆ ValueStorageUniquePointer
unique_ptr (with deleter) to storage
◆ MessageQueueBase()
MessageQueueBase's constructor.
- Parameters
-
[in] | entryStorageUniquePointer | is a rvalue reference to EntryStorageUniquePointer with storage for queue entries (sufficiently large for maxElements EntryStorage objects) and appropriate deleter |
[in] | valueStorageUniquePointer | is a rvalue reference to ValueStorageUniquePointer with storage for queue elements (sufficiently large for maxElements, each elementSize bytes long) and appropriate deleter |
[in] | elementSize | is the size of single queue element, bytes |
[in] | maxElements | is the number of elements in entryStorage array and valueStorage memory block |
◆ ~MessageQueueBase()
distortos::internal::MessageQueueBase::~MessageQueueBase |
( |
| ) |
|
◆ getCapacity()
size_t distortos::internal::MessageQueueBase::getCapacity |
( |
| ) |
const |
|
inline |
- Returns
- maximum number of elements in queue
◆ pop()
int distortos::internal::MessageQueueBase::pop |
( |
const SemaphoreFunctor & |
waitSemaphoreFunctor, |
|
|
uint8_t & |
priority, |
|
|
const QueueFunctor & |
functor |
|
) |
| |
Implementation of pop() using type-erased functor.
- Parameters
-
[in] | waitSemaphoreFunctor | is a reference to SemaphoreFunctor which will be executed with popSemaphore_ |
[out] | priority | is a reference to variable that will be used to return priority of popped value |
[in] | functor | is a reference to QueueFunctor which will execute actions related to popping - it will get a pointer to storage with element |
- Returns
- 0 if element was popped successfully, error code otherwise:
- error codes returned by waitSemaphoreFunctor's operator() call;
- error codes returned by Semaphore::post();
◆ popPush()
Implementation of pop() and push() using type-erased internal functor.
- Parameters
-
[in] | waitSemaphoreFunctor | is a reference to SemaphoreFunctor which will be executed with waitSemaphore |
[in] | internalFunctor | is a reference to InternalFunctor which will execute actions related to popping/pushing |
[in] | waitSemaphore | is a reference to semaphore that will be waited for, popSemaphore_ for pop(), pushSemaphore_ for push() |
[in] | postSemaphore | is a reference to semaphore that will be posted after the operation, pushSemaphore_ for pop(), popSemaphore_ for push() |
- Returns
- 0 if operation was successful, error code otherwise:
- error codes returned by waitSemaphoreFunctor's operator() call;
- error codes returned by Semaphore::post();
◆ push()
int distortos::internal::MessageQueueBase::push |
( |
const SemaphoreFunctor & |
waitSemaphoreFunctor, |
|
|
uint8_t |
priority, |
|
|
const QueueFunctor & |
functor |
|
) |
| |
Implementation of push() using type-erased functor.
- Parameters
-
[in] | waitSemaphoreFunctor | is a reference to SemaphoreFunctor which will be executed with pushSemaphore_ |
[in] | priority | is the priority of new element |
[in] | functor | is a reference to QueueFunctor which will execute actions related to pushing - it will get a pointer to storage for element |
- Returns
- 0 if element was pushed successfully, error code otherwise:
- error codes returned by waitSemaphoreFunctor's operator() call;
- error codes returned by Semaphore::post();
◆ entryList_
EntryList distortos::internal::MessageQueueBase::entryList_ |
|
private |
list of available entries, sorted in descending order of priority
◆ entryStorageUniquePointer_
storage for queue entries
◆ freeEntryList_
FreeEntryList distortos::internal::MessageQueueBase::freeEntryList_ |
|
private |
◆ popSemaphore_
Semaphore distortos::internal::MessageQueueBase::popSemaphore_ |
|
private |
semaphore guarding access to "pop" functions - its value is equal to the number of available elements
◆ pushSemaphore_
Semaphore distortos::internal::MessageQueueBase::pushSemaphore_ |
|
private |
semaphore guarding access to "push" functions - its value is equal to the number of free slots
◆ valueStorageUniquePointer_
storage for queue elements
The documentation for this class was generated from the following files: