21#ifndef HEDGEHOG_SLOT_ABSTRACTION_H 
   22#define HEDGEHOG_SLOT_ABSTRACTION_H 
   29#include <condition_variable> 
   31#include "../../../implementors/implementor/implementor_slot.h" 
   38#ifndef DOXYGEN_SHOULD_SKIP_THIS 
   40namespace implementor {
 
   47namespace abstraction {
 
   49#ifndef DOXYGEN_SHOULD_SKIP_THIS 
   51class NotifierAbstraction;
 
   57  std::shared_ptr<std::mutex>
 
   60  std::shared_ptr<std::condition_variable>
 
   63  std::shared_ptr<implementor::ImplementorSlot>
 
   69  explicit SlotAbstraction(std::shared_ptr<implementor::ImplementorSlot> concreteSlot) :
 
   83  [[nodiscard]] std::set<SlotAbstraction *> 
const &
slots()
 const { 
return concreteSlot_->slots(); }
 
   95    std::set<NotifierAbstraction *> 
const &  cn = 
concreteSlot_->connectedNotifiers();
 
  134  [[nodiscard]] std::shared_ptr<std::mutex> 
const &
mutex()
 const { 
return mutex_; }
 
Core abstraction to notify slots.
Core's abstraction to receive a signal.
std::set< SlotAbstraction * > & slots()
Accessor to slots.
void unlockSlotMutex()
Unlock mutex.
std::shared_ptr< std::mutex > mutex_
Slot mutex.
std::set< NotifierAbstraction * > const & connectedNotifiers() const
Accessor to the NotifierAbstraction attached to this slot, protected with mutex.
std::shared_ptr< std::condition_variable > slotConditionVariable_
Slot condition variable.
std::set< SlotAbstraction * > const & slots() const
Const accessor to slots.
std::shared_ptr< std::mutex > const & mutex() const
Protected accessor to mutex.
void lockSlotMutex()
Lock mutex.
void removeNotifier(NotifierAbstraction *const notifier)
Remove a NotifierAbstraction to this slot.
std::shared_ptr< implementor::ImplementorSlot > concreteSlot_
Concrete implementation of the slot.
bool hasNotifierConnected() const
Test if there is at least one notifier connected.
void addNotifier(NotifierAbstraction *const notifier)
Add a NotifierAbstraction to this slot.
virtual void wakeUp()=0
Wake up mechanism, called to notify the std::condition_variable.
SlotAbstraction(std::shared_ptr< implementor::ImplementorSlot > concreteSlot)
Constructor using a concrete slot implementation.
void copyInnerStructure(SlotAbstraction *copyableCore)
Copy the inner structure of copyableCore into this.
virtual ~SlotAbstraction()=default
Default destructor.
std::shared_ptr< std::condition_variable > const & slotConditionVariable() const
Protected accessor to condition variable.