Passing parameters in stubs

To evaluate a parameter that you intend to pass in a remote procedure call, you need to identify what type of parameter it is (in, out, or in-out) and whether you use the parameter monomorphically or polymorphically. You can use parameters in other ways, but staying to these canonical types provides a clean interface.

Common C++ calling types based on the parameter type and usage:

Use In Out In-out

Common C++ calling types based on para-meter type and use
Mono-morphic const T p const T& p return T; T& p T& p
Poly-morphic const T& p return T*; T*& p T*& p

Monomorphic in parameters include const T p and const T& p. Whether you choose a const T or a const T& usually depends on the size of the class. Returning a T or using a T& p parameter depends on the size of the class and the number of out parameters.

Table 2 and Table 3 show the typical syntax of caller stub and dispatcher stubs based on these parameter types.

Usage In Out In-Out

Caller stub syntax
Mono-morphic p >>= stream; SendRequest(); SendRequest(); p <<= stream; p >>= stream; SendRequest(); p << stream;
Poly-morphic stream.FlattenPointer(&p); SendRequest; SendRequest(); p = (T*)(stream.Resurrect()); stream.FlattenPointer(&p); SendRequest(); delete p; p = (T*)(stream.Resurrect());

Usage In Out In-Out

Dispatcher stub syntax
Mono-morphic T p; p <<= stream; implementation T p; implementation p >>= transport; T p; p <<= stream; implementation p >>= transport;
Poly-morphic T* p; p = (T*)(stream.Resurrect()); implementation delete p; T* p; implementation stream.FlattenPointer(&p); delete p; T* p; p = (T*)(stream.Resurrect()); implementation stream.FlattenPointer(&p); delete p;


[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