#include <ImFusion/Core/Signal.h>
class MySubject
{
public:
};
MySubject subject;
std::cout <<
"Signal2 was emitted with int " << i <<
" and string " << s <<
".";
});
connection->disconnect();
class MyObserver :
public SignalReceiver{
public:
void onEvent(){std::cout <<
"MyObserver has been notified.";
}
}
{
MyObserver observer;
subject.signal1.connect(&observer, [&observer]() { observer.onEvent(); });
subject.signal1.connect(&observer, &MyObserver::onEvent);
}
MyObserver observer1, observer2;
auto connection1 =
signal.connect(&observer1, &MyObserver::onEvent);
auto connection2 =
signal.connect(&observer2, &MyObserver::onEvent);
{
}
{
}
{
}
Convenient scope guard class to temporarily block signals/connections so that observers are not notif...
Definition Signal.h:316
Base class for classes that can contain slots (i.e.
Definition Signal.h:28
SignalImpl< true, ArgTypes... > ProtectedSignal
Alias for a protected signal, which is thread-safe.
Definition Signal.h:346
SignalImpl< false, ArgTypes... > Signal
Alias for a non-protected signal, which is reentrant but not thread-safe.
Definition Signal.h:341
Namespace of the ImFusion SDK.
Definition Assert.h:7