ImFusion SDK 4.3
SignalBlocker Class Reference

#include <ImFusion/Core/Signal.h>

Convenient scope guard class to temporarily block signals/connections so that observers are not notified. More...

+ Inheritance diagram for SignalBlocker:

Detailed Description

Convenient scope guard class to temporarily block signals/connections so that observers are not notified.

This class can be used wherever you would otherwise use a pair of calls to SignalImpl::setBlocked() or SignalConnection::setBlocked(). SignalBlocker blocks signals/connections in its constructor and resets the original state on destruction.

Signal signal;
SignalReceiver receiver;
auto connection = signal.connect(&receiver, ...);
{
// will block `signal` until the end of the surrounding scope
SignalBlocker blocker(signal);
}
{
// will block `connection` until the end of the surrounding scope
SignalBlocker blocker(*connection);
}
{
// will block all connections between `receiver` and `signal` until the end of the surrounding scope
SignalBlocker blocker(signal, receiver);
}
Convenient scope guard class to temporarily block signals/connections so that observers are not notif...
Definition Signal.h:316
SignalBlocker(SignalBase &signal)
Temporarily block the notification of all observers connected to signal.
Base class for classes that can contain slots (i.e.
Definition Signal.h:28
SignalImpl< false, ArgTypes... > Signal
Alias for a non-protected signal, which is reentrant but not thread-safe.
Definition Signal.h:341
See also
Temporarily Blocking Notification of Observers
Examples
SignalSlot.cpp.

Public Member Functions

 SignalBlocker (SignalBase &signal)
 Temporarily block the notification of all observers connected to signal.
 
 SignalBlocker (SignalConnection &connection)
 Temporarily block the single signal-observer connection represented by connection.
 
 SignalBlocker (const SignalBase &signal, const SignalReceiver &receiver)
 Temporarily block all connections between signal and receiver.
 

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close