distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
distortos::StaticFifoQueue< T, QueueSize > Class Template Reference

StaticFifoQueue class is a variant of FifoQueue that has automatic storage for queue's contents. More...

#include "distortos/StaticFifoQueue.hpp"

Inheritance diagram for distortos::StaticFifoQueue< T, QueueSize >:
[legend]
Collaboration diagram for distortos::StaticFifoQueue< T, QueueSize >:
[legend]

Public Member Functions

 StaticFifoQueue ()
 StaticFifoQueue's constructor. More...
 
- Public Member Functions inherited from distortos::FifoQueue< T >
 FifoQueue (StorageUniquePointer &&storageUniquePointer, const size_t maxElements)
 FifoQueue's constructor. More...
 
 ~FifoQueue ()
 FifoQueue's destructor. More...
 
template<typename... Args>
int emplace (Args &&... args)
 Emplaces the element in the queue. More...
 
size_t getCapacity () const
 
int pop (T &value)
 Pops the oldest (first) element from the queue. More...
 
int push (const T &value)
 Pushes the element to the queue. More...
 
int push (T &&value)
 Pushes the element to the queue. More...
 
template<typename... Args>
int tryEmplace (Args &&... args)
 Tries to emplace the element in the queue. More...
 
template<typename... Args>
int tryEmplaceFor (const TickClock::duration duration, Args &&... args)
 Tries to emplace the element in the queue for a given duration of time. More...
 
template<typename Rep , typename Period , typename... Args>
int tryEmplaceFor (const std::chrono::duration< Rep, Period > duration, Args &&... args)
 Tries to emplace the element in the queue for a given duration of time. More...
 
template<typename... Args>
int tryEmplaceUntil (const TickClock::time_point timePoint, Args &&... args)
 Tries to emplace the element in the queue until a given time point. More...
 
template<typename Duration , typename... Args>
int tryEmplaceUntil (const std::chrono::time_point< TickClock, Duration > timePoint, Args &&... args)
 Tries to emplace the element in the queue until a given time point. More...
 
int tryPop (T &value)
 Tries to pop the oldest (first) element from the queue. More...
 
int tryPopFor (const TickClock::duration duration, T &value)
 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, T &value)
 Tries to pop the oldest (first) element from the queue for a given duration of time. More...
 
int tryPopUntil (const TickClock::time_point timePoint, T &value)
 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, T &value)
 Tries to pop the oldest (first) element from the queue until a given time point. More...
 
int tryPush (const T &value)
 Tries to push the element to the queue. More...
 
int tryPush (T &&value)
 Tries to push the element to the queue. More...
 
int tryPushFor (const TickClock::duration duration, const T &value)
 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 T &value)
 Tries to push the element to the queue for a given duration of time. More...
 
int tryPushFor (const TickClock::duration duration, T &&value)
 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, T &&value)
 Tries to push the element to the queue for a given duration of time. More...
 
int tryPushUntil (const TickClock::time_point timePoint, const T &value)
 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 T &value)
 Tries to push the element to the queue until a given time point. More...
 
int tryPushUntil (const TickClock::time_point timePoint, T &&value)
 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, T &&value)
 Tries to push the element to the queue until a given time point. More...
 

Static Public Member Functions

static constexpr size_t getCapacity ()
 

Private Attributes

std::array< Storage, QueueSize > storage_
 storage for queue's contents More...
 

Additional Inherited Members

- Public Types inherited from distortos::FifoQueue< T >
using Storage = typename std::aligned_storage< sizeof(T), alignof(T)>::type
 type of uninitialized storage for data More...
 
using StorageUniquePointer = std::unique_ptr< Storage[], internal::FifoQueueBase::StorageUniquePointer::deleter_type >
 unique_ptr (with deleter) to Storage[] More...
 
using ValueType = T
 type of data in queue More...
 

Detailed Description

template<typename T, size_t QueueSize>
class distortos::StaticFifoQueue< T, QueueSize >

StaticFifoQueue class is a variant of FifoQueue that has automatic storage for queue's contents.

Template Parameters
Tis the type of data in queue
QueueSizeis the maximum number of elements in queue

Constructor & Destructor Documentation

◆ StaticFifoQueue()

template<typename T , size_t QueueSize>
distortos::StaticFifoQueue< T, QueueSize >::StaticFifoQueue ( )
inlineexplicit

StaticFifoQueue's constructor.

Member Function Documentation

◆ getCapacity()

template<typename T , size_t QueueSize>
static constexpr size_t distortos::StaticFifoQueue< T, QueueSize >::getCapacity ( )
inlinestatic
Returns
maximum number of elements in queue

Member Data Documentation

◆ storage_

template<typename T , size_t QueueSize>
std::array<Storage, QueueSize> distortos::StaticFifoQueue< T, QueueSize >::storage_
private

storage for queue's contents


The documentation for this class was generated from the following file: