Object operations (as opposed to functions or global operations) are mapped to C functions with the same return type. The first argument generated for an operation is a pointer to the specific object on which the operation is to operate. Following the me pointer is the original list of operation arguments, as specified in the model.
For example, the following prototype is generated for an operation named print() of object type B:
void B_print(B* const me);
The function prototype is generated in the specification file for B. The only argument is a pointer to an object of type B called me.
Enter the following lines in the implementation for B's print() operation in the model:
char *str;
str = "This is B";
printf("%s\n", str);
The following lines are added to the body of print() in the implementation file:
void B_print(B* const me) {
NOTIFY_OPERATION(me, NULL, B, print, print(), 0,
print_SERIALIZE);
{
/*#[ operation print() */
char *str;
str = "This is B";
printf("%s\n", str);
/*#]*/
}
}
You can manually edit the operation between the /*#[ and /*#] symbols. Roundtrip your changes back into the model by selecting .
A SERIALIZE macro is generated for operations (for example, print_SERIALIZE) if animation is enabled and the operation has no arguments that need to be animated. The SERIALIZE macro is used to display the operation during instrumentation. A SERIALIZE macro is not generated for inline operations.