distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
distortos::internal::SignalInformationQueue Class Reference

SignalInformationQueue class can be used for queuing of SignalInformation objects. More...

#include "distortos/internal/synchronization/SignalInformationQueue.hpp"

Collaboration diagram for distortos::internal::SignalInformationQueue:
[legend]

Classes

struct  QueueNode
 single node of internal forward list - estd::IntrusiveForwardListNode and SignalInformation More...
 

Public Types

using Storage = typename std::aligned_storage< sizeof(QueueNode), alignof(QueueNode)>::type
 type of uninitialized storage for QueueNode More...
 
using StorageUniquePointer = std::unique_ptr< Storage[], void(&)(Storage *)>
 unique_ptr (with deleter) to Storage[] More...
 

Public Member Functions

 SignalInformationQueue (StorageUniquePointer &&storageUniquePointer, size_t maxElements)
 SignalInformationQueue's constructor. More...
 
 ~SignalInformationQueue ()
 SignalInformationQueue's destructor. More...
 
std::pair< int, SignalInformationacceptQueuedSignal (uint8_t signalNumber)
 Accepts (dequeues) one of signals that are queued. More...
 
bool canQueueSignal () const
 
SignalSet getQueuedSignalSet () const
 
int queueSignal (uint8_t signalNumber, sigval value)
 Adds the signalNumber and signal value (sigval union) to list of queued SignalInformation objects. More...
 
 SignalInformationQueue (const SignalInformationQueue &)=delete
 
 SignalInformationQueue (SignalInformationQueue &&)=default
 
const SignalInformationQueueoperator= (const SignalInformationQueue &)=delete
 
SignalInformationQueueoperator= (SignalInformationQueue &&)=delete
 

Private Types

using List = estd::IntrusiveForwardList< QueueNode, &QueueNode::node >
 type of container with SignalInformation objects More...
 

Private Attributes

StorageUniquePointer storageUniquePointer_
 storage for queue elements More...
 
List signalInformationList_
 list of queued SignalInformation objects More...
 
List freeSignalInformationList_
 list of "free" SignalInformation objects More...
 

Detailed Description

SignalInformationQueue class can be used for queuing of SignalInformation objects.

Member Typedef Documentation

◆ List

◆ Storage

using distortos::internal::SignalInformationQueue::Storage = typename std::aligned_storage<sizeof(QueueNode), alignof(QueueNode)>::type

type of uninitialized storage for QueueNode

◆ StorageUniquePointer

unique_ptr (with deleter) to Storage[]

Constructor & Destructor Documentation

◆ SignalInformationQueue()

distortos::internal::SignalInformationQueue::SignalInformationQueue ( StorageUniquePointer &&  storageUniquePointer,
size_t  maxElements 
)

SignalInformationQueue's constructor.

Parameters
[in]storageUniquePointeris a rvalue reference to StorageUniquePointer with storage for queue elements (sufficiently large for maxElements Storage objects) and appropriate deleter
[in]maxElementsis the number of elements in storage array

◆ ~SignalInformationQueue()

distortos::internal::SignalInformationQueue::~SignalInformationQueue ( )

SignalInformationQueue's destructor.

Member Function Documentation

◆ acceptQueuedSignal()

std::pair< int, SignalInformation > distortos::internal::SignalInformationQueue::acceptQueuedSignal ( uint8_t  signalNumber)

Accepts (dequeues) one of signals that are queued.

This should be called when the signal is "accepted".

Parameters
[in]signalNumberis the signal that will be accepted, [0; 31]
Returns
pair with return code (0 on success, error code otherwise) and dequeued SignalInformation object; error codes:
  • EAGAIN - no SignalInformation object with signal number equal to signalNumber was queued;
Here is the call graph for this function:
Here is the caller graph for this function:

◆ canQueueSignal()

bool distortos::internal::SignalInformationQueue::canQueueSignal ( ) const
inline
Returns
true if at least one object can be queued, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getQueuedSignalSet()

SignalSet distortos::internal::SignalInformationQueue::getQueuedSignalSet ( ) const
Returns
set of currently queued signals
Here is the caller graph for this function:

◆ queueSignal()

int distortos::internal::SignalInformationQueue::queueSignal ( uint8_t  signalNumber,
sigval  value 
)

Adds the signalNumber and signal value (sigval union) to list of queued SignalInformation objects.

Parameters
[in]signalNumberis the signal that will be queued, [0; 31]
[in]valueis the signal value
Returns
0 on success, error code otherwise:
  • EAGAIN - no resources are available to queue the signal, maxElements signals are already queued;
  • EINVAL - signalNumber value is invalid;
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ freeSignalInformationList_

List distortos::internal::SignalInformationQueue::freeSignalInformationList_
private

list of "free" SignalInformation objects

◆ signalInformationList_

List distortos::internal::SignalInformationQueue::signalInformationList_
private

list of queued SignalInformation objects

◆ storageUniquePointer_

StorageUniquePointer distortos::internal::SignalInformationQueue::storageUniquePointer_
private

storage for queue elements


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