distortos  v0.4.0
object-oriented C++ RTOS for microcontrollers
distortos::MessageQueue< T > Class Template Reference

MessageQueue class is a message queue for thread-thread, thread-interrupt or interrupt-interrupt communication. It supports multiple readers and multiple writers. It is implemented as a wrapper for internal::MessageQueueBase. More...

#include <MessageQueue.hpp>

Inheritance diagram for distortos::MessageQueue< T >:
[legend]
Collaboration diagram for distortos::MessageQueue< T >:
[legend]

Public Types

using EntryStorage = internal::MessageQueueBase::EntryStorage
 type of uninitialized storage for Entry with link More...
 
using ValueStorage = internal::MessageQueueBase::ValueStorage< T >
 type of uninitialized storage for value More...
 
using EntryStorageUniquePointer = internal::MessageQueueBase::EntryStorageUniquePointer
 import EntryStorageUniquePointer type from internal::MessageQueueBase class More...
 
using ValueStorageUniquePointer = std::unique_ptr< ValueStorage[], internal::MessageQueueBase::ValueStorageUniquePointer::deleter_type >
 unique_ptr (with deleter) to ValueStorage[] More...
 

Public Member Functions

 MessageQueue (EntryStorageUniquePointer &&entryStorageUniquePointer, ValueStorageUniquePointer &&valueStorageUniquePointer, const size_t maxElements)
 MessageQueue's constructor. More...
 
 ~MessageQueue ()
 MessageQueue's destructor. More...
 
template<typename... Args>
int emplace (const uint8_t priority, Args &&... args)
 Emplaces the element in the queue. More...
 
int pop (uint8_t &priority, T &value)
 Pops oldest element with highest priority from the queue. More...
 
int push (const uint8_t priority, const T &value)
 Pushes the element to the queue. More...
 
int push (const uint8_t priority, T &&value)
 Pushes the element to the queue. More...
 
template<typename... Args>
int tryEmplace (const uint8_t priority, Args &&... args)
 Tries to emplace the element in the queue. More...
 
template<typename... Args>
int tryEmplaceFor (const TickClock::duration duration, const uint8_t priority, 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, const uint8_t priority, 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, const uint8_t priority, 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, const uint8_t priority, Args &&... args)
 Tries to emplace the element in the queue until a given time point. More...
 
int tryPop (uint8_t &priority, T &value)
 Tries to pop oldest element with highest priority from the queue. More...
 
int tryPopFor (const TickClock::duration duration, uint8_t &priority, T &value)
 Tries to pop oldest element with highest priority from the queue for a given duration of time. More...
 
template<typename Rep , typename Period >
int tryPopFor (const std::chrono::duration< Rep, Period > duration, uint8_t &priority, T &value)
 Tries to pop oldest element with highest priority from the queue for a given duration of time. More...
 
int tryPopUntil (const TickClock::time_point timePoint, uint8_t &priority, T &value)
 Tries to pop oldest element with highest priority from the queue until a given time point. More...
 
template<typename Duration >
int tryPopUntil (const std::chrono::time_point< TickClock, Duration > timePoint, uint8_t &priority, T &value)
 Tries to pop oldest element with highest priority from the queue until a given time point. More...
 
int tryPush (const uint8_t priority, const T &value)
 Tries to push the element to the queue. More...
 
int tryPush (const uint8_t priority, T &&value)
 Tries to push the element to the queue. More...
 
int tryPushFor (const TickClock::duration duration, const uint8_t priority, 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 uint8_t priority, const T &value)
 Tries to push the element to the queue for a given duration of time. More...
 
int tryPushFor (const TickClock::duration duration, const uint8_t priority, 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 uint8_t priority, 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 uint8_t priority, 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 uint8_t priority, const T &value)
 Tries to push the element to the queue until a given time point. More...
 
int tryPushUntil (const TickClock::time_point timePoint, const uint8_t priority, 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 uint8_t priority, T &&value)
 Tries to push the element to the queue until a given time point. More...
 

Private Member Functions

template<typename... Args>
int emplaceInternal (const internal::SemaphoreFunctor &waitSemaphoreFunctor, uint8_t priority, Args &&... args)
 Emplaces the element in the queue. More...
 
int popInternal (const internal::SemaphoreFunctor &waitSemaphoreFunctor, uint8_t &priority, T &value)
 Pops oldest element with highest priority from the queue. More...
 
int pushInternal (const internal::SemaphoreFunctor &waitSemaphoreFunctor, uint8_t priority, const T &value)
 Pushes the element to the queue. More...
 
int pushInternal (const internal::SemaphoreFunctor &waitSemaphoreFunctor, uint8_t priority, T &&value)
 Pushes the element to the queue. More...
 

Private Attributes

internal::MessageQueueBase messageQueueBase_
 contained internal::MessageQueueBase object which implements whole functionality More...
 

Detailed Description

template<typename T>
class distortos::MessageQueue< T >

MessageQueue class is a message queue for thread-thread, thread-interrupt or interrupt-interrupt communication. It supports multiple readers and multiple writers. It is implemented as a wrapper for internal::MessageQueueBase.

Similar to POSIX mqd_t - http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/mqueue.h.html

Template Parameters
Tis the type of data in queue

Member Typedef Documentation

◆ EntryStorage

type of uninitialized storage for Entry with link

◆ EntryStorageUniquePointer

import EntryStorageUniquePointer type from internal::MessageQueueBase class

◆ ValueStorage

type of uninitialized storage for value

◆ ValueStorageUniquePointer

template<typename T>
using distortos::MessageQueue< T >::ValueStorageUniquePointer = std::unique_ptr<ValueStorage[], internal::MessageQueueBase::ValueStorageUniquePointer::deleter_type>

unique_ptr (with deleter) to ValueStorage[]

Constructor & Destructor Documentation

◆ MessageQueue()

template<typename T>
distortos::MessageQueue< T >::MessageQueue ( EntryStorageUniquePointer &&  entryStorageUniquePointer,
ValueStorageUniquePointer &&  valueStorageUniquePointer,
const size_t  maxElements 
)
inline

MessageQueue's constructor.

Parameters
[in]entryStorageUniquePointeris a rvalue reference to EntryStorageUniquePointer with storage for queue entries (sufficiently large for maxElements EntryStorage objects) and appropriate deleter
[in]valueStorageUniquePointeris a rvalue reference to ValueStorageUniquePointer with storage for queue elements (sufficiently large for maxElements, each sizeof(T) bytes long) and appropriate deleter
[in]maxElementsis the number of elements in entryStorage and valueStorage arrays

◆ ~MessageQueue()

template<typename T >
distortos::MessageQueue< T >::~MessageQueue ( )

MessageQueue's destructor.

Pops all remaining elements from the queue.

Here is the caller graph for this function:

Member Function Documentation

◆ emplace()

template<typename T>
template<typename... Args>
int distortos::MessageQueue< T >::emplace ( const uint8_t  priority,
Args &&...  args 
)
inline

Emplaces the element in the queue.

Similar to mq_send() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html#

Note
This function requires GCC 4.9.
Warning
This function must not be called from interrupt context!
Template Parameters
Argsare types of arguments for constructor of T
Parameters
[in]priorityis the priority of new element
[in]argsare arguments for constructor of T
Returns
zero if element was emplaced successfully, error code otherwise:

◆ emplaceInternal()

template<typename T >
template<typename... Args>
int distortos::MessageQueue< T >::emplaceInternal ( const internal::SemaphoreFunctor waitSemaphoreFunctor,
uint8_t  priority,
Args &&...  args 
)
private

Emplaces the element in the queue.

Internal version - builds the Functor object.

Note
This function requires GCC 4.9.
Template Parameters
Argsare types of arguments for constructor of T
Parameters
[in]waitSemaphoreFunctoris a reference to SemaphoreFunctor which will be executed with pushSemaphore_
[in]priorityis the priority of new element
[in]argsare arguments for constructor of T
Returns
zero if element was emplaced successfully, error code otherwise:
  • error codes returned by waitSemaphoreFunctor's operator() call;
  • error codes returned by Semaphore::post();
Here is the caller graph for this function:

◆ pop()

template<typename T>
int distortos::MessageQueue< T >::pop ( uint8_t &  priority,
T &  value 
)
inline

Pops oldest element with highest priority from the queue.

Similar to mq_receive() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_receive.html#

Warning
This function must not be called from interrupt context!
Parameters
[out]priorityis a reference to variable that will be used to return priority of popped value
[out]valueis a reference to object that will be used to return popped value, its contents are swapped with the value in the queue's storage and destructed when no longer needed
Returns
zero if element was popped successfully, error code otherwise:

◆ popInternal()

template<typename T>
int distortos::MessageQueue< T >::popInternal ( const internal::SemaphoreFunctor waitSemaphoreFunctor,
uint8_t &  priority,
T &  value 
)
private

Pops oldest element with highest priority from the queue.

Internal version - builds the Functor object.

Parameters
[in]waitSemaphoreFunctoris a reference to SemaphoreFunctor which will be executed with popSemaphore_
[out]priorityis a reference to variable that will be used to return priority of popped value
[out]valueis a reference to object that will be used to return popped value, its contents are swapped with the value in the queue's storage and destructed when no longer needed
Returns
zero if element was popped successfully, error code otherwise:
  • error codes returned by waitSemaphoreFunctor's operator() call;
  • error codes returned by Semaphore::post();
Here is the caller graph for this function:

◆ push() [1/2]

template<typename T>
int distortos::MessageQueue< T >::push ( const uint8_t  priority,
const T &  value 
)
inline

Pushes the element to the queue.

Similar to mq_send() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html#

Warning
This function must not be called from interrupt context!
Parameters
[in]priorityis the priority of new element
[in]valueis a reference to object that will be pushed, value in queue's storage is copy-constructed
Returns
zero if element was pushed successfully, error code otherwise:

◆ push() [2/2]

template<typename T>
int distortos::MessageQueue< T >::push ( const uint8_t  priority,
T &&  value 
)
inline

Pushes the element to the queue.

Similar to mq_send() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html#

Warning
This function must not be called from interrupt context!
Parameters
[in]priorityis the priority of new element
[in]valueis a rvalue reference to object that will be pushed, value in queue's storage is move-constructed
Returns
zero if element was pushed successfully, error code otherwise:

◆ pushInternal() [1/2]

template<typename T>
int distortos::MessageQueue< T >::pushInternal ( const internal::SemaphoreFunctor waitSemaphoreFunctor,
uint8_t  priority,
const T &  value 
)
private

Pushes the element to the queue.

Internal version - builds the Functor object.

Parameters
[in]waitSemaphoreFunctoris a reference to SemaphoreFunctor which will be executed with pushSemaphore_
[in]priorityis the priority of new element
[in]valueis a reference to object that will be pushed, value in queue's storage is copy-constructed
Returns
zero if element was pushed successfully, error code otherwise:
  • error codes returned by waitSemaphoreFunctor's operator() call;
  • error codes returned by Semaphore::post();
Here is the caller graph for this function:

◆ pushInternal() [2/2]

template<typename T>
int distortos::MessageQueue< T >::pushInternal ( const internal::SemaphoreFunctor waitSemaphoreFunctor,
uint8_t  priority,
T &&  value 
)
private

Pushes the element to the queue.

Internal version - builds the Functor object.

Parameters
[in]waitSemaphoreFunctoris a reference to SemaphoreFunctor which will be executed with pushSemaphore_
[in]priorityis the priority of new element
[in]valueis a rvalue reference to object that will be pushed, value in queue's storage is move-constructed
Returns
zero if element was pushed successfully, error code otherwise:
  • error codes returned by waitSemaphoreFunctor's operator() call;
  • error codes returned by Semaphore::post();

◆ tryEmplace()

template<typename T>
template<typename... Args>
int distortos::MessageQueue< T >::tryEmplace ( const uint8_t  priority,
Args &&...  args 
)
inline

Tries to emplace the element in the queue.

Similar to mq_send() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html#

Note
This function requires GCC 4.9.
Template Parameters
Argsare types of arguments for constructor of T
Parameters
[in]priorityis the priority of new element
[in]argsare arguments for constructor of T
Returns
zero if element was emplaced successfully, error code otherwise:

◆ tryEmplaceFor() [1/2]

template<typename T>
template<typename... Args>
int distortos::MessageQueue< T >::tryEmplaceFor ( const TickClock::duration  duration,
const uint8_t  priority,
Args &&...  args 
)
inline

Tries to emplace the element in the queue for a given duration of time.

Similar to mq_timedsend() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html#

Note
This function requires GCC 4.9.
Warning
This function must not be called from interrupt context!
Template Parameters
Argsare types of arguments for constructor of T
Parameters
[in]durationis the duration after which the wait will be terminated without emplacing the element
[in]priorityis the priority of new element
[in]argsare arguments for constructor of T
Returns
zero if element was emplaced successfully, error code otherwise:
Here is the caller graph for this function:

◆ tryEmplaceFor() [2/2]

template<typename T>
template<typename Rep , typename Period , typename... Args>
int distortos::MessageQueue< T >::tryEmplaceFor ( const std::chrono::duration< Rep, Period >  duration,
const uint8_t  priority,
Args &&...  args 
)
inline

Tries to emplace the element in the queue for a given duration of time.

Template variant of MessageQueue::tryEmplaceFor(TickClock::duration, uint8_t, Args&&...).

Note
This function requires GCC 4.9.
Warning
This function must not be called from interrupt context!
Template Parameters
Repis type of tick counter
Periodis std::ratio type representing the tick period of the clock, seconds
Argsare types of arguments for constructor of T
Parameters
[in]durationis the duration after which the wait will be terminated without emplacing the element
[in]priorityis the priority of new element
[in]argsare arguments for constructor of T
Returns
zero if element was emplaced successfully, error code otherwise:

◆ tryEmplaceUntil() [1/2]

template<typename T>
template<typename... Args>
int distortos::MessageQueue< T >::tryEmplaceUntil ( const TickClock::time_point  timePoint,
const uint8_t  priority,
Args &&...  args 
)
inline

Tries to emplace the element in the queue until a given time point.

Similar to mq_timedsend() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html#

Note
This function requires GCC 4.9.
Warning
This function must not be called from interrupt context!
Template Parameters
Argsare types of arguments for constructor of T
Parameters
[in]timePointis the time point at which the call will be terminated without emplacing the element
[in]priorityis the priority of new element
[in]argsare arguments for constructor of T
Returns
zero if element was emplaced successfully, error code otherwise:
Here is the caller graph for this function:

◆ tryEmplaceUntil() [2/2]

template<typename T>
template<typename Duration , typename... Args>
int distortos::MessageQueue< T >::tryEmplaceUntil ( const std::chrono::time_point< TickClock, Duration >  timePoint,
const uint8_t  priority,
Args &&...  args 
)
inline

Tries to emplace the element in the queue until a given time point.

Template variant of FifoQueue::tryEmplaceUntil(TickClock::time_point, uint8_t, Args&&...).

Note
This function requires GCC 4.9.
Warning
This function must not be called from interrupt context!
Template Parameters
Durationis a std::chrono::duration type used to measure duration
Argsare types of arguments for constructor of T
Parameters
[in]timePointis the time point at which the call will be terminated without emplacing the element
[in]priorityis the priority of new element
[in]argsare arguments for constructor of T
Returns
zero if element was emplaced successfully, error code otherwise:

◆ tryPop()

template<typename T>
int distortos::MessageQueue< T >::tryPop ( uint8_t &  priority,
T &  value 
)
inline

Tries to pop oldest element with highest priority from the queue.

Similar to mq_receive() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_receive.html#

Parameters
[out]priorityis a reference to variable that will be used to return priority of popped value
[out]valueis a reference to object that will be used to return popped value, its contents are swapped with the value in the queue's storage and destructed when no longer needed
Returns
zero if element was popped successfully, error code otherwise:
Here is the caller graph for this function:

◆ tryPopFor() [1/2]

template<typename T>
int distortos::MessageQueue< T >::tryPopFor ( const TickClock::duration  duration,
uint8_t &  priority,
T &  value 
)
inline

Tries to pop oldest element with highest priority from the queue for a given duration of time.

Similar to mq_timedreceive() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_receive.html#

Warning
This function must not be called from interrupt context!
Parameters
[in]durationis the duration after which the call will be terminated without popping the element
[out]priorityis a reference to variable that will be used to return priority of popped value
[out]valueis a reference to object that will be used to return popped value, its contents are swapped with the value in the queue's storage and destructed when no longer needed
Returns
zero if element was popped successfully, error code otherwise:
Here is the caller graph for this function:

◆ tryPopFor() [2/2]

template<typename T>
template<typename Rep , typename Period >
int distortos::MessageQueue< T >::tryPopFor ( const std::chrono::duration< Rep, Period >  duration,
uint8_t &  priority,
T &  value 
)
inline

Tries to pop oldest element with highest priority from the queue for a given duration of time.

Template variant of tryPopFor(TickClock::duration, uint8_t&, T&).

Warning
This function must not be called from interrupt context!
Template Parameters
Repis type of tick counter
Periodis std::ratio type representing the tick period of the clock, seconds
Parameters
[in]durationis the duration after which the call will be terminated without popping the element
[out]priorityis a reference to variable that will be used to return priority of popped value
[out]valueis a reference to object that will be used to return popped value, its contents are swapped with the value in the queue's storage and destructed when no longer needed
Returns
zero if element was popped successfully, error code otherwise:

◆ tryPopUntil() [1/2]

template<typename T>
int distortos::MessageQueue< T >::tryPopUntil ( const TickClock::time_point  timePoint,
uint8_t &  priority,
T &  value 
)
inline

Tries to pop oldest element with highest priority from the queue until a given time point.

Similar to mq_timedreceive() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_receive.html#

Warning
This function must not be called from interrupt context!
Parameters
[in]timePointis the time point at which the call will be terminated without popping the element
[out]priorityis a reference to variable that will be used to return priority of popped value
[out]valueis a reference to object that will be used to return popped value, its contents are swapped with the value in the queue's storage and destructed when no longer needed
Returns
zero if element was popped successfully, error code otherwise:
Here is the caller graph for this function:

◆ tryPopUntil() [2/2]

template<typename T>
template<typename Duration >
int distortos::MessageQueue< T >::tryPopUntil ( const std::chrono::time_point< TickClock, Duration >  timePoint,
uint8_t &  priority,
T &  value 
)
inline

Tries to pop oldest element with highest priority from the queue until a given time point.

Template variant of tryPopUntil(TickClock::time_point, uint8_t&, T&).

Warning
This function must not be called from interrupt context!
Template Parameters
Durationis a std::chrono::duration type used to measure duration
Parameters
[in]timePointis the time point at which the call will be terminated without popping the element
[out]priorityis a reference to variable that will be used to return priority of popped value
[out]valueis a reference to object that will be used to return popped value, its contents are swapped with the value in the queue's storage and destructed when no longer needed
Returns
zero if element was popped successfully, error code otherwise:

◆ tryPush() [1/2]

template<typename T>
int distortos::MessageQueue< T >::tryPush ( const uint8_t  priority,
const T &  value 
)
inline

Tries to push the element to the queue.

Similar to mq_send() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html#

Parameters
[in]priorityis the priority of new element
[in]valueis a reference to object that will be pushed, value in queue's storage is copy-constructed
Returns
zero if element was pushed successfully, error code otherwise:

◆ tryPush() [2/2]

template<typename T>
int distortos::MessageQueue< T >::tryPush ( const uint8_t  priority,
T &&  value 
)
inline

Tries to push the element to the queue.

Similar to mq_send() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html#

Parameters
[in]priorityis the priority of new element
[in]valueis a rvalue reference to object that will be pushed, value in queue's storage is move-constructed
Returns
zero if element was pushed successfully, error code otherwise:

◆ tryPushFor() [1/4]

template<typename T>
int distortos::MessageQueue< T >::tryPushFor ( const TickClock::duration  duration,
const uint8_t  priority,
const T &  value 
)
inline

Tries to push the element to the queue for a given duration of time.

Similar to mq_timedsend() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html#

Warning
This function must not be called from interrupt context!
Parameters
[in]durationis the duration after which the wait will be terminated without pushing the element
[in]priorityis the priority of new element
[in]valueis a reference to object that will be pushed, value in queue's storage is copy-constructed
Returns
zero if element was pushed successfully, error code otherwise:
Here is the caller graph for this function:

◆ tryPushFor() [2/4]

template<typename T>
template<typename Rep , typename Period >
int distortos::MessageQueue< T >::tryPushFor ( const std::chrono::duration< Rep, Period >  duration,
const uint8_t  priority,
const T &  value 
)
inline

Tries to push the element to the queue for a given duration of time.

Template variant of tryPushFor(TickClock::duration, uint8_t, const T&).

Warning
This function must not be called from interrupt context!
Template Parameters
Repis type of tick counter
Periodis std::ratio type representing the tick period of the clock, seconds
Parameters
[in]durationis the duration after which the wait will be terminated without pushing the element
[in]priorityis the priority of new element
[in]valueis a reference to object that will be pushed, value in queue's storage is copy-constructed
Returns
zero if element was pushed successfully, error code otherwise:

◆ tryPushFor() [3/4]

template<typename T>
int distortos::MessageQueue< T >::tryPushFor ( const TickClock::duration  duration,
const uint8_t  priority,
T &&  value 
)
inline

Tries to push the element to the queue for a given duration of time.

Similar to mq_timedsend() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html#

Warning
This function must not be called from interrupt context!
Parameters
[in]durationis the duration after which the wait will be terminated without pushing the element
[in]priorityis the priority of new element
[in]valueis a rvalue reference to object that will be pushed, value in queue's storage is move-constructed
Returns
zero if element was pushed successfully, error code otherwise:

◆ tryPushFor() [4/4]

template<typename T>
template<typename Rep , typename Period >
int distortos::MessageQueue< T >::tryPushFor ( const std::chrono::duration< Rep, Period >  duration,
const uint8_t  priority,
T &&  value 
)
inline

Tries to push the element to the queue for a given duration of time.

Template variant of tryPushFor(TickClock::duration, uint8_t, T&&).

Warning
This function must not be called from interrupt context!
Template Parameters
Repis type of tick counter
Periodis std::ratio type representing the tick period of the clock, seconds
Parameters
[in]durationis the duration after which the call will be terminated without pushing the element
[in]priorityis the priority of new element
[in]valueis a rvalue reference to object that will be pushed, value in queue's storage is move-constructed
Returns
zero if element was pushed successfully, error code otherwise:

◆ tryPushUntil() [1/4]

template<typename T>
int distortos::MessageQueue< T >::tryPushUntil ( const TickClock::time_point  timePoint,
const uint8_t  priority,
const T &  value 
)
inline

Tries to push the element to the queue until a given time point.

Similar to mq_timedsend() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html#

Warning
This function must not be called from interrupt context!
Parameters
[in]timePointis the time point at which the call will be terminated without pushing the element
[in]priorityis the priority of new element
[in]valueis a reference to object that will be pushed, value in queue's storage is copy-constructed
Returns
zero if element was pushed successfully, error code otherwise:
Here is the caller graph for this function:

◆ tryPushUntil() [2/4]

template<typename T>
template<typename Duration >
int distortos::MessageQueue< T >::tryPushUntil ( const std::chrono::time_point< TickClock, Duration >  timePoint,
const uint8_t  priority,
const T &  value 
)
inline

Tries to push the element to the queue until a given time point.

Template variant of tryPushUntil(TickClock::time_point, uint8_t, const T&).

Warning
This function must not be called from interrupt context!
Template Parameters
Durationis a std::chrono::duration type used to measure duration
Parameters
[in]timePointis the time point at which the call will be terminated without pushing the element
[in]priorityis the priority of new element
[in]valueis a reference to object that will be pushed, value in queue's storage is copy-constructed
Returns
zero if element was pushed successfully, error code otherwise:

◆ tryPushUntil() [3/4]

template<typename T>
int distortos::MessageQueue< T >::tryPushUntil ( const TickClock::time_point  timePoint,
const uint8_t  priority,
T &&  value 
)
inline

Tries to push the element to the queue until a given time point.

Similar to mq_timedsend() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html#

Warning
This function must not be called from interrupt context!
Parameters
[in]timePointis the time point at which the call will be terminated without pushing the element
[in]priorityis the priority of new element
[in]valueis a rvalue reference to object that will be pushed, value in queue's storage is move-constructed
Returns
zero if element was pushed successfully, error code otherwise:

◆ tryPushUntil() [4/4]

template<typename T>
template<typename Duration >
int distortos::MessageQueue< T >::tryPushUntil ( const std::chrono::time_point< TickClock, Duration >  timePoint,
const uint8_t  priority,
T &&  value 
)
inline

Tries to push the element to the queue until a given time point.

Template variant of tryPushUntil(TickClock::time_point, uint8_t, T&&).

Warning
This function must not be called from interrupt context!
Template Parameters
Durationis a std::chrono::duration type used to measure duration
Parameters
[in]timePointis the time point at which the call will be terminated without pushing the element
[in]priorityis the priority of new element
[in]valueis a rvalue reference to object that will be pushed, value in queue's storage is move-constructed
Returns
zero if element was pushed successfully, error code otherwise:

Member Data Documentation

◆ messageQueueBase_

template<typename T>
internal::MessageQueueBase distortos::MessageQueue< T >::messageQueueBase_
private

contained internal::MessageQueueBase object which implements whole functionality


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