Hedgehog  3.1.0
A library to generate hybrid pipeline workflow systems
Loading...
Searching...
No Matches
graph_slot.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#ifndef HEDGEHOG_GRAPH_SLOT_H
20#define HEDGEHOG_GRAPH_SLOT_H
21
22#include <memory>
23
24#include "../../implementor/implementor_slot.h"
25#include "../../../abstractions/base/input_output/notifier_abstraction.h"
27namespace hh {
29namespace core {
31namespace implementor {
32
34class GraphSlot : public ImplementorSlot {
35 public:
36
38 explicit GraphSlot() = default;
39
41 ~GraphSlot() override = default;
42
45 void initialize([[maybe_unused]]abstraction::SlotAbstraction *slotAbstraction) override {}
46
50 [[nodiscard]] std::set<abstraction::NotifierAbstraction *> const &connectedNotifiers() const override {
51 throw std::runtime_error("A graph has no connected connectedNotifiers by itself");
52 }
53
57 [[nodiscard]] bool hasNotifierConnected() const override {
58 throw std::runtime_error("A graph has no connected connectedNotifiers by itself");
59 }
60
64 for (auto slot : *abstractSlots_) { slot->addNotifier(notifier); }
65 }
66
70 for (auto slot : *abstractSlots_) { slot->removeNotifier(notifier); }
71 }
72};
73}
74}
75}
76#endif //HEDGEHOG_GRAPH_SLOT_H
Hedgehog main namespace.
Core abstraction to notify slots.
Core's abstraction to receive a signal.
Default concrete implementation of the slot abstraction for the graph core.
Definition: graph_slot.h:34
~GraphSlot() override=default
Default destructor.
void addNotifier(abstraction::NotifierAbstraction *notifier) override
Add a notifier to all input nodes.
Definition: graph_slot.h:63
std::set< abstraction::NotifierAbstraction * > const & connectedNotifiers() const override
Do nothing, throw an error.
Definition: graph_slot.h:50
GraphSlot()=default
Default constructor.
void initialize(abstraction::SlotAbstraction *slotAbstraction) override
Redefine the implementor to do nothing, the graph do nothing by itself.
Definition: graph_slot.h:45
void removeNotifier(abstraction::NotifierAbstraction *notifier) override
Remove a notifier to all input nodes.
Definition: graph_slot.h:69
bool hasNotifierConnected() const override
Do nothing, throw an error.
Definition: graph_slot.h:57
Implementor for the SlotAbstraction.
std::unique_ptr< std::set< abstraction::SlotAbstraction * > > abstractSlots_
Set of linked SlotAbstraction.