20 #ifndef HEDGEHOG_CORE_QUEUE_NOTIFIER_H 21 #define HEDGEHOG_CORE_QUEUE_NOTIFIER_H 23 #include "../../base/sender/core_notifier.h" 31 std::shared_ptr<std::set<CoreSlot *>>
slots_ =
nullptr;
40 HLOG_SELF(0,
"Creating CoreQueueNotifier with type: " << (
int) type <<
" and name: " << name)
41 slots_ = std::make_shared<std::set<CoreSlot *>>();
49 [[nodiscard]] std::shared_ptr<std::set<CoreSlot *>>
const &
slots()
const {
return slots_; }
54 HLOG_SELF(0,
"Add Slot " << slot->
name() <<
"(" << slot->
id() <<
")")
55 this->
slots()->insert(slot);
61 HLOG_SELF(0,
"Remove Slot " << slot->
name() <<
"(" << slot->
id() <<
")")
62 this->slots_->erase(slot);
67 HLOG_SELF(2,
"Notify all terminated")
75 HLOG_SELF(0,
"Copy Cluster CoreQueueNotifier information from " << rhs->
name() <<
"(" << rhs->
id() <<
")")
77 this->slots_ = rhs->
slots_;
82 #endif //HEDGEHOG_CORE_QUEUE_NOTIFIER_H NodeType type() const
Node type accessor.
~CoreQueueNotifier() override
CoreQueueNotifier destructor.
Core Notifier interface, emit notification to CoreSlot.
void copyInnerStructure(CoreQueueNotifier *rhs)
Copy the inner structure of the notifier (set of slots and connections)
virtual void wakeUp()=0
Interface to define what the node do when it receive a signal.
std::shared_ptr< std::set< CoreSlot * > > slots_
Set of connected slots.
void notifyAllTerminated() override
Notify all slots that the node is terminated.
std::shared_ptr< std::set< CoreSlot * > > const & slots() const
Connected slots accessor.
Slot interface, receive notification from CoreNotifier.
void addSlot(CoreSlot *slot) override
Add a slot to the set of connected slots.
virtual void removeNotifier(CoreNotifier *notifier)=0
Interface to remove a CoreNotifier from this slot.
CoreQueueNotifier(std::string_view const &name, NodeType const type, size_t const numberThreads)
CoreQueueNotifier constructor.
NodeType
Hedgehog node's type.
void removeSlot(CoreSlot *slot) override
Remove a slot from the set of connected slots.
Notifier of CoreQueueSlot.
std::string_view const & name() const
Node name accessor.
size_t numberThreads() const
Number of threads associated accessor.
virtual std::string id() const
Unique Id accessor.