Adding a request to an existing caller

When you add a new request to an existing caller-dispatcher pair, you need to update each of the classes that make up the pair (the abstract base class, caller class, dispatcher class, and dispatcher implementation class). This section describes the specific changes you need to make to your code.

  1. Expand the abstract base class.
    Add the request to the abstract base class as a pure virtual member function.
  2. Update the dispatcher implementation class.
    Override the new member function derived from the abstract base class and define the dispatcher implementation for this function.
  3. Update the caller class.
    Expand the class interface to override the new member function derived from the abstract base class to declare the caller stub.
  4. Add a new caller stub.
    Define the caller stub for the new member function. See
    "Writing the caller stubs" on page 83 for an example.
  5. Update the dispatcher class.
    Expand the class interface to:
    1. Add a declaration for dispatcher stub (corresponding to the new member function). This stub accepts an argument stream and a result stream as parameters.
    2. Expand the enumeration to include a member for the new request. If you defined a maximum value, update it to reflect the new member.
    Update the constructor, expanding the RequestEntry struct and the RegisterRequests call. Add an entry to RequestEntry for the new dispatcher stub, specifying the corresponding caller class enum and a function pointer to the dispatcher stub. If you did not define a maximum enum value such as kMaxRequest, update the maximum request value in the RegisterRequests call to reflect the new request enum. See "Writing the dispatcher class constructor" on page 88 for an example of how to use RequestEntry and RegisterRequests.
  6. Add a new dispatcher stub.
    Define the dispatcher stub for the new member function. See "Writing the dispatcher stubs" on page 89 for more details.

[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