21#ifndef HEDGEHOG_RECEIVER_ABSTRACTION_H 
   22#define HEDGEHOG_RECEIVER_ABSTRACTION_H 
   29#include "../any_groupable_abstraction.h" 
   30#include "../node/node_abstraction.h" 
   37#ifndef DOXYGEN_SHOULD_SKIP_THIS 
   39namespace implementor {
 
   43class ImplementorReceiver;
 
   49namespace abstraction {
 
   51#ifndef DOXYGEN_SHOULD_SKIP_THIS 
   55class SenderAbstraction;
 
   63  std::shared_ptr<implementor::ImplementorReceiver<Input>>
 
   66  std::shared_ptr<std::mutex> 
const 
   75      std::shared_ptr<std::mutex> slotMutex) :
 
  106  void receive(std::shared_ptr<Input> 
const inputData) {
 
  141    if (nodeReceiver == 
nullptr) {
 
  142      throw std::runtime_error(
"To print an edge, a receiver should be a NodeAbstraction.");
 
  147        for (
auto &s : connectedSender->senders()) {
 
  149          if (nodeSender == 
nullptr) {
 
  150            throw std::runtime_error(
"To print an edge, a sender should be a NodeAbstraction.");
 
  153              nodeSender, nodeReceiver,
 
  154              tool::typeToStr<Input>(),
 
  155              receiver->numberElementsReceived(), receiver->maxNumberElementsReceived());
 
Printer abstraction to get a snapshot of the metrics of the Hedgehog graph.
virtual void printEdge(core::abstraction::NodeAbstraction const *from, core::abstraction::NodeAbstraction const *to, std::string const &edgeType, size_t const &queueSize, size_t const &maxQueueSize)=0
Print edge information.
Core's abstraction to receive a piece of data.
void copyInnerStructure(ReceiverAbstraction< Input > *copyableCore)
Copy inner structure of the receiver to this one.
std::shared_ptr< std::mutex > const slotMutex_
Mutex shared from the slot abstraction.
void removeSender(SenderAbstraction< Input > *const sender)
Remove a SenderAbstraction to the concrete receiver implementation.
virtual ~ReceiverAbstraction()=default
Default destructor.
std::set< ReceiverAbstraction * > & receivers()
Accessor to receivers.
size_t maxNumberElementsReceived() const
Accessor to the maximum number of input data received and waiting to be processed.
std::shared_ptr< Input > getInputData()
Get an input data from the concrete receiver implementation.
std::set< SenderAbstraction< Input > * > const & connectedSenders() const
Accessor to the senders attached to this receiver.
void printEdgeInformation(Printer *printer)
Add to the printer the edge information.
void receive(std::shared_ptr< Input > const inputData)
Receive a piece of data.
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.
std::shared_ptr< implementor::ImplementorReceiver< Input > > concreteReceiver_
Concrete implementation of the interface.
std::set< ReceiverAbstraction * > const & receivers() const
Const accessor to receivers.
bool empty() const
Test if the receiver is empty.
size_t numberElementsReceived() const
Accessor to the current number of input data received and waiting to be processed.
void addSender(SenderAbstraction< Input > *const sender)
Add a SenderAbstraction to the concrete receiver implementation.
Core abstraction to send data.
Base core node abstraction.
Implementor for the ReceiverAbstraction.