FifoQueueBase class implements basic functionality of FifoQueue template class.
More...
#include "distortos/internal/synchronization/FifoQueueBase.hpp"
FifoQueueBase class implements basic functionality of FifoQueue template class.
◆ StorageUniquePointer
unique_ptr (with deleter) to storage
◆ FifoQueueBase()
distortos::internal::FifoQueueBase::FifoQueueBase |
( |
StorageUniquePointer && |
storageUniquePointer, |
|
|
size_t |
elementSize, |
|
|
size_t |
maxElements |
|
) |
| |
FifoQueueBase's constructor.
- Parameters
-
[in] | storageUniquePointer | is a rvalue reference to StorageUniquePointer 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 storage |
◆ ~FifoQueueBase()
distortos::internal::FifoQueueBase::~FifoQueueBase |
( |
| ) |
|
◆ getCapacity()
size_t distortos::internal::FifoQueueBase::getCapacity |
( |
| ) |
const |
|
inline |
- Returns
- maximum number of elements in queue
◆ getElementSize()
size_t distortos::internal::FifoQueueBase::getElementSize |
( |
| ) |
const |
|
inline |
- Returns
- size of single queue element, bytes
◆ pop()
Implementation of pop() using type-erased functor.
- Parameters
-
[in] | waitSemaphoreFunctor | is a reference to SemaphoreFunctor which will be executed with popSemaphore_ |
[in] | functor | is a reference to QueueFunctor which will execute actions related to popping - it will get readPosition_ as argument |
- 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 functor.
- Parameters
-
[in] | waitSemaphoreFunctor | is a reference to SemaphoreFunctor which will be executed with waitSemaphore |
[in] | functor | is a reference to QueueFunctor which will execute actions related to popping/pushing - it will get storage as argument |
[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() |
[in] | storage | is a reference to appropriate pointer to storage, which will be passed to functor, readPosition_ for pop(), writePosition_ 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()
Implementation of push() using type-erased functor.
- Parameters
-
[in] | waitSemaphoreFunctor | is a reference to SemaphoreFunctor which will be executed with pushSemaphore_ |
[in] | functor | is a reference to QueueFunctor which will execute actions related to pushing - it will get writePosition_ as argument |
- Returns
- 0 if element was pushed successfully, error code otherwise:
- error codes returned by waitSemaphoreFunctor's operator() call;
- error codes returned by Semaphore::post();
◆ elementSize_
const size_t distortos::internal::FifoQueueBase::elementSize_ |
|
private |
size of single queue element, bytes
◆ popSemaphore_
Semaphore distortos::internal::FifoQueueBase::popSemaphore_ |
|
private |
semaphore guarding access to "pop" functions - its value is equal to the number of available elements
◆ pushSemaphore_
Semaphore distortos::internal::FifoQueueBase::pushSemaphore_ |
|
private |
semaphore guarding access to "push" functions - its value is equal to the number of free slots
◆ readPosition_
void* distortos::internal::FifoQueueBase::readPosition_ |
|
private |
pointer to first element available for reading
◆ storageEnd_
const void* const distortos::internal::FifoQueueBase::storageEnd_ |
|
private |
pointer to past-the-last element of storage for queue elements
◆ storageUniquePointer_
storage for queue elements
◆ writePosition_
void* distortos::internal::FifoQueueBase::writePosition_ |
|
private |
pointer to first free slot available for writing
The documentation for this class was generated from the following files: