Connection classes

This section covers the connection classes. These classes manage a receiver's set of interests and deliver corresponding notifications to the receiver.


TNotifierConnection -- an abstract base class for establishing connections between a sender and a receiver. It provides protocol and implementation for enabling and disabling dispatching of notification in its Connect and Disconnect member functions, and for adding and removing interests in a number of AddInterest and RemoveInterest member functions. Its Notify member function provides the protocol for dispatching notifications to the receiver.

TMemberFunctionConnectionTo<AReceiver> -- provides notification dispatch to a receiver instance (currently, only receivers that derive from MCollectible). The notifications are dispatched to the receiver by calling a member function on the receiver instance. You can specify an individual receiver function for each interest in the connection. You can also specify a default member function to handle notifications sent for interests that do not have an individual receiver function.

TFunctionConnection -- provides notification dispatch to static member functions or global functions. As with TMemberFunctionConnection, you can specify an individual receiver function for each interest in the connection. You can also specify a default member function to handle notifications sent for interests that do not have an individual receiver function.

Interest classes

This section discusses the Interest classes. The interest classes identify the notifier (typically the sender) and the name of an event about which the sender notifies.


TInterest -- specifies an interest as a name and a notifier. In many cases, senders can simply use instances of TInterest. If needed, you can derive new classes to include additional information to refine the interest specification.

Both senders and receivers use TInterest. Senders use TInterest when they generate a notification -- to identify the sender and the event about which the notification is being sent. Receivers use them to inform their connections which notifications to receive from which senders.

A sender must define for a receiver the interests the sender generates as well as the class of notification associated with each. Senders can export interests as TTokens, TInterests (or derived classes of TInterest), or as member functions that create TInterests.

There is no way to tell the compiler which class of notification corresponds to each interest. Therefore, when you write a sender class, clearly document the class of notification that corresponds to each interest. And when you write a receiver class, carefully review the comments and documentation provided by the person who wrote the sender class.

Notification classes

This section describes the Notification classes, which deliver news of an event involving a sender to receivers.


TNotification -- the base class for transporting notification-specific information. TNotification contains a TInterest specifying the sender and the event about which notification is generated. You can derive from TNotification to add additional information for specific notifications. For example, the Compound Document framework defines a TSelectionNotification class that contains a selection. Receivers of this notification can then access the selection for their own purposes.

TBatchNotification -- transports a group of notifications to a receiver as a single batched notification. It is typically generated automatically by the notifier; you do not generate it yourself. See the previous discussion, "Optimizing using batched notification" on page 43.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker