Hedgehog  3.1.0
A library to generate hybrid pipeline workflow systems
Loading...
Searching...
No Matches
hh::core::abstraction::SlotAbstraction Class Referenceabstract

Core's abstraction to receive a signal. More...

#include "slot_abstraction.h"

Inheritance diagram for hh::core::abstraction::SlotAbstraction:
Inheritance graph
Collaboration diagram for hh::core::abstraction::SlotAbstraction:
Collaboration graph

Public Member Functions

 SlotAbstraction (std::shared_ptr< implementor::ImplementorSlot > concreteSlot)
 Constructor using a concrete slot implementation.
 
virtual ~SlotAbstraction ()=default
 Default destructor.
 
std::set< SlotAbstraction * > const & slots () const
 Const accessor to slots.
 
std::set< SlotAbstraction * > & slots ()
 Accessor to slots.
 
std::set< NotifierAbstraction * > const & connectedNotifiers () const
 Accessor to the NotifierAbstraction attached to this slot, protected with mutex.
 
void addNotifier (NotifierAbstraction *const notifier)
 Add a NotifierAbstraction to this slot.
 
void removeNotifier (NotifierAbstraction *const notifier)
 Remove a NotifierAbstraction to this slot.
 
virtual void wakeUp ()=0
 Wake up mechanism, called to notify the std::condition_variable.
 
bool hasNotifierConnected () const
 Test if there is at least one notifier connected.
 
void lockSlotMutex ()
 Lock mutex.
 
void unlockSlotMutex ()
 Unlock mutex.
 

Protected Member Functions

std::shared_ptr< std::mutex > const & mutex () const
 Protected accessor to mutex.
 
std::shared_ptr< std::condition_variable > const & slotConditionVariable () const
 Protected accessor to condition variable.
 
void copyInnerStructure (SlotAbstraction *copyableCore)
 Copy the inner structure of copyableCore into this.
 

Private Attributes

std::shared_ptr< std::mutex > mutex_ = nullptr
 Slot mutex.
 
std::shared_ptr< std::condition_variable > slotConditionVariable_ = nullptr
 Slot condition variable.
 
std::shared_ptr< implementor::ImplementorSlotconcreteSlot_ = nullptr
 Concrete implementation of the slot.
 

Detailed Description

Core's abstraction to receive a signal.

Definition at line 55 of file slot_abstraction.h.

Constructor & Destructor Documentation

◆ SlotAbstraction()

hh::core::abstraction::SlotAbstraction::SlotAbstraction ( std::shared_ptr< implementor::ImplementorSlot concreteSlot)
inlineexplicit

Constructor using a concrete slot implementation.

Parameters
concreteSlotConcrete slot implementation

Definition at line 69 of file slot_abstraction.h.

◆ ~SlotAbstraction()

virtual hh::core::abstraction::SlotAbstraction::~SlotAbstraction ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ addNotifier()

void hh::core::abstraction::SlotAbstraction::addNotifier ( NotifierAbstraction *const  notifier)
inline

Add a NotifierAbstraction to this slot.

Parameters
notifierNotifierAbstraction to add

Definition at line 102 of file slot_abstraction.h.

Here is the caller graph for this function:

◆ connectedNotifiers()

std::set< NotifierAbstraction * > const & hh::core::abstraction::SlotAbstraction::connectedNotifiers ( ) const
inline

Accessor to the NotifierAbstraction attached to this slot, protected with mutex.

Returns
The NotifierAbstraction attached to this slot

Definition at line 93 of file slot_abstraction.h.

Here is the caller graph for this function:

◆ copyInnerStructure()

void hh::core::abstraction::SlotAbstraction::copyInnerStructure ( SlotAbstraction copyableCore)
inlineprotected

Copy the inner structure of copyableCore into this.

Parameters
copyableCoreSlotAbstraction to copy inner structure from

Definition at line 144 of file slot_abstraction.h.

Here is the caller graph for this function:

◆ hasNotifierConnected()

bool hh::core::abstraction::SlotAbstraction::hasNotifierConnected ( ) const
inline

Test if there is at least one notifier connected.

Returns
True if there is at least one notifier connected, else false

Definition at line 121 of file slot_abstraction.h.

Here is the caller graph for this function:

◆ lockSlotMutex()

void hh::core::abstraction::SlotAbstraction::lockSlotMutex ( )
inline

Lock mutex.

Definition at line 126 of file slot_abstraction.h.

Here is the caller graph for this function:

◆ mutex()

std::shared_ptr< std::mutex > const & hh::core::abstraction::SlotAbstraction::mutex ( ) const
inlineprotected

Protected accessor to mutex.

Returns
Mutex

Definition at line 134 of file slot_abstraction.h.

Here is the caller graph for this function:

◆ removeNotifier()

void hh::core::abstraction::SlotAbstraction::removeNotifier ( NotifierAbstraction *const  notifier)
inline

Remove a NotifierAbstraction to this slot.

Parameters
notifierNotifierAbstraction to add

Definition at line 110 of file slot_abstraction.h.

◆ slotConditionVariable()

std::shared_ptr< std::condition_variable > const & hh::core::abstraction::SlotAbstraction::slotConditionVariable ( ) const
inlineprotected

Protected accessor to condition variable.

Returns
Condition variable

Definition at line 138 of file slot_abstraction.h.

Here is the caller graph for this function:

◆ slots() [1/2]

std::set< SlotAbstraction * > & hh::core::abstraction::SlotAbstraction::slots ( )
inline

Accessor to slots.

Present the slots linked to this abstraction, usually one, may be multiple for the graph presenting all of the input node slots

Returns
Reference to slots

Definition at line 89 of file slot_abstraction.h.

◆ slots() [2/2]

std::set< SlotAbstraction * > const & hh::core::abstraction::SlotAbstraction::slots ( ) const
inline

Const accessor to slots.

Present the slots linked to this abstraction, usually one, may be multiple for the graph presenting all of the input node slots

Returns
Const reference to slots

Definition at line 83 of file slot_abstraction.h.

Here is the caller graph for this function:

◆ unlockSlotMutex()

void hh::core::abstraction::SlotAbstraction::unlockSlotMutex ( )
inline

Unlock mutex.

Definition at line 129 of file slot_abstraction.h.

Here is the caller graph for this function:

◆ wakeUp()

Member Data Documentation

◆ concreteSlot_

std::shared_ptr<implementor::ImplementorSlot> hh::core::abstraction::SlotAbstraction::concreteSlot_ = nullptr
private

Concrete implementation of the slot.

Definition at line 64 of file slot_abstraction.h.

◆ mutex_

std::shared_ptr<std::mutex> hh::core::abstraction::SlotAbstraction::mutex_ = nullptr
private

Slot mutex.

Definition at line 58 of file slot_abstraction.h.

◆ slotConditionVariable_

std::shared_ptr<std::condition_variable> hh::core::abstraction::SlotAbstraction::slotConditionVariable_ = nullptr
private

Slot condition variable.

Definition at line 61 of file slot_abstraction.h.