A typical example

Figure 13 shows how two user classes, TShapeList and TShapeView, work together to define a typical synchronous notification relationship between two instances in the same task.

TShapeList defines one event about which it provides notification. This is identified by the interest returned from its GetAddedShapeInterest member function. TShapeView owns an instance of TMemberFunctionConnection, which is a derived class of TNotifierConnection that calls member functions of its receiver in response to receiving notifications.


This is how TShapeList and TShapeView work together to establish the various relationships in Figure 13:

  1. TShapeView creates a connection and establishes itself as the receiver.
  2. It then calls GetAddedShapeInterest on TShapeList to create an interest. TShapeList creates an instance of TInterest with a name and notifier.
  3. It then adds the interest to its connection and tells the connection which member function to call (HandleAddedShape) when the connection receives notifications from the sender with that interest.
  4. Finally, TShapeView calls Connect on its connection. The connection informs all the notifiers of the interests it holds to inform them that it is ready to receive notifications.
Typically, this setup would be done in the constructor for TShapeView.


[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