12 #ifndef HTGS_PRODUCERCONSUMEREDGE_HPP 13 #define HTGS_PRODUCERCONSUMEREDGE_HPP 19 #include <htgs/core/graph/profile/CustomProfile.hpp> 39 template<
class T,
class U,
class W>
59 bool newConnector =
false;
61 if (connector ==
nullptr) {
65 connector = std::shared_ptr<Connector<U>>(
new Connector<U>());
69 throw std::runtime_error(
70 "Error Producer Task: " + producerTaskManager->
getName() +
" for " + consumerTaskManager->
getName()
71 +
" is already connected to the graph! Are you trying to reuse the same instance and have " 72 + producerTaskManager->
getName() +
" produce to mutiple tasks?");
74 connector->incrementInputTaskCount();
80 std::shared_ptr<ProfileData> producerData(
new CreateNodeProfile(
producer, graph,
producer->getName()));
82 std::shared_ptr<ProfileData> connectorData(
new CreateConnectorProfile(connector.get(), graph, connector->getProducerCount(),
""));
84 graph->sendProfileData(producerData);
85 graph->sendProfileData(consumerData);
86 graph->sendProfileData(connectorData);
88 std::shared_ptr<ProfileData> producerConnectorData(
new CreateEdgeProfile(
producer, connector.get(),
"",
nullptr));
89 graph->sendProfileData(producerConnectorData);
92 std::shared_ptr<ProfileData> connectorConsumerData(
new CreateEdgeProfile(connector.get(),
consumer,
"",
nullptr));
93 graph->sendProfileData(connectorConsumerData);
111 #endif //HTGS_PRODUCERCONSUMEREDGE_HPP std::shared_ptr< AnyConnector > getInputConnector() override
Gets the input Connector.
Definition: TaskManager.hpp:119
ITask< T, U > * producer
The producer ITask.
Definition: ProducerConsumerEdge.hpp:106
ITask< U, W > * consumer
The consumer ITask.
Definition: ProducerConsumerEdge.hpp:107
ProducerConsumerEdge(ITask< T, U > *producer, ITask< U, W > *consumer)
Constructs a producer consumer edge.
Definition: ProducerConsumerEdge.hpp:48
ITask< T, U > * getCopy(ITask< T, U > *orig)
Gets the copy for an ITask based on some original ITask reference.
Definition: AnyTaskGraphConf.hpp:327
std::string getName()
Gets the name of the ITask.
Definition: AnyTaskManager.hpp:390
std::shared_ptr< AnyConnector > getOutputConnector() override
Gets the output Connector.
Definition: TaskManager.hpp:121
Manages the input/output of IData between Tasks.
Definition: Connector.hpp:62
TaskManager< T, U > * getTaskManager(ITask< T, U > *task)
Gets the task manager that is responsible for a particular ITask.
Definition: AnyTaskGraphConf.hpp:362
Implements the base class used by the TaskGraphConf, which removes the template arguments and impleme...
void applyEdge(AnyTaskGraphConf *graph) override
Applies an edge to a task graph.
Definition: ProducerConsumerEdge.hpp:52
An interface to process input data and forward results within a TaskGraph.
Definition: ITask.hpp:165
Encapsulates an ITask to interact with an ITask's functionality.
Definition: ITask.hpp:39
Implements the base class for the TaskGraphConf class, removing the template arguments and providing ...
Definition: AnyTaskGraphConf.hpp:66
void setInputConnector(std::shared_ptr< AnyConnector > connector) override
Sets the input BaseConnector.
Definition: TaskManager.hpp:318
EdgeDescriptor * copy(AnyTaskGraphConf *graph) override
Creates a copy of the edge descriptor to be added to other graphs, such as those within execution pip...
Definition: ProducerConsumerEdge.hpp:101
The edge descriptor is an interface used to describe how an edge is applied and copied to a task grap...
Definition: EdgeDescriptor.hpp:39
void setOutputConnector(std::shared_ptr< AnyConnector > connector) override
Sets the output BaseConnector.
Definition: TaskManager.hpp:330
Implements the edge descriptor interface to build edges for a task graph.
Implements the producer consumer edge that connects two tasks where one task is producing data and th...
Definition: ProducerConsumerEdge.hpp:40
An interface to process input data and forward results within a TaskGraph.
Definition: Bookkeeper.hpp:23
virtual std::string getName() override
Virtual function to get the name of an ITask.
Definition: ITask.hpp:236