Hedgehog  3.1.0
A library to generate hybrid pipeline workflow systems
Loading...
Searching...
No Matches
implementor_receiver.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_RECEIVER_H
22#define HEDGEHOG_IMPLEMENTOR_RECEIVER_H
23
24#include <set>
25
27namespace hh {
29namespace core {
31namespace implementor {
32
33#ifndef DOXYGEN_SHOULD_SKIP_THIS
36template<class Output>
37class ImplementorSender;
38#endif //DOXYGEN_SHOULD_SKIP_THIS
39
42template<class Input>
44 protected:
45 std::unique_ptr<std::set<abstraction::ReceiverAbstraction<Input> *>>
47
48 public:
51 abstractReceivers_(std::make_unique<std::set<abstraction::ReceiverAbstraction<Input> *>>()) {}
52
54 virtual ~ImplementorReceiver() = default;
55
58 [[nodiscard]] std::set<abstraction::ReceiverAbstraction<Input> *> &receivers() { return *abstractReceivers_; }
59
62 virtual void initialize(abstraction::ReceiverAbstraction<Input> *receiverAbstraction) {
63 abstractReceivers_->insert(receiverAbstraction);
64 }
65
68 [[nodiscard]] virtual std::set<abstraction::SenderAbstraction<Input> *> const &connectedSenders() const = 0;
69
73
77
80 virtual void receive(std::shared_ptr<Input> data) = 0;
81
84 [[nodiscard]] virtual std::shared_ptr<Input> getInputData() = 0;
85
88 [[nodiscard]] virtual size_t numberElementsReceived() const = 0;
89
92 [[nodiscard]] virtual size_t maxNumberElementsReceived() const = 0;
93
96 [[nodiscard]] virtual bool empty() const = 0;
97};
98}
99}
100}
101#endif //HEDGEHOG_IMPLEMENTOR_RECEIVER_H
Hedgehog main namespace.
Core's abstraction to receive a piece of data.
Core abstraction to send data.
Implementor for the ReceiverAbstraction.
virtual void removeSender(abstraction::SenderAbstraction< Input > *sender)=0
Remove a SenderAbstraction.
virtual size_t maxNumberElementsReceived() const =0
Accessor to the maximum number of data waiting to be processed in the queue during the whole executio...
std::set< abstraction::ReceiverAbstraction< Input > * > & receivers()
Accessor to the linked ReceiverAbstraction.
virtual void receive(std::shared_ptr< Input > data)=0
Receive data interface.
virtual bool empty() const =0
Test if the receiver is empty or not.
virtual void initialize(abstraction::ReceiverAbstraction< Input > *receiverAbstraction)
Initialize the implementor Receiver by setting the corresponding abstraction.
std::unique_ptr< std::set< abstraction::ReceiverAbstraction< Input > * > > abstractReceivers_
Set of linked ReceiverAbstraction.
virtual size_t numberElementsReceived() const =0
Accessor to number of data waiting to be processed in the queue.
virtual std::set< abstraction::SenderAbstraction< Input > * > const & connectedSenders() const =0
Accessor to the connected senders.
virtual void addSender(abstraction::SenderAbstraction< Input > *sender)=0
Add a SenderAbstraction.
virtual std::shared_ptr< Input > getInputData()=0
Accessor to a received data.
virtual ~ImplementorReceiver()=default
Default destructor.