IBM Support

How to use functors to simulate with functions

How To


Summary

In IBM Engineering Systems Design Rhapsody for C++ it is usually not possible to simulate activity diagram animations with functions.
But if you call a "functor," simulations can be used with functions.

A C++ functor (function object) is a class or struct object that can be called like a function.
It overloads the function-call operator () and allows us to use an object like a function.

You can't use activity diagrams to implement the actual functor contents because Rhapsody needs to use pointer to instantiate the object,
and this is not compatible with the concept of functors.

If you want to implement the functor operation directly in a diagram you can use a flowchart.
You need to put the return code statement in an "ActivityFinal" node. However, the limitation is that flowcharts do not animate.

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Component":"","Platform":[{"code":"PF033","label":"Windows"}],"Version":"8.3.1","Edition":"","Line of Business":{"code":"LOB77","label":"Automation Platform"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

More support for:
IBM Engineering Systems Design Rhapsody

Software version:
8.3.1

Operating system(s):
Windows

Document number:
735647

Modified date:
21 August 2023

UID

ibm10735647

Manage My Notification Subscriptions