distortos  v0.5.0
object-oriented C++ RTOS for microcontrollers
SignalInformationQueue.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_SIGNALINFORMATIONQUEUE_HPP_
13 #define INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_SIGNALINFORMATIONQUEUE_HPP_
14 
16 
17 #if CONFIG_SIGNALS_ENABLE == 1
18 
20 
22 
23 #include <memory>
24 
25 namespace distortos
26 {
27 
28 class SignalSet;
29 
30 namespace internal
31 {
32 
35 {
36 public:
37 
39  struct QueueNode
40  {
43 
46  };
47 
49  using Storage = typename std::aligned_storage<sizeof(QueueNode), alignof(QueueNode)>::type;
50 
52  using StorageUniquePointer = std::unique_ptr<Storage[], void(&)(Storage*)>;
53 
62  SignalInformationQueue(StorageUniquePointer&& storageUniquePointer, size_t maxElements);
63 
69 
82  std::pair<int, SignalInformation> acceptQueuedSignal(uint8_t signalNumber);
83 
88  bool canQueueSignal() const
89  {
90  return freeSignalInformationList_.empty() == false;
91  }
92 
98 
110  int queueSignal(uint8_t signalNumber, sigval value);
111 
114  const SignalInformationQueue& operator=(const SignalInformationQueue&) = delete;
115  SignalInformationQueue& operator=(SignalInformationQueue&&) = delete;
116 
117 private:
118 
121 
124 
127 
130 };
131 
132 } // namespace internal
133 
134 } // namespace distortos
135 
136 #endif // CONFIG_SIGNALS_ENABLE == 1
137 
138 #endif // INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_SIGNALINFORMATIONQUEUE_HPP_
SignalInformation signalInformation
queued SignalInformation
Definition: SignalInformationQueue.hpp:45
Definition: signal.h:28
std::pair< int, SignalInformation > acceptQueuedSignal(uint8_t signalNumber)
Accepts (dequeues) one of signals that are queued.
Definition: SignalInformationQueue.cpp:47
single node of internal forward list - estd::IntrusiveForwardListNode and SignalInformation ...
Definition: SignalInformationQueue.hpp:39
StorageUniquePointer storageUniquePointer_
storage for queue elements
Definition: SignalInformationQueue.hpp:123
IntrusiveForwardListNode class is the node that is needed for the object to be linked in IntrusiveFor...
Definition: IntrusiveForwardList.hpp:38
List signalInformationList_
list of queued SignalInformation objects
Definition: SignalInformationQueue.hpp:126
typename std::aligned_storage< sizeof(QueueNode), alignof(QueueNode)>::type Storage
type of uninitialized storage for QueueNode
Definition: SignalInformationQueue.hpp:49
distortos configuration
SignalSet class is used as a set of signals.
Definition: SignalSet.hpp:28
Top-level namespace of distortos project.
IntrusiveForwardList template class header.
SignalInformationQueue(StorageUniquePointer &&storageUniquePointer, size_t maxElements)
SignalInformationQueue&#39;s constructor.
Definition: SignalInformationQueue.cpp:30
std::unique_ptr< Storage[], void(&)(Storage *)> StorageUniquePointer
unique_ptr (with deleter) to Storage[]
Definition: SignalInformationQueue.hpp:52
~SignalInformationQueue()
SignalInformationQueue&#39;s destructor.
Definition: SignalInformationQueue.cpp:42
SignalInformationQueue class can be used for queuing of SignalInformation objects.
Definition: SignalInformationQueue.hpp:34
bool canQueueSignal() const
Definition: SignalInformationQueue.hpp:88
SignalInformation class contains information about queued signal.
Definition: SignalInformation.hpp:29
SignalInformation class header.
estd::IntrusiveForwardListNode node
node for intrusive forward list
Definition: SignalInformationQueue.hpp:42
bool empty() const
Definition: IntrusiveForwardList.hpp:966
int queueSignal(uint8_t signalNumber, sigval value)
Adds the signalNumber and signal value (sigval union) to list of queued SignalInformation objects...
Definition: SignalInformationQueue.cpp:77
SignalSet getQueuedSignalSet() const
Definition: SignalInformationQueue.cpp:69
List freeSignalInformationList_
list of "free" SignalInformation objects
Definition: SignalInformationQueue.hpp:129