7 #ifndef __FWCOM_SLOTCONNECTION_HXX__ 8 #define __FWCOM_SLOTCONNECTION_HXX__ 10 #ifndef __FWCOM_SLOTCONNECTION_HPP__ 11 #error fwCom/SlotConnection.hpp not included 14 #include "fwCom/SlotRun.hpp" 21 template <
typename ... A >
23 const SignalSptrType& signal,
24 const SlotRunSptrType& slot
27 return std::make_shared< SelfType >(signal, slot);
32 template <
typename ... A >
34 const SignalSptrType& signal,
35 const SlotBase::sptr& slot,
36 const SlotWrapperSptrType& slotWrapper
39 return std::make_shared< SelfType >(signal, slot, slotWrapper);
44 template <
typename ... A >
46 const SlotRunSptrType& slot) :
48 m_connectedSlot(slot),
49 m_pair(true, slot.get())
55 template <
typename ... A >
57 const SignalSptrType& signal,
58 const SlotBase::sptr& slot,
59 const SlotWrapperSptrType& slotWrapper
62 m_connectedSlot(slot),
63 m_slotWrapper(slotWrapper),
64 m_pair(
true, slotWrapper.get())
70 template <
typename ... A >
78 template <
typename ... A >
81 SignalSptrType sig(m_signal);
82 sig->m_slots.push_back( &m_pair );
87 template <
typename ... A >
88 inline void SlotConnection< void (A ...) >::disconnectSignalNoLock(
const SignalSptrType& sig)
90 sig->m_slots.remove( &m_pair );
91 sig->m_connections.erase(m_connectedSlot);
96 template <
typename ... A >
97 inline void SlotConnection< void (A ...) >::disconnectSlotNoLock(
const SlotBase::sptr& slot)
101 std::shared_ptr<
const SlotConnection< void (A ...) > > thisSptr =
102 std::dynamic_pointer_cast<
const SlotConnection< void (A ...) > > ( this->shared_from_this() );
103 slot->m_connections.erase( thisSptr );
105 catch(const ::boost::bad_weak_ptr&)
114 template <
typename ... A >
119 SignalSptrType sig(m_signal.lock());
120 SlotBase::sptr slot(m_connectedSlot.lock());
125 this->disconnectSignalNoLock(sig);
128 m_slotWrapper.reset();
133 this->disconnectSlotNoLock(slot);
137 m_connectedSlot.reset();
142 template <
typename ... A >
147 SignalSptrType sig(m_signal.lock());
148 SlotBase::sptr slot(m_connectedSlot.lock());
152 this->disconnectSignalNoLock(sig);
155 m_slotWrapper.reset();
160 this->disconnectSlotNoLock(slot);
164 m_connectedSlot.reset();
169 template <
typename ... A >
170 inline SlotConnectionBase::BlockerSptrType
SlotConnection< void (A ...) >::getBlocker()
174 SlotConnectionBase::BlockerSptrType blocker(m_weakBlocker.lock());
179 blocker = m_weakBlocker.lock();
183 blocker = SlotConnectionBase::BlockerSptrType(
187 m_weakBlocker = blocker;
190 SignalSptrType sig(m_signal);
192 m_pair.first =
false;
200 template <
typename ... A >
205 SignalSptrType sig(m_signal);
::boost::upgrade_lock< ReadWriteMutex > ReadToWriteLock
Defines an upgradable lock type for read/write mutex.
::boost::upgrade_to_unique_lock< ReadWriteMutex > UpgradeToWriteLock
Defines a write lock upgraded from ReadToWriteLock.
Namespace containing fw4spl communication tools.
::boost::unique_lock< ReadWriteMutex > WriteLock
Defines a lock of write type for read/write mutex.
::boost::shared_lock< ReadWriteMutex > ReadLock
Defines a lock of read type for read/write mutex.