Hedgehog
3.1.0
A library to generate hybrid pipeline workflow systems
|
Sink of the graph, only used in an outer graph. More...
#include "graph_sink.h"
Public Types | |
using | ResultType_t = std::shared_ptr< std::variant< std::shared_ptr< Outputs >... > > |
Accessor to the output types. | |
Public Member Functions | |
GraphSink () | |
Default constructor. | |
~GraphSink () override=default | |
Default destructor. | |
void | wakeUp () override |
Wake up implementation (notify one node waiting on the condition variable) | |
ResultType_t | getBlockingResult () |
Get a result from the sink, if none is available wait for it (block the current thread) | |
void | print (Printer *printer) |
Gather sink information. | |
std::vector< std::pair< std::string const, std::string const > > | ids () const override |
Node ids [nodeId, nodeGroupId] accessor. | |
![]() | |
NodeAbstraction (std::string name) | |
Core node constructor using the core's name. | |
virtual | ~NodeAbstraction ()=default |
DEfault destructor. | |
std::string const & | name () const |
Accessor to the core's name. | |
virtual std::string | id () const |
Core's id ('x' + address of abstraction) as string. | |
bool | isRegistered () const |
Accessor to registration flag. | |
GraphNodeAbstraction * | belongingGraph () const |
Belonging graph accessor. | |
virtual int | deviceId () const |
Get the device identifier (got from belonging graph) | |
virtual size_t | graphId () const |
Get the graph identifier (got from belonging graph) | |
std::chrono::nanoseconds const & | executionDuration () const |
Execution duration. | |
std::chrono::time_point< std::chrono::system_clock > const & | startExecutionTimeStamp () const |
Accessor to the starting execution timestamp. | |
void | startExecutionTimeStamp (std::chrono::time_point< std::chrono::system_clock > const &startExecutionTimeStamp) |
Setter to the starting execution timestamp. | |
void | incrementExecutionDuration (std::chrono::nanoseconds const &exec) |
Increment execution duration. | |
virtual void | registerNode (GraphNodeAbstraction *belongingGraph) |
Register node to the given graph. | |
virtual std::vector< std::pair< std::string const, std::string const > > | ids () const =0 |
Node ids [nodeId, nodeGroupId] accessor. | |
virtual behavior::Node * | node () const =0 |
Node accessor. | |
![]() | |
SlotAbstraction (std::shared_ptr< implementor::ImplementorSlot > concreteSlot) | |
Constructor using a concrete slot implementation. | |
virtual | ~SlotAbstraction ()=default |
Default destructor. | |
std::set< SlotAbstraction * > const & | slots () const |
Const accessor to slots. | |
std::set< SlotAbstraction * > & | slots () |
Accessor to slots. | |
std::set< NotifierAbstraction * > const & | connectedNotifiers () const |
Accessor to the NotifierAbstraction attached to this slot, protected with mutex. | |
void | addNotifier (NotifierAbstraction *const notifier) |
Add a NotifierAbstraction to this slot. | |
void | removeNotifier (NotifierAbstraction *const notifier) |
Remove a NotifierAbstraction to this slot. | |
virtual void | wakeUp ()=0 |
Wake up mechanism, called to notify the std::condition_variable. | |
bool | hasNotifierConnected () const |
Test if there is at least one notifier connected. | |
void | lockSlotMutex () |
Lock mutex. | |
void | unlockSlotMutex () |
Unlock mutex. | |
![]() | |
ReceiverAbstraction (std::shared_ptr< implementor::ImplementorReceiver< Outputs > > concreteReceiver, std::shared_ptr< std::mutex > slotMutex) | |
Constructor using a concrete implementation of a receiver implementor, and the mutex from the slot. | |
virtual | ~ReceiverAbstraction ()=default |
Default destructor. | |
std::set< ReceiverAbstraction * > const & | receivers () const |
Const accessor to receivers. | |
std::set< ReceiverAbstraction * > & | receivers () |
Accessor to receivers. | |
std::set< SenderAbstraction< Outputs > * > const & | connectedSenders () const |
Accessor to the senders attached to this receiver. | |
void | receive (std::shared_ptr< Outputs > const inputData) |
Receive a piece of data. | |
std::shared_ptr< Outputs > | getInputData () |
Get an input data from the concrete receiver implementation. | |
size_t | numberElementsReceived () const |
Accessor to the current number of input data received and waiting to be processed. | |
size_t | maxNumberElementsReceived () const |
Accessor to the maximum number of input data received and waiting to be processed. | |
bool | empty () const |
Test if the receiver is empty. | |
void | addSender (SenderAbstraction< Outputs > *const sender) |
Add a SenderAbstraction to the concrete receiver implementation. | |
void | removeSender (SenderAbstraction< Outputs > *const sender) |
Remove a SenderAbstraction to the concrete receiver implementation. | |
void | printEdgeInformation (Printer *printer) |
Add to the printer the edge information. | |
Private Member Functions | |
template<class Output > | |
void | getOneAvailableResultForAType (bool &outputFound, ResultType_t &res) |
Test if there is an available output data for a data. | |
bool | receiversEmpty () |
Test if the receivers for all types are empty. | |
behavior::Node * | node () const override |
Getter to the node counterpart. | |
Additional Inherited Members | |
![]() | |
std::shared_ptr< std::mutex > const & | mutex () const |
Protected accessor to mutex. | |
std::shared_ptr< std::condition_variable > const & | slotConditionVariable () const |
Protected accessor to condition variable. | |
void | copyInnerStructure (SlotAbstraction *copyableCore) |
Copy the inner structure of copyableCore into this. | |
![]() | |
void | copyInnerStructure (ReceiverAbstraction< Outputs > *copyableCore) |
Copy inner structure of the receiver to this one. | |
Sink of the graph, only used in an outer graph.
Outputs | Output list types of the graph |
Definition at line 40 of file graph_sink.h.
using hh::core::GraphSink< Outputs >::ResultType_t = std::shared_ptr<std::variant<std::shared_ptr<Outputs>...> > |
Accessor to the output types.
Definition at line 45 of file graph_sink.h.
|
inline |
Default constructor.
Definition at line 48 of file graph_sink.h.
|
overridedefault |
Default destructor.
|
inline |
Get a result from the sink, if none is available wait for it (block the current thread)
Definition at line 63 of file graph_sink.h.
|
inlineprivate |
Test if there is an available output data for a data.
If none as been previously found (outputFound == true) and if the receiver for this type is not empty, get a data from the receiver
Output | Type of the output data |
outputFound | Flag to avoid getting multiple output data in one run |
res | Output data |
Definition at line 102 of file graph_sink.h.
|
inlineoverridevirtual |
Node ids [nodeId, nodeGroupId] accessor.
Implements hh::core::abstraction::NodeAbstraction.
Definition at line 90 of file graph_sink.h.
|
inlineoverrideprivatevirtual |
Getter to the node counterpart.
std::runtime_error | because there is no Node attached to the core |
Implements hh::core::abstraction::NodeAbstraction.
Definition at line 118 of file graph_sink.h.
|
inline |
Gather sink information.
printer | Printer visitor gathering information on nodes |
Definition at line 83 of file graph_sink.h.
|
inlineprivate |
Test if the receivers for all types are empty.
Definition at line 113 of file graph_sink.h.
|
inlineoverridevirtual |
Wake up implementation (notify one node waiting on the condition variable)
Implements hh::core::abstraction::SlotAbstraction.
Definition at line 59 of file graph_sink.h.