Hedgehog  3.1.0
A library to generate hybrid pipeline workflow systems
Loading...
Searching...
No Matches
hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs > Class Template Reference

Input management abstraction for the execution pipeline. More...

#include "execution_pipeline_inputs_management_abstraction.h"

Inheritance diagram for hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >:
Inheritance graph
Collaboration diagram for hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >:
Collaboration graph

Public Member Functions

template<class ExecutionPipelineImplementation >
requires std::is_base_of_v<behavior::MultiSwitchRules<Inputs...>, ExecutionPipelineImplementation>
 ExecutionPipelineInputsManagementAbstraction (ExecutionPipelineImplementation *const executionPipeline)
 Construct an Input management abstraction for the execution pipeline from an implementation of MultiSwitchRules.
 
 ~ExecutionPipelineInputsManagementAbstraction () override=default
 Default destructor.
 
- Public Member Functions inherited from hh::core::abstraction::SlotAbstraction
 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.
 
- Public Member Functions inherited from hh::core::abstraction::ReceiverAbstraction< Inputs >
 ReceiverAbstraction (std::shared_ptr< implementor::ImplementorReceiver< Inputs > > 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< Inputs > * > const & connectedSenders () const
 Accessor to the senders attached to this receiver.
 
void receive (std::shared_ptr< Inputs > const inputData)
 Receive a piece of data.
 
std::shared_ptr< Inputs > 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< Inputs > *const sender)
 Add a SenderAbstraction to the concrete receiver implementation.
 
void removeSender (SenderAbstraction< Inputs > *const sender)
 Remove a SenderAbstraction to the concrete receiver implementation.
 
void printEdgeInformation (Printer *printer)
 Add to the printer the edge information.
 

Protected Types

using inputs_t = std::tuple< Inputs... >
 Accessor to inputs data.
 

Protected Member Functions

CoreSwitch< Inputs... > * coreSwitch () const
 Accessor to the switch core.
 
template<tool::ContainsConcept< Inputs... > Input>
bool callSendToGraph (std::shared_ptr< Input > &data, size_t const &graphId)
 Interface to the user-defined switch rule.
 
bool receiversEmpty () const
 Test if the receivers are empty.
 
void connectGraphToSwitch (std::shared_ptr< GraphInputsManagementAbstraction< Inputs... > > const graph)
 Connect a graph to the switch.
 
void disconnectSwitch ()
 Disconnect the switch from all of the graphs.
 
void wakeUp () override
 Wake up implementation (notify one node waiting on the condition variable)
 
bool canTerminate (bool lock)
 Can terminate implementation.
 
bool wait ()
 Wait statement when the node is alive and no input data are available.
 
void printEdgesInformation (Printer *printer)
 Visitor for the execution pipeline edge.
 
- Protected Member Functions inherited from hh::core::abstraction::SlotAbstraction
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.
 
- Protected Member Functions inherited from hh::core::abstraction::ReceiverAbstraction< Inputs >
void copyInnerStructure (ReceiverAbstraction< Inputs > *copyableCore)
 Copy inner structure of the receiver to this one.
 

Private Member Functions

template<class Input >
void connectInputGraphForAType (std::shared_ptr< GraphInputsManagementAbstraction< Inputs... > > const graph)
 Connect a graph to the switch for the type Input.
 

Private Attributes

std::unique_ptr< CoreSwitch< Inputs... > > coreSwitch_ = nullptr
 Core switch used to call user-defined rules.
 

Detailed Description

template<class ... Inputs>
class hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >

Input management abstraction for the execution pipeline.

Template Parameters
InputsTypes of input data

Definition at line 40 of file execution_pipeline_inputs_management_abstraction.h.

Member Typedef Documentation

◆ inputs_t

template<class ... Inputs>
using hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >::inputs_t = std::tuple<Inputs...>
protected

Accessor to inputs data.

Definition at line 46 of file execution_pipeline_inputs_management_abstraction.h.

Constructor & Destructor Documentation

◆ ExecutionPipelineInputsManagementAbstraction()

template<class ... Inputs>
template<class ExecutionPipelineImplementation >
requires std::is_base_of_v<behavior::MultiSwitchRules<Inputs...>, ExecutionPipelineImplementation>
hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >::ExecutionPipelineInputsManagementAbstraction ( ExecutionPipelineImplementation *const  executionPipeline)
inlineexplicit

Construct an Input management abstraction for the execution pipeline from an implementation of MultiSwitchRules.

Template Parameters
ExecutionPipelineImplementationType of data deriving from MultiSwitchRules
Parameters
executionPipelineImplementation of the execution pipeline

Definition at line 55 of file execution_pipeline_inputs_management_abstraction.h.

◆ ~ExecutionPipelineInputsManagementAbstraction()

Default destructor.

Member Function Documentation

◆ callSendToGraph()

template<class ... Inputs>
template<tool::ContainsConcept< Inputs... > Input>
bool hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >::callSendToGraph ( std::shared_ptr< Input > &  data,
size_t const &  graphId 
)
inlineprotected

Interface to the user-defined switch rule.

Template Parameters
InputData type to send to the graphs (should be part of the exec pipeline types)
Parameters
dataData of type Input
graphIdGraph id
Returns
True if the data needs to be sent to the graph of id graphId

Definition at line 79 of file execution_pipeline_inputs_management_abstraction.h.

◆ canTerminate()

template<class ... Inputs>
bool hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >::canTerminate ( bool  lock)
inlineprotected

Can terminate implementation.

Terminate if there is no predecessor nodes connected and if there is no data in the input queues

Parameters
lockFlag to lock the test or not
Returns
True if the node can terminate, else false

Definition at line 116 of file execution_pipeline_inputs_management_abstraction.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ connectGraphToSwitch()

template<class ... Inputs>
void hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >::connectGraphToSwitch ( std::shared_ptr< GraphInputsManagementAbstraction< Inputs... > > const  graph)
inlineprotected

Connect a graph to the switch.

Parameters
graphGraph to connect to the switch

Definition at line 89 of file execution_pipeline_inputs_management_abstraction.h.

Here is the call graph for this function:

◆ connectInputGraphForAType()

template<class ... Inputs>
template<class Input >
void hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >::connectInputGraphForAType ( std::shared_ptr< GraphInputsManagementAbstraction< Inputs... > > const  graph)
inlineprivate

Connect a graph to the switch for the type Input.

Template Parameters
InputType of input data
Parameters
graphGraph to connect to the switch

Definition at line 147 of file execution_pipeline_inputs_management_abstraction.h.

Here is the call graph for this function:

◆ coreSwitch()

template<class ... Inputs>
CoreSwitch< Inputs... > * hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >::coreSwitch ( ) const
inlineprotected

Accessor to the switch core.

Returns
Pointer to the switch core

Definition at line 69 of file execution_pipeline_inputs_management_abstraction.h.

◆ disconnectSwitch()

template<class ... Inputs>
void hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >::disconnectSwitch ( )
inlineprotected

Disconnect the switch from all of the graphs.

Definition at line 99 of file execution_pipeline_inputs_management_abstraction.h.

◆ printEdgesInformation()

template<class ... Inputs>
void hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >::printEdgesInformation ( Printer printer)
inlineprotected

Visitor for the execution pipeline edge.

Parameters
printerPrinter gathering data information

Definition at line 138 of file execution_pipeline_inputs_management_abstraction.h.

Here is the call graph for this function:

◆ receiversEmpty()

template<class ... Inputs>
bool hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >::receiversEmpty ( ) const
inlineprotected

Test if the receivers are empty.

Returns
True if the receivers queue are empty, else false

Definition at line 85 of file execution_pipeline_inputs_management_abstraction.h.

Here is the caller graph for this function:

◆ wait()

template<class ... Inputs>
bool hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >::wait ( )
inlineprotected

Wait statement when the node is alive and no input data are available.

Returns
True if the node can terminate, else false

Definition at line 126 of file execution_pipeline_inputs_management_abstraction.h.

Here is the call graph for this function:

◆ wakeUp()

template<class ... Inputs>
void hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >::wakeUp ( )
inlineoverrideprotectedvirtual

Wake up implementation (notify one node waiting on the condition variable)

Implements hh::core::abstraction::SlotAbstraction.

Definition at line 110 of file execution_pipeline_inputs_management_abstraction.h.

Here is the call graph for this function:

Member Data Documentation

◆ coreSwitch_

template<class ... Inputs>
std::unique_ptr<CoreSwitch < Inputs...> > hh::core::abstraction::ExecutionPipelineInputsManagementAbstraction< Inputs >::coreSwitch_ = nullptr
private

Core switch used to call user-defined rules.

Definition at line 44 of file execution_pipeline_inputs_management_abstraction.h.