7 #include "fwServices/registry/Proxy.hpp" 40 void Proxy::connect(ChannelKeyType channel, ::fwCom::SignalBase::sptr signal)
46 ChannelMapType::iterator iter =
m_channels.find(channel);
57 sigslots = iter->second;
62 auto ret = sigslots->m_signals.insert(signal);
67 for( ::fwCom::SlotBase::sptr slot : sigslots->m_slots )
69 signal->connect( slot );
82 ChannelMapType::iterator iter =
m_channels.find(channel);
93 sigslots = iter->second;
98 auto ret = sigslots->m_slots.insert(slot);
103 for( ::fwCom::SignalBase::sptr signal : sigslots->m_signals )
105 signal->connect( slot );
115 ChannelMapType::iterator iter =
m_channels.find(channel);
122 for( ::fwCom::SlotBase::sptr slot : sigslots->m_slots )
124 signal->disconnect( slot );
127 SigSlots::SignalContainerType::iterator sigIter;
128 sigIter = std::find(sigslots->m_signals.begin(), sigslots->m_signals.end(), signal);
129 SLM_ASSERT(
"Signal is not found", sigIter != sigslots->m_signals.end());
130 sigslots->m_signals.erase(sigIter);
132 if (sigslots->m_signals.empty() && sigslots->m_slots.empty())
144 ChannelMapType::iterator iter =
m_channels.find(channel);
151 for( ::fwCom::SignalBase::sptr signal : sigslots->m_signals )
153 signal->disconnect( slot );
156 SigSlots::SlotContainerType::iterator slotIter;
157 slotIter = std::find(sigslots->m_slots.begin(), sigslots->m_slots.end(), slot);
158 SLM_ASSERT(
"Slot is not found", slotIter != sigslots->m_slots.end());
159 sigslots->m_slots.erase(slotIter);
161 if (sigslots->m_signals.empty() && sigslots->m_slots.empty())
FWSERVICES_API Proxy()
Constructor, does nothing.
Contains fwAtomsFilter::registry details.
::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.
static FWSERVICES_API Proxy::sptr getDefault()
Returns an instance of Proxy.
static Proxy::sptr s_currentProxy
The global instance of the proxy.
Namespace fwServices is dedicated to (mimic) the dynamic affectation of methods to (pure data) object...
ChannelMapType m_channels
Association channels, SigSlot.
::boost::unique_lock< ReadWriteMutex > WriteLock
Defines a lock of write type for read/write mutex.
virtual FWSERVICES_API ~Proxy()
Destructor, does nothing.
Structure to regsiter signal and slot informations Contains a signal container, a slot container and ...
mutable::fwCore::mt::ReadWriteMutex m_channelMutex
Used to protect the m_channels access.
FWSERVICES_API void disconnect(ChannelKeyType channel,::fwCom::SignalBase::sptr signal)
Unregisters the signal. Disconnects it from the slots in channel.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
FWSERVICES_API void connect(ChannelKeyType channel,::fwCom::SignalBase::sptr signal)
Registers a signal in the channel. It will be connected to all slots in the channel.