SignalEnabler Class Reference

SignalEnabler is an RAII class for enabling/disabling signals on a Subject, guaranteeing that the previous state is restored when the SignalEnabler goes out of scope. More...

#include <SignalBlocker.h>

Inheritance diagram for SignalEnabler:

Inheritance graph

List of all members.

Public Member Functions

 SignalEnabler (Subject &subject, bool enable)
 SignalEnabler (Subject &subject)
 ~SignalEnabler ()
bool wereEnabled () const


Detailed Description

SignalEnabler is an RAII class for enabling/disabling signals on a Subject, guaranteeing that the previous state is restored when the SignalEnabler goes out of scope.

Warning:
Disabling signals can be very dangerous as it hides details from any attached slots which may depend on being notified to function properly.
See also:
Subject, Subject::signalsEnabled

Definition at line 27 of file SignalBlocker.h.


Constructor & Destructor Documentation

SignalEnabler::SignalEnabler ( Subject subject,
bool  enable 
)

Creates the RAII object and enables or disables signals on the specified Subject.

Parameters:
subject The Subject to enable/disable
enable The new enabled state
Warning:
Disabling signals can be very dangerous as it hides details from any attached slots which may depend on being notified to function properly.

Definition at line 44 of file SignalBlocker.h.

SignalEnabler::SignalEnabler ( Subject subject  )  [explicit]

Creates the RAII object, leaving the enabled state unchanged.

Parameters:
subject The Subject to restore upon destruction of the SignalEnabler.

Definition at line 57 of file SignalBlocker.h.

SignalEnabler::~SignalEnabler (  ) 

Destroys the SignalEnabler, restoring the enabled state of the Subject to what it was when the SignalEnabler was created.

Definition at line 67 of file SignalBlocker.h.


Member Function Documentation

bool SignalEnabler::wereEnabled (  )  const

Returns the enabled state the Subject had when the SignalEnabler was created.

Definition at line 79 of file SignalBlocker.h.


Software Development Kit - Opticks 4.9.0 Build 16218