21#ifndef HEDGEHOG_TASK_INPUTS_MANAGEMENT_ABSTRACTION_H
22#define HEDGEHOG_TASK_INPUTS_MANAGEMENT_ABSTRACTION_H
25#include <condition_variable>
28#include "../base/node/node_abstraction.h"
29#include "../base/execute_abstraction.h"
30#include "../base/input_output/slot_abstraction.h"
32#include "../../../tools/concepts.h"
33#include "../../implementors/concrete_implementor/default_slot.h"
34#include "../../implementors/concrete_implementor/queue_receiver.h"
35#include "../../implementors/concrete_implementor/default_execute.h"
41namespace abstraction {
45template<
class ...Inputs>
59 template<
class NodeType>
66 static_cast<behavior::Execute<Inputs>*>(nodeTask)))...,
82 std::shared_ptr<implementor::ImplementorSlot> concreteSlot,
83 std::shared_ptr<ConcreteMultiReceivers> concreteMultiReceivers,
84 std::shared_ptr<ConcreteMultiExecutes> concreteMultiExecutes) :
136 if (!typedReceiver->empty()) {
137 std::shared_ptr<InputDataType> data = typedReceiver->
getInputData();
140 std::chrono::time_point<std::chrono::system_clock> start = std::chrono::system_clock::now();
144 std::chrono::time_point<std::chrono::system_clock> finish = std::chrono::system_clock::now();
146 std::chrono::duration_cast<std::chrono::nanoseconds>(finish - start)
Printer abstraction to get a snapshot of the metrics of the Hedgehog graph.
Core execute abstraction, interface to user-defined execution.
void callExecute(std::shared_ptr< Input > data)
Interface for calling user-defined execution.
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< Input > getInputData()
Get an input data from the concrete receiver implementation.
void printEdgeInformation(Printer *printer)
Add to the printer the edge information.
Core's abstraction to receive a signal.
void unlockSlotMutex()
Unlock mutex.
std::shared_ptr< std::mutex > const & mutex() const
Protected accessor to mutex.
void lockSlotMutex()
Lock mutex.
void copyInnerStructure(SlotAbstraction *copyableCore)
Copy the inner structure of copyableCore into this.
std::shared_ptr< std::condition_variable > const & slotConditionVariable() const
Protected accessor to condition variable.
Task core abstraction used to define some method for task-like behaving cores like CoreExecutionPipel...
void incrementNumberReceivedElements()
Increment the number of elements received.
std::shared_ptr< NvtxProfiler > const & nvtxProfiler() const
Accessor to the NVTX profiler attached to the node.
void incrementPerElementExecutionDuration(std::chrono::nanoseconds const &exec)
Increase the execution time per elements.
Input management abstraction for the task.
void copyInnerStructure(TaskInputsManagementAbstraction< Inputs... > *copyableCore)
Copy the task core inner structure to this.
void wakeUp() final
Wake up implementation (notify one node waiting on the condition variable)
bool receiversEmpty() const
Test if the receivers are empty for the task.
TaskNodeAbstraction *const coreTask_
Accessor to the core task.
~TaskInputsManagementAbstraction() override=default
Default destructor.
void printEdgesInformation(Printer *printer)
Add edge information to the printer.
TaskInputsManagementAbstraction(TaskNodeAbstraction *const coreTask, std::shared_ptr< implementor::ImplementorSlot > concreteSlot, std::shared_ptr< ConcreteMultiReceivers > concreteMultiReceivers, std::shared_ptr< ConcreteMultiExecutes > concreteMultiExecutes)
Constructor using a node and the concrete implementor.
void operateReceiver()
Access the ReceiverAbstraction of the type InputDataType to process an element.
size_t totalNumberElementsReceived() const
Accessor to the total number of elements received for all input types.
void operateReceivers()
Access all the task receivers to process an element.
void callAllExecuteWithNullptr()
Call for all types the user-defined execute method with nullptr as data.
TaskInputsManagementAbstraction(NodeType *const nodeTask, TaskNodeAbstraction *const coreTask)
Constructor using a node task and its core.
std::tuple< Inputs... > inputs_t
Accessor to the input types.
Concept verifying that a type is in a variadic.
Test if a type is a valid concrete implementation of the core::implementor::ImplementorReceiver for t...
Test if a type is a valid concrete implementation of the core::implementor::ImplementorExecute for th...