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

Input management abstraction for the graph. More...

#include "graph_inputs_management_abstraction.h"

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

Public Types

using inputs_t = std::tuple< Inputs... >
 Accessor to the graph's inputs.
 

Public Member Functions

 GraphInputsManagementAbstraction ()
 Default constructor.
 
 ~GraphInputsManagementAbstraction () override=default
 Default destructor.
 
void wakeUp () override
 Graph wake up, wakes up all registered slots of the input node.
 
bool wait ()
 Wait for the graph, should not be called a graph does not wait !
 
- 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 Member Functions

std::unique_ptr< GraphSource< Inputs... > > const & source () const
 Source accessor.
 
void terminateSource ()
 Terminate a source, notify all input nodes to terminate.
 
template<class InputDataType >
void addInputNodeToGraph (NodeAbstraction *const inputNode)
 Add an input node to a graph.
 
void disconnectSource ()
 Disconnect the source when the graph is set as inside.
 
template<class Input >
void sendInputDataToSource (std::shared_ptr< Input > data)
 Send a data to the source.
 
void printSource (Printer *printer)
 Gather source information.
 
void duplicateSourceEdges (GraphInputsManagementAbstraction< Inputs... > const &rhs, std::map< abstraction::NodeAbstraction *, std::shared_ptr< NodeAbstraction > > &mapping)
 Duplicate source edges.
 
- 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 disconnectSourceFromReceiver ()
 Disconnect the source from the input node receivers.
 
template<class Input >
void duplicateSourceEdge (GraphInputsManagementAbstraction< Inputs... > const &rhs, std::map< abstraction::NodeAbstraction *, std::shared_ptr< NodeAbstraction > > &correspondenceMap)
 Duplicate source edge for a type.
 

Private Attributes

std::unique_ptr< GraphSource< Inputs... > > source_ = nullptr
 Graph's source.
 

Detailed Description

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

Input management abstraction for the graph.

Template Parameters
InputsTypes of input data

Definition at line 48 of file graph_inputs_management_abstraction.h.

Member Typedef Documentation

◆ inputs_t

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

Accessor to the graph's inputs.

Definition at line 55 of file graph_inputs_management_abstraction.h.

Constructor & Destructor Documentation

◆ GraphInputsManagementAbstraction()

template<class ... Inputs>
hh::core::abstraction::GraphInputsManagementAbstraction< Inputs >::GraphInputsManagementAbstraction ( )
inline

Default constructor.

Definition at line 58 of file graph_inputs_management_abstraction.h.

◆ ~GraphInputsManagementAbstraction()

template<class ... Inputs>
hh::core::abstraction::GraphInputsManagementAbstraction< Inputs >::~GraphInputsManagementAbstraction ( )
overridedefault

Default destructor.

Member Function Documentation

◆ addInputNodeToGraph()

template<class ... Inputs>
template<class InputDataType >
void hh::core::abstraction::GraphInputsManagementAbstraction< Inputs >::addInputNodeToGraph ( NodeAbstraction *const  inputNode)
inlineprotected

Add an input node to a graph.

Template Parameters
InputDataTypeInput data type
Parameters
inputNodeNode to add as input of the graph for the type InputDataType

Definition at line 98 of file graph_inputs_management_abstraction.h.

Here is the call graph for this function:

◆ disconnectSource()

template<class ... Inputs>
void hh::core::abstraction::GraphInputsManagementAbstraction< Inputs >::disconnectSource ( )
inlineprotected

Disconnect the source when the graph is set as inside.

Definition at line 128 of file graph_inputs_management_abstraction.h.

Here is the call graph for this function:

◆ disconnectSourceFromReceiver()

template<class ... Inputs>
template<class Input >
void hh::core::abstraction::GraphInputsManagementAbstraction< Inputs >::disconnectSourceFromReceiver ( )
inlineprivate

Disconnect the source from the input node receivers.

Template Parameters
InputType of input node receivers to disconnect from the source

Definition at line 170 of file graph_inputs_management_abstraction.h.

Here is the call graph for this function:

◆ duplicateSourceEdge()

template<class ... Inputs>
template<class Input >
void hh::core::abstraction::GraphInputsManagementAbstraction< Inputs >::duplicateSourceEdge ( GraphInputsManagementAbstraction< Inputs... > const &  rhs,
std::map< abstraction::NodeAbstraction *, std::shared_ptr< NodeAbstraction > > &  correspondenceMap 
)
inlineprivate

Duplicate source edge for a type.

Template Parameters
InputType of input node receivers to duplicate
Parameters
rhsGraph input to copy the source edges from
correspondenceMapMap from node to its clone

Definition at line 188 of file graph_inputs_management_abstraction.h.

Here is the call graph for this function:

◆ duplicateSourceEdges()

template<class ... Inputs>
void hh::core::abstraction::GraphInputsManagementAbstraction< Inputs >::duplicateSourceEdges ( GraphInputsManagementAbstraction< Inputs... > const &  rhs,
std::map< abstraction::NodeAbstraction *, std::shared_ptr< NodeAbstraction > > &  mapping 
)
inlineprotected

Duplicate source edges.

Parameters
rhsGraph input to copy the source edges from
mappingMap from node to its clone

Definition at line 161 of file graph_inputs_management_abstraction.h.

◆ printSource()

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

Gather source information.

Parameters
printerVisitor printer gathering source information

Definition at line 152 of file graph_inputs_management_abstraction.h.

◆ sendInputDataToSource()

template<class ... Inputs>
template<class Input >
void hh::core::abstraction::GraphInputsManagementAbstraction< Inputs >::sendInputDataToSource ( std::shared_ptr< Input >  data)
inlineprotected

Send a data to the source.

Template Parameters
InputType of the input data
Parameters
dataData of type Input

Definition at line 148 of file graph_inputs_management_abstraction.h.

◆ source()

template<class ... Inputs>
std::unique_ptr< GraphSource< Inputs... > > const & hh::core::abstraction::GraphInputsManagementAbstraction< Inputs >::source ( ) const
inlineprotected

Source accessor.

Returns
Graph's source

Definition at line 89 of file graph_inputs_management_abstraction.h.

◆ terminateSource()

template<class ... Inputs>
void hh::core::abstraction::GraphInputsManagementAbstraction< Inputs >::terminateSource ( )
inlineprotected

Terminate a source, notify all input nodes to terminate.

Definition at line 92 of file graph_inputs_management_abstraction.h.

◆ wait()

template<class ... Inputs>
bool hh::core::abstraction::GraphInputsManagementAbstraction< Inputs >::wait ( )
inline

Wait for the graph, should not be called a graph does not wait !

Returns
nothing, throw in all cases
Exceptions
std::runtime_errorIl all cases, a graph can not wait

Definition at line 84 of file graph_inputs_management_abstraction.h.

◆ wakeUp()

template<class ... Inputs>
void hh::core::abstraction::GraphInputsManagementAbstraction< Inputs >::wakeUp ( )
inlineoverridevirtual

Graph wake up, wakes up all registered slots of the input node.

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

Definition at line 75 of file graph_inputs_management_abstraction.h.

Here is the call graph for this function:

Member Data Documentation

◆ source_

template<class ... Inputs>
std::unique_ptr<GraphSource < Inputs...> > hh::core::abstraction::GraphInputsManagementAbstraction< Inputs >::source_ = nullptr
private

Graph's source.

Definition at line 52 of file graph_inputs_management_abstraction.h.