|
Back to Table of contents |
General information |
type: template < typename T > class
inherits: (none)
module: glowSenderReceiverTSender is a templated class that represents the sending endpoint of an object communication line. The template type is the type of message that is broadcast by this sender. A sender may be bound to any number of TReceivers templated on the same message type. When the sender sends a message, every receiver is notified. If a receiver is deleted, the sender automatically detects the condition and unbinds itself from the deceased.
Most GLOW programs will encounter TSenders when dealing with menus, idle and timer tasks, or widgets.
Types |
Types
typename MessageType
A synonym for the type of message.
Methods |
Constructor
TSender(void)
Creates a new TSender bound to nothing.Managing the receiver list
Manage the list of receivers for this sender using these methods.void Bind(TReceiver<T>* receiver)
Binds to the given receiver. Throws an assertion if the sender is already bound to this receiver.void Unbind(TReceiver<T>* receiver)
Unbinds from the given receiver. Throws an assertion if the sender is not bound to this receiver.void UnbindAll(void)
Unbinds this sender from all receivers.bool IsBoundTo(TReceiver<T>* receiver)
Returns true if and only if this sender is bound to the given receiver.unsigned int NumReceivers(void)
Returns the number of receivers bound to this sender.Sending messages
This method sends messages to bound receivers.void Send(T message)
Sends the given message to all bound receivers.
Static methods |
Sending messages without binding
You may also send messages to single receivers without binding.static void Send(TReceiver<T>* receiver, T message)
Sends the given message to the given receiver.
|
Back to Table of contents |
The GLOW Toolkit