Implementing a caller-dispatcher pair

To change the local member function calls of a class into remote procedure calls, you use the class interface to define a caller class and the class implementation to define dispatcher implementation class. You define the protocol that unites these two classes with an abstract base class and you add a dispatcher to move data between the caller and the implementation.

To implement a caller-dispatcher pair using this model:

  1. Define an abstract base class containing the interface that you want the caller to see and the dispatcher implementation class to implement.
    See
    "Defining the abstract base class" on page 79 for details.
  2. Derive dispatcher implementation class from the abstract base class, and place the implementation for each member function into this class.
    "Defining the implementation" on page 80 describes how to code this class.
  3. Derive a caller class from the abstract base class, mixing in MRemoteCaller, and supplying a stub for each member function you want the dispatcher to execute.
    "Defining a caller" on page 81 provides more details.
  4. Define a dispatcher class that mixes in MRemoteDispatcher, supplying a stub for each member function you want to dispatch.
    Refer to "Defining the dispatcher" on page 85 for more information.
This section describes how to implement each of these steps, using a calculator program as an example. In this program, the caller (an object of TAdditionCaller) makes request for a dispatcher (a TAdditionDispatcher instance) to perform addition functions. While this is a simplistic use of remote object calls, it works well to illustrate each step of defining the RPC architecture.



[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