Hedgehog  3.1.0
A library to generate hybrid pipeline workflow systems
Loading...
Searching...
No Matches
task_outputs_management_abstraction.h
Go to the documentation of this file.
1// NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the
2// software in any medium, provided that you keep intact this entire notice. You may improve, modify and create
3// derivative works of the software or any portion of the software, and you may copy and distribute such modifications
4// or works. Modified works should carry a notice stating that you changed the software and should note the date and
5// nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the
6// source of the software. NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND,
7// EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
8// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR
9// WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE
10// CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS
11// THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. You
12// are solely responsible for determining the appropriateness of using and distributing the software and you assume
13// all risks associated with its use, including but not limited to the risks and costs of program errors, compliance
14// with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of
15// operation. This software is not intended to be used in any situation where a failure could cause risk of injury or
16// damage to property. The software developed by NIST employees is not subject to copyright protection within the
17// United States.
18
19
20
21#ifndef HEDGEHOG_TASK_OUTPUTS_MANAGEMENT_ABSTRACTION_H
22#define HEDGEHOG_TASK_OUTPUTS_MANAGEMENT_ABSTRACTION_H
23
24#include <ostream>
25
26#include "../../../api/printer/printer.h"
27#include "../base/input_output/notifier_abstraction.h"
28#include "../base/input_output/receiver_abstraction.h"
29
30#include "../../implementors/concrete_implementor/default_notifier.h"
31#include "../../implementors/concrete_implementor/default_sender.h"
32
33#include "../../../tools/concepts.h"
34
36namespace hh {
38namespace core {
40namespace abstraction {
41
44template<class ...Outputs>
46 public:
47 using outputs_t = std::tuple<Outputs...>;
48
51 : NotifierAbstraction(std::make_shared<implementor::DefaultNotifier>()),
52 SenderAbstraction<Outputs>(std::make_shared<implementor::DefaultSender<Outputs>>())... {}
53
58 template<hh::tool::ConcreteMultiSenderImplementation<Outputs...> ConcreteMultiSenders>
60 std::shared_ptr<implementor::ImplementorNotifier> concreteNotifier,
61 std::shared_ptr<ConcreteMultiSenders> concreteMultiSenders)
62 : NotifierAbstraction(concreteNotifier),
63 SenderAbstraction<Outputs>(concreteMultiSenders)... {}
64
67
71 template<tool::ContainsConcept<Outputs...> OutputDataType>
72 void sendAndNotify(std::shared_ptr<OutputDataType> data) {
73 static_cast<SenderAbstraction<OutputDataType> *>(this)->send(data);
74 static_cast<NotifierAbstraction *>(this)->notify();
75 }
76
77
78 protected:
83 }
84
87 void duplicateOutputEdges(std::map<abstraction::NodeAbstraction *, std::shared_ptr<NodeAbstraction>> &mapping){
89 this->duplicateEdgeNotifier(mapping);
90 }
91};
92}
93}
94}
95#endif //HEDGEHOG_TASK_OUTPUTS_MANAGEMENT_ABSTRACTION_H
Hedgehog main namespace.
Core abstraction to notify slots.
void duplicateEdgeNotifier(std::map< abstraction::NodeAbstraction *, std::shared_ptr< NodeAbstraction > > &mapping)
Duplicate edges of the current notifier to slots to clone in map.
void notify()
Notify a slot to wake up.
Core abstraction to send data.
void duplicateEdgeSender(std::map< abstraction::NodeAbstraction *, std::shared_ptr< NodeAbstraction > > &mapping)
Duplicate edges of the current sender to receiver to clone in map.
void copyInnerStructure(SenderAbstraction< Output > *copyableCore)
Copy inner structure of the sender to this one.
void send(std::shared_ptr< Outputs > data)
Send a data as output of the node.
void copyInnerStructure(TaskOutputsManagementAbstraction< Outputs... > *copyableCore)
Copy the inner structure from another task.
~TaskOutputsManagementAbstraction() override=default
Default destructor.
void duplicateOutputEdges(std::map< abstraction::NodeAbstraction *, std::shared_ptr< NodeAbstraction > > &mapping)
Duplicate the output edges for the node clone.
void sendAndNotify(std::shared_ptr< OutputDataType > data)
Send a piece of data and notify the successors.
TaskOutputsManagementAbstraction(std::shared_ptr< implementor::ImplementorNotifier > concreteNotifier, std::shared_ptr< ConcreteMultiSenders > concreteMultiSenders)
Constructor using concrete implementation of the possible core abstraction.
std::tuple< Outputs... > outputs_t
Accessor to the graph outputs type.
Concept verifying that a type is in a variadic.
Definition: concepts.h:86
Test if a type is a valid concrete implementation of the core::implementor::ImplementorSender for the...
Definition: concepts.h:271