Hedgehog  0.0.0
A library to generate hybrid pipeline workflow systems
core_graph_multi_receivers.h
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 #ifndef HEDGEHOG_CORE_GRAPH_MULTI_RECEIVERS_H
21 #define HEDGEHOG_CORE_GRAPH_MULTI_RECEIVERS_H
22 
23 #include "../../base/receiver/core_slot.h"
24 #include "../../base/receiver/core_multi_receivers.h"
25 #include "core_graph_receiver.h"
26 
28 namespace hh::core {
29 
32 template<class ...GraphInputs>
34  : public CoreMultiReceivers<GraphInputs...>, public CoreGraphReceiver<GraphInputs> ... {
35  public:
40  CoreGraphMultiReceivers(std::string_view const &name, NodeType const type, size_t const numberThreads)
41  : CoreSlot(name, type, numberThreads),
42  CoreMultiReceivers<GraphInputs...>(name, type, numberThreads),
43  CoreGraphReceiver<GraphInputs>(name, type, numberThreads)... {
44  HLOG_SELF(0, "Creating CoreGraphMultiReceivers with type: " << (int) type << " and name: " << name)
45  }
46 
48  ~CoreGraphMultiReceivers() override {HLOG_SELF(0, "Destructing CoreGraphMultiReceivers")}
49 
52  bool receiversEmpty() final { return (static_cast<CoreGraphReceiver<GraphInputs> *>(this)->receiverEmpty() && ...); }
53 
57  [[noreturn]] behavior::Node *node() override {
58  std::ostringstream oss;
59  oss << "Internal error, should not be called, graph does not have a node: " << __FUNCTION__;
60  HLOG_SELF(0, oss.str())
61  throw (std::runtime_error(oss.str()));
62  }
63 };
64 
65 }
66 #endif //HEDGEHOG_CORE_GRAPH_MULTI_RECEIVERS_H
NodeType type() const
Node type accessor.
Definition: core_node.h:132
Graph Receiver for a type GraphInput.
Multi receiver interface, gather multiple CoreReceiver.
Node Behavior definition.
Definition: node.h:39
Slot interface, receive notification from CoreNotifier.
Definition: core_slot.h:34
behavior::Node * node() override
Get a node from the graph, that does not exist, throw an error in every case.
NodeType
Hedgehog node&#39;s type.
Definition: core_node.h:40
Hedgehog core namespace.
Definition: core_execute.h:25
std::string_view const & name() const
Node name accessor.
Definition: core_node.h:128
CoreGraphMultiReceivers(std::string_view const &name, NodeType const type, size_t const numberThreads)
CoreGraphMultiReceivers constructor.
size_t numberThreads() const
Number of threads associated accessor.
Definition: core_node.h:152
~CoreGraphMultiReceivers() override
CoreGraphMultiReceivers destructor.
bool receiversEmpty() final
Test if all the CoreGraphMultiReceivers of the graphs (its input nodes CoreMultiReceivers) are empty...
bool receiverEmpty() final
Test emptiness in all graph receivers.