Hedgehog  3.1.0
A library to generate hybrid pipeline workflow systems
Loading...
Searching...
No Matches
implementor_notifier.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_IMPLEMENTOR_NOTIFIER_H
22#define HEDGEHOG_IMPLEMENTOR_NOTIFIER_H
23
24#include <memory>
25#include <set>
26
28namespace hh {
30namespace core {
31
33namespace abstraction {
34class SlotAbstraction;
35}
37namespace implementor {
40 protected:
41 std::unique_ptr<std::set<abstraction::NotifierAbstraction *>>
43
44 public:
47 : abstractNotifiers_(std::make_unique<std::set<abstraction::NotifierAbstraction *>>()) {}
48
50 virtual ~ImplementorNotifier() = default;
51
54 [[nodiscard]] std::set<abstraction::NotifierAbstraction *> &notifiers() { return *abstractNotifiers_; }
55
58 virtual void initialize(abstraction::NotifierAbstraction *notifierAbstraction) {
59 abstractNotifiers_->insert(notifierAbstraction);
60 }
61
64 [[nodiscard]] virtual std::set<abstraction::SlotAbstraction *> const &connectedSlots() const = 0;
65
68 virtual void addSlot(abstraction::SlotAbstraction *slot) = 0;
69
73
75 virtual void notify() = 0;
76
78 virtual void notifyAllTerminated() = 0;
79};
80}
81}
82}
83#endif //HEDGEHOG_IMPLEMENTOR_NOTIFIER_H
Hedgehog main namespace.
Core abstraction to notify slots.
Core's abstraction to receive a signal.
Implementor for the NotifierAbstraction.
virtual void notifyAllTerminated()=0
Notify the connected slots that this notifier is terminated.
virtual void addSlot(abstraction::SlotAbstraction *slot)=0
Add a slot to the connected slots.
virtual void initialize(abstraction::NotifierAbstraction *notifierAbstraction)
Initialize the implementor Notifier by setting the corresponding abstraction.
std::set< abstraction::NotifierAbstraction * > & notifiers()
Accessor to the linked NotifierAbstraction.
virtual ~ImplementorNotifier()=default
Default destructor.
virtual void notify()=0
Notify the connected slots to wake up.
virtual std::set< abstraction::SlotAbstraction * > const & connectedSlots() const =0
Accessor to the connected slots.
std::unique_ptr< std::set< abstraction::NotifierAbstraction * > > abstractNotifiers_
Set of linked NotifierAbstraction.
virtual void removeSlot(abstraction::SlotAbstraction *slot)=0
Remove a slot to the connected slots.