|
distortos
v0.7.0
object-oriented C++ RTOS for microcontrollers
|
RawFifoQueue class is very similar to FifoQueue, but optimized for binary serializable types (like POD types). More...
#include "distortos/RawFifoQueue.hpp"
Public Types | |
| using | StorageUniquePointer = internal::FifoQueueBase::StorageUniquePointer |
| unique_ptr (with deleter) to storage More... | |
Public Member Functions | |
| RawFifoQueue (StorageUniquePointer &&storageUniquePointer, size_t elementSize, size_t maxElements) | |
| RawFifoQueue's constructor. More... | |
| size_t | getCapacity () const |
| size_t | getElementSize () const |
| int | pop (void *buffer, size_t size) |
| Pops the oldest (first) element from the queue. More... | |
| template<typename T > | |
| int | pop (T &buffer) |
| Pops the oldest (first) element from the queue. More... | |
| int | push (const void *data, size_t size) |
| Pushes the element to the queue. More... | |
| template<typename T > | |
| int | push (const T &data) |
| Pushes the element to the queue. More... | |
| int | tryPop (void *buffer, size_t size) |
| Tries to pop the oldest (first) element from the queue. More... | |
| template<typename T > | |
| int | tryPop (T &buffer) |
| Tries to pop the oldest (first) element from the queue. More... | |
| int | tryPopFor (TickClock::duration duration, void *buffer, size_t size) |
| Tries to pop the oldest (first) element from the queue for a given duration of time. More... | |
| template<typename Rep , typename Period > | |
| int | tryPopFor (const std::chrono::duration< Rep, Period > duration, void *const buffer, const size_t size) |
| Tries to pop the oldest (first) element from the queue for a given duration of time. More... | |
| template<typename Rep , typename Period , typename T > | |
| int | tryPopFor (const std::chrono::duration< Rep, Period > duration, T &buffer) |
| Tries to pop the oldest (first) element from the queue for a given duration of time. More... | |
| int | tryPopUntil (TickClock::time_point timePoint, void *buffer, size_t size) |
| Tries to pop the oldest (first) element from the queue until a given time point. More... | |
| template<typename Duration > | |
| int | tryPopUntil (const std::chrono::time_point< TickClock, Duration > timePoint, void *const buffer, const size_t size) |
| Tries to pop the oldest (first) element from the queue until a given time point. More... | |
| template<typename Duration , typename T > | |
| int | tryPopUntil (const std::chrono::time_point< TickClock, Duration > timePoint, T &buffer) |
| Tries to pop the oldest (first) element from the queue until a given time point. More... | |
| int | tryPush (const void *data, size_t size) |
| Tries to push the element to the queue. More... | |
| template<typename T > | |
| int | tryPush (const T &data) |
| Tries to push the element to the queue. More... | |
| int | tryPushFor (TickClock::duration duration, const void *data, size_t size) |
| Tries to push the element to the queue for a given duration of time. More... | |
| template<typename Rep , typename Period > | |
| int | tryPushFor (const std::chrono::duration< Rep, Period > duration, const void *const data, const size_t size) |
| Tries to push the element to the queue for a given duration of time. More... | |
| template<typename Rep , typename Period , typename T > | |
| int | tryPushFor (const std::chrono::duration< Rep, Period > duration, const T &data) |
| Tries to push the element to the queue for a given duration of time. More... | |
| int | tryPushUntil (TickClock::time_point timePoint, const void *data, size_t size) |
| Tries to push the element to the queue until a given time point. More... | |
| template<typename Duration > | |
| int | tryPushUntil (const std::chrono::time_point< TickClock, Duration > timePoint, const void *const data, const size_t size) |
| Tries to push the element to the queue until a given time point. More... | |
| template<typename Duration , typename T > | |
| int | tryPushUntil (const std::chrono::time_point< TickClock, Duration > timePoint, const T &data) |
| Tries to push the element to the queue until a given time point. More... | |
Private Member Functions | |
| int | popInternal (const internal::SemaphoreFunctor &waitSemaphoreFunctor, void *buffer, size_t size) |
| Pops the oldest (first) element from the queue. More... | |
| int | pushInternal (const internal::SemaphoreFunctor &waitSemaphoreFunctor, const void *data, size_t size) |
| Pushes the element to the queue. More... | |
Private Attributes | |
| internal::FifoQueueBase | fifoQueueBase_ |
| contained internal::FifoQueueBase object which implements base functionality More... | |
RawFifoQueue class is very similar to FifoQueue, but optimized for binary serializable types (like POD types).
Type T can be used with both RawFifoQueue and FifoQueue only when std::is_trivially_copyable<T>::value == true, otherwise only FifoQueue use is safe, while using RawFifoQueue results in undefined behavior.
unique_ptr (with deleter) to storage
| distortos::RawFifoQueue::RawFifoQueue | ( | StorageUniquePointer && | storageUniquePointer, |
| size_t | elementSize, | ||
| size_t | maxElements | ||
| ) |
RawFifoQueue's constructor.
| [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 memory block |
|
inline |
|
inline |
| int distortos::RawFifoQueue::pop | ( | void * | buffer, |
| size_t | size | ||
| ) |
Pops the oldest (first) element from the queue.
| [out] | buffer | is a pointer to buffer for popped element |
| [in] | size | is the size of buffer, bytes - must be equal to the elementSize attribute of RawFifoQueue |
|
inline |
Pops the oldest (first) element from the queue.
| T | is the type of data popped from the queue |
| [out] | buffer | is a reference to object that will be used to return popped value |
|
private |
Pops the oldest (first) element from the queue.
Internal version - builds the Functor object.
| [in] | waitSemaphoreFunctor | is a reference to SemaphoreFunctor which will be executed with popSemaphore_ |
| [out] | buffer | is a pointer to buffer for popped element |
| [in] | size | is the size of buffer, bytes - must be equal to the elementSize attribute of RawFifoQueue |
| int distortos::RawFifoQueue::push | ( | const void * | data, |
| size_t | size | ||
| ) |
Pushes the element to the queue.
| [in] | data | is a pointer to data that will be pushed to RawFifoQueue |
| [in] | size | is the size of data, bytes - must be equal to the elementSize attribute of RawFifoQueue |
|
inline |
Pushes the element to the queue.
| T | is the type of data pushed to the queue |
| [in] | data | is a reference to data that will be pushed to RawFifoQueue |
|
private |
Pushes the element to the queue.
Internal version - builds the Functor object.
| [in] | waitSemaphoreFunctor | is a reference to SemaphoreFunctor which will be executed with pushSemaphore_ |
| [in] | data | is a pointer to data that will be pushed to RawFifoQueue |
| [in] | size | is the size of data, bytes - must be equal to the elementSize attribute of RawFifoQueue |
| int distortos::RawFifoQueue::tryPop | ( | void * | buffer, |
| size_t | size | ||
| ) |
Tries to pop the oldest (first) element from the queue.
| [out] | buffer | is a pointer to buffer for popped element |
| [in] | size | is the size of buffer, bytes - must be equal to the elementSize attribute of RawFifoQueue |
|
inline |
Tries to pop the oldest (first) element from the queue.
| T | is the type of data popped from the queue |
| [out] | buffer | is a reference to object that will be used to return popped value |
| int distortos::RawFifoQueue::tryPopFor | ( | TickClock::duration | duration, |
| void * | buffer, | ||
| size_t | size | ||
| ) |
Tries to pop the oldest (first) element from the queue for a given duration of time.
| [in] | duration | is the duration after which the call will be terminated without popping the element |
| [out] | buffer | is a pointer to buffer for popped element |
| [in] | size | is the size of buffer, bytes - must be equal to the elementSize attribute of RawFifoQueue |
|
inline |
Tries to pop the oldest (first) element from the queue for a given duration of time.
Template variant of tryPopFor(TickClock::duration, void*, size_t).
| Rep | is type of tick counter |
| Period | is std::ratio type representing the tick period of the clock, seconds |
| [in] | duration | is the duration after which the call will be terminated without popping the element |
| [out] | buffer | is a pointer to buffer for popped element |
| [in] | size | is the size of buffer, bytes - must be equal to the elementSize attribute of RawFifoQueue |
|
inline |
Tries to pop the oldest (first) element from the queue for a given duration of time.
| Rep | is type of tick counter |
| Period | is std::ratio type representing the tick period of the clock, seconds |
| T | is the type of data popped from the queue |
| [in] | duration | is the duration after which the call will be terminated without popping the element |
| [out] | buffer | is a reference to object that will be used to return popped value |
| int distortos::RawFifoQueue::tryPopUntil | ( | TickClock::time_point | timePoint, |
| void * | buffer, | ||
| size_t | size | ||
| ) |
Tries to pop the oldest (first) element from the queue until a given time point.
| [in] | timePoint | is the time point at which the call will be terminated without popping the element |
| [out] | buffer | is a pointer to buffer for popped element |
| [in] | size | is the size of buffer, bytes - must be equal to the elementSize attribute of RawFifoQueue |
|
inline |
Tries to pop the oldest (first) element from the queue until a given time point.
Template variant of tryPopUntil(TickClock::time_point, void*, size_t).
| Duration | is a std::chrono::duration type used to measure duration |
| [in] | timePoint | is the time point at which the call will be terminated without popping the element |
| [out] | buffer | is a pointer to buffer for popped element |
| [in] | size | is the size of buffer, bytes - must be equal to the elementSize attribute of RawFifoQueue |
|
inline |
Tries to pop the oldest (first) element from the queue until a given time point.
| Duration | is a std::chrono::duration type used to measure duration |
| T | is the type of data popped from the queue |
| [in] | timePoint | is the time point at which the call will be terminated without popping the element |
| [out] | buffer | is a reference to object that will be used to return popped value |
| int distortos::RawFifoQueue::tryPush | ( | const void * | data, |
| size_t | size | ||
| ) |
Tries to push the element to the queue.
| [in] | data | is a pointer to data that will be pushed to RawFifoQueue |
| [in] | size | is the size of data, bytes - must be equal to the elementSize attribute of RawFifoQueue |
|
inline |
Tries to push the element to the queue.
| T | is the type of data pushed to the queue |
| [in] | data | is a reference to data that will be pushed to RawFifoQueue |
| int distortos::RawFifoQueue::tryPushFor | ( | TickClock::duration | duration, |
| const void * | data, | ||
| size_t | size | ||
| ) |
Tries to push the element to the queue for a given duration of time.
| [in] | duration | is the duration after which the wait will be terminated without pushing the element |
| [in] | data | is a pointer to data that will be pushed to RawFifoQueue |
| [in] | size | is the size of data, bytes - must be equal to the elementSize attribute of RawFifoQueue |
|
inline |
Tries to push the element to the queue for a given duration of time.
Template variant of tryPushFor(TickClock::duration, const void*, size_t).
| Rep | is type of tick counter |
| Period | is std::ratio type representing the tick period of the clock, seconds |
| [in] | duration | is the duration after which the wait will be terminated without pushing the element |
| [in] | data | is a pointer to data that will be pushed to RawFifoQueue |
| [in] | size | is the size of data, bytes - must be equal to the elementSize attribute of RawFifoQueue |
|
inline |
Tries to push the element to the queue for a given duration of time.
| Rep | is type of tick counter |
| Period | is std::ratio type representing the tick period of the clock, seconds |
| T | is the type of data pushed to the queue |
| [in] | duration | is the duration after which the wait will be terminated without pushing the element |
| [in] | data | is a reference to data that will be pushed to RawFifoQueue |
| int distortos::RawFifoQueue::tryPushUntil | ( | TickClock::time_point | timePoint, |
| const void * | data, | ||
| size_t | size | ||
| ) |
Tries to push the element to the queue until a given time point.
| [in] | timePoint | is the time point at which the call will be terminated without pushing the element |
| [in] | data | is a pointer to data that will be pushed to RawFifoQueue |
| [in] | size | is the size of data, bytes - must be equal to the elementSize attribute of RawFifoQueue |
|
inline |
Tries to push the element to the queue until a given time point.
Template variant of tryPushUntil(TickClock::time_point, const void*, size_t).
| Duration | is a std::chrono::duration type used to measure duration |
| [in] | timePoint | is the time point at which the call will be terminated without pushing the element |
| [in] | data | is a pointer to data that will be pushed to RawFifoQueue |
| [in] | size | is the size of data, bytes - must be equal to the elementSize attribute of RawFifoQueue |
|
inline |
Tries to push the element to the queue until a given time point.
| Duration | is a std::chrono::duration type used to measure duration |
| T | is the type of data pushed to the queue |
| [in] | timePoint | is the time point at which the call will be terminated without pushing the element |
| [in] | data | is a reference to data that will be pushed to RawFifoQueue |
|
private |
contained internal::FifoQueueBase object which implements base functionality