Signal Class Reference

Class for specifying a signal to re-emit. More...

#include <Slot.h>

Inheritance diagram for Signal:

Inheritance graph

List of all members.

Public Member Functions

 Signal (Subject *pSubject, const std::string &signalName)

Classes

class  SignalValue


Detailed Description

Class for specifying a signal to re-emit.

Only the constructors of this class will be used outside of the underlying implementation if the Subject class.

When a Subject calls 'notify' with a particular signal name, all Signals that are attached to that signal on the Subject will have their update method called. The Signal's update method will in turn call notify on it's Subject using the Signal's signal name.

For example:

  pSubject->attach(SIGNAL_NAME(Subject, Modified), Signal(pObj, SIGNAL_NAME(Subject, Modified)));
This causes pSubject->notify(SIGNAL_NAME(Subject, Modified, any)); to result in pObj->notify(SIGNAL_NAME(Subject, Modified), v) being called. Remember that NULL is a wildcard for signal names. Using NULL as the first argument to attach in the case above will cause all signals to be forwarded. Using NULL for second argument to the Signal ctor will cause the name of the original signal to be re-used when the signal is re-emited. E.g.
  pSubject->attach(NULL, Signal(pObj, NULL));
  pSubject->notify("MySignal", any(myData));
This causes pObj->notify("MySignal", any(myData)) to be called.

See also:
Subject::attach, Subject::detach

Definition at line 441 of file Slot.h.


Constructor & Destructor Documentation

Signal::Signal ( Subject pSubject,
const std::string &  signalName 
)

Creates a Signal.

Parameters:
pSubject The Subject to re-emit the Signal from.
signalName The name to re-emit the signal as. If NULL, the signal will be re-emited with its original name.

Definition at line 456 of file Slot.h.


Software Development Kit - Opticks 4.9.0 Build 16218