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

Core's abstraction to receive a piece of data. More...

#include "receiver_abstraction.h"

Inheritance diagram for hh::core::abstraction::ReceiverAbstraction< Input >:
Inheritance graph
Collaboration diagram for hh::core::abstraction::ReceiverAbstraction< Input >:
Collaboration graph

Public Member Functions

 ReceiverAbstraction (std::shared_ptr< implementor::ImplementorReceiver< Input > > 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< Input > * > const & connectedSenders () const
 Accessor to the senders attached to this receiver.
 
void receive (std::shared_ptr< Input > const inputData)
 Receive a piece of data.
 
std::shared_ptr< Input > 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< Input > *const sender)
 Add a SenderAbstraction to the concrete receiver implementation.
 
void removeSender (SenderAbstraction< Input > *const sender)
 Remove a SenderAbstraction to the concrete receiver implementation.
 
void printEdgeInformation (Printer *printer)
 Add to the printer the edge information.
 

Protected Member Functions

void copyInnerStructure (ReceiverAbstraction< Input > *copyableCore)
 Copy inner structure of the receiver to this one.
 

Private Attributes

std::shared_ptr< implementor::ImplementorReceiver< Input > > concreteReceiver_ = nullptr
 Concrete implementation of the interface.
 
std::shared_ptr< std::mutex > const slotMutex_ = nullptr
 Mutex shared from the slot abstraction.
 

Detailed Description

template<class Input>
class hh::core::abstraction::ReceiverAbstraction< Input >

Core's abstraction to receive a piece of data.

Template Parameters
InputType of data received by the abstraction

Definition at line 61 of file receiver_abstraction.h.

Constructor & Destructor Documentation

◆ ReceiverAbstraction()

template<class Input >
hh::core::abstraction::ReceiverAbstraction< Input >::ReceiverAbstraction ( std::shared_ptr< implementor::ImplementorReceiver< Input > >  concreteReceiver,
std::shared_ptr< std::mutex >  slotMutex 
)
inlineexplicit

Constructor using a concrete implementation of a receiver implementor, and the mutex from the slot.

Parameters
concreteReceiverConcrete implementation of the ImplementorReceiver
slotMutexMutex from the slot

Definition at line 73 of file receiver_abstraction.h.

◆ ~ReceiverAbstraction()

template<class Input >
virtual hh::core::abstraction::ReceiverAbstraction< Input >::~ReceiverAbstraction ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ addSender()

template<class Input >
void hh::core::abstraction::ReceiverAbstraction< Input >::addSender ( SenderAbstraction< Input > *const  sender)
inline

Add a SenderAbstraction to the concrete receiver implementation.

Parameters
senderSenderAbstraction to add

Definition at line 130 of file receiver_abstraction.h.

◆ connectedSenders()

template<class Input >
std::set< SenderAbstraction< Input > * > const & hh::core::abstraction::ReceiverAbstraction< Input >::connectedSenders ( ) const
inline

Accessor to the senders attached to this receiver.

Returns
The SenderAbstraction attached to this receiver

Definition at line 98 of file receiver_abstraction.h.

◆ copyInnerStructure()

template<class Input >
void hh::core::abstraction::ReceiverAbstraction< Input >::copyInnerStructure ( ReceiverAbstraction< Input > *  copyableCore)
inlineprotected

Copy inner structure of the receiver to this one.

Parameters
copyableCoreReceiverAbstraction to copy into this

Definition at line 164 of file receiver_abstraction.h.

Here is the caller graph for this function:

◆ empty()

template<class Input >
bool hh::core::abstraction::ReceiverAbstraction< Input >::empty ( ) const
inline

Test if the receiver is empty.

Returns
True if the receiver is empty, else false

Definition at line 126 of file receiver_abstraction.h.

◆ getInputData()

template<class Input >
std::shared_ptr< Input > hh::core::abstraction::ReceiverAbstraction< Input >::getInputData ( )
inline

Get an input data from the concrete receiver implementation.

Returns
An input data

Definition at line 114 of file receiver_abstraction.h.

Here is the caller graph for this function:

◆ maxNumberElementsReceived()

template<class Input >
size_t hh::core::abstraction::ReceiverAbstraction< Input >::maxNumberElementsReceived ( ) const
inline

Accessor to the maximum number of input data received and waiting to be processed.

Returns
The maximum number of input data received and waiting to be processed

Definition at line 122 of file receiver_abstraction.h.

◆ numberElementsReceived()

template<class Input >
size_t hh::core::abstraction::ReceiverAbstraction< Input >::numberElementsReceived ( ) const
inline

Accessor to the current number of input data received and waiting to be processed.

Returns
The current number of input data received and waiting to be processed

Definition at line 118 of file receiver_abstraction.h.

◆ printEdgeInformation()

template<class Input >
void hh::core::abstraction::ReceiverAbstraction< Input >::printEdgeInformation ( Printer printer)
inline

Add to the printer the edge information.

Parameters
printerPrinter used to gather information
Exceptions
std::runtime_errorIf the current node is not a NodeAbstraction, if a sender is not a NodeAbstraction

Definition at line 139 of file receiver_abstraction.h.

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

◆ receive()

template<class Input >
void hh::core::abstraction::ReceiverAbstraction< Input >::receive ( std::shared_ptr< Input > const  inputData)
inline

Receive a piece of data.

Receive a piece of data and transmit it to the concrete receiver implementation. The call to the concrete receiver is protected via the mutex

Parameters
inputDataData to transmit to the implementation

Definition at line 106 of file receiver_abstraction.h.

◆ receivers() [1/2]

template<class Input >
std::set< ReceiverAbstraction * > & hh::core::abstraction::ReceiverAbstraction< Input >::receivers ( )
inline

Accessor to receivers.

Present the receivers linked to this abstraction, usually one, may be multiple for the graph presenting all of the input node receivers

Returns
Reference to receivers

Definition at line 94 of file receiver_abstraction.h.

◆ receivers() [2/2]

template<class Input >
std::set< ReceiverAbstraction * > const & hh::core::abstraction::ReceiverAbstraction< Input >::receivers ( ) const
inline

Const accessor to receivers.

Present the receivers linked to this abstraction, usually one, may be multiple for the graph presenting all of the input node receivers

Returns
Const reference to receivers

Definition at line 88 of file receiver_abstraction.h.

Here is the caller graph for this function:

◆ removeSender()

template<class Input >
void hh::core::abstraction::ReceiverAbstraction< Input >::removeSender ( SenderAbstraction< Input > *const  sender)
inline

Remove a SenderAbstraction to the concrete receiver implementation.

Parameters
senderSenderAbstraction to remove

Definition at line 134 of file receiver_abstraction.h.

Member Data Documentation

◆ concreteReceiver_

template<class Input >
std::shared_ptr<implementor::ImplementorReceiver<Input> > hh::core::abstraction::ReceiverAbstraction< Input >::concreteReceiver_ = nullptr
private

Concrete implementation of the interface.

Definition at line 64 of file receiver_abstraction.h.

◆ slotMutex_

template<class Input >
std::shared_ptr<std::mutex> const hh::core::abstraction::ReceiverAbstraction< Input >::slotMutex_ = nullptr
private

Mutex shared from the slot abstraction.

Definition at line 67 of file receiver_abstraction.h.