About this task
Note: This feature is not supported in
IBM® Rational® Rhapsody® Developer for Java.
The following figure shows an animated sequence diagram
that draws a return value.
You can use any of the following macros depending on
your situation:
- OM_RETURN. Use this macro in the
body of an operation instead of the regular "return" statement:
Examples:
- Int Test(int& x) {x = 5; OM_RETURN(10);}
- A* Test() {OM_RETURN(newA());}
- CALL. Use this macro if you cannot
change the operation code or if you want to animate return values
only on specific calls to the operation. This macro can handle only
primitive types.
Example:
Int test(int n) {return n*5;}
void callingFunction()
{
int v;
CALL (v, f00(10));
// after the call v equals 50
}
- CALL_INST. Same as CALL,
but use CALL_INST when the return value is of a complex
type, such as a class or a union.
Example:
A* test() {return new A();}
void callingFunction()
{
A *a;
CALL_INST(a, test());
// after the call a equals new A[0]
}
- CALL_SER. Use this macro when
the type has a user‑defined serialization function.
Examples:
Even if you choose not to embed these macros
in your application, you can still see animated return values by explicitly
calling an operation through the Operations window. To call an operation,
click the Call operations tool on the Animation toolbar.