![]() |
dfx 0.1.0
Linux-based dynamic dataflow executor
|
Bounded SPSC (Single Producer / Single Consumer) channel. More...
#include <dfx-core/channels/SPSCChannel.hpp>
Public Member Functions | |
| bool | pushMessage (MessagePtr msg) override |
| Enqueue a message coming from the producer side. | |
| bool | hasPendingMessage () const override |
| Whether at least one message is pending. | |
| std::size_t | pendingMessageCount () const override |
| Number of pending messages currently buffered. | |
| std::optional< MessagePtr > | pop () override |
| Pop the next pending message. | |
| Channel (Id id, InputPort &inputPort, OutputPort &outputPort) | |
| Construct a channel linking one input port to one output port. | |
| Public Member Functions inherited from dfx::Core::Channel | |
| Channel (Id id, InputPort &inputPort, OutputPort &outputPort) | |
| Construct a channel linking one input port to one output port. | |
| DISABLE_COPY_AND_MOVE (Channel) | |
| Channel is not copiable nor movable. | |
| virtual | ~Channel ()=default |
| Virtual destructor. | |
| Id | id () const noexcept |
| Get the channel id. | |
| template<DerivedFromChannel T> | |
| bool | is () const noexcept |
| Check whether this channel is of a given derived type. | |
| template<DerivedFromChannel T> | |
| T & | as () noexcept |
| Cast this channel to a derived type (unchecked). | |
| template<DerivedFromChannel T> | |
| T const & | as () const noexcept |
| Cast this channel to a derived type (unchecked). | |
| InputPort & | inputPort () const noexcept |
| Destination (consumer) endpoint of this channel. | |
| OutputPort & | outputPort () const noexcept |
| Source (producer) endpoint of this channel. | |
| void | setDeliveryHook (Hooks::Delivery *hook) |
| Set the optional delivery hook for this channel. | |
Additional Inherited Members | |
| Public Types inherited from dfx::Core::Channel | |
| using | Id = uint32_t |
| Identifier type (unique within a graph instance, by convention). | |
| Protected Attributes inherited from dfx::Core::Channel | |
| InputPort & | _inputPort |
| Destination port (consumer). | |
| OutputPort & | _outputPort |
| Source port (producer). | |
| Hooks::Delivery * | _deliveryHook = nullptr |
| Optional delivery hook (non-owning). | |
Bounded SPSC (Single Producer / Single Consumer) channel.
| dfx::Core::Channel::Channel | ( | Id | id, |
| InputPort & | inputPort, | ||
| OutputPort & | outputPort ) |
Construct a channel linking one input port to one output port.
| id | Channel id. |
| inputPort | Destination port (consumer). |
| outputPort | Source port (producer). |
|
overridevirtual |
Whether at least one message is pending.
Implements dfx::Core::Channel.
|
overridevirtual |
Number of pending messages currently buffered.
Implements dfx::Core::Channel.
|
overridevirtual |
Pop the next pending message.
Uses a non-blocking peek (tryFront()), then moves the stored pointer out and removes the element from the queue.
Implements dfx::Core::Channel.
|
overridevirtual |
Enqueue a message coming from the producer side.
| msg | Message to enqueue. |
Implements dfx::Core::Channel.