Hi,
In a UML activity diagram, what is the correct way of modeling passing a function pointer from one action to another "action"? The "destination action" is of course pretty empty, and all it does is to receive the function pointer (from the source action) and run the function.
TIA
Avraham
A couple of comments:
First, this is really below the level of UML per se and is in the realm of the underlying "action language".
Second, I can see why you might actually want to do this anyway. Here's an approach to address this kind of question. Write out the code you want to replicate and then reverse engineer it into Rhapsody and take a look.
I took the following code:
int foo(int i){ return i + 1;}
typedef int (*g)(int); // Declare typedef
g func = &foo; // Define function-pointer variable, and initialize
int hvar = func(3); // Call function through pointer
and used Tools > Reverse Engineer to bring it into a Rhapsody model. This is what I got. (Figure 1).
g, the typedef, was brought in as a type (kind: Language) using the following definition (Figure 2).
The assignment of the variable func is shown in Figure 3.
Hope this helps.
>> First, this is really below the level of UML per se and is in the realm of the underlying "action language".
You mean this (usually) is the low/detail level inside the actions?
>> First, this is really below the level of UML per se and is in the realm of the underlying "action language".
I am reverse engineering a system and modeling it in SysML/UML.
Background if it is of any significance:
The system is an enormous complex real-time embedded system and mission critical. My area of interest is the System TLD (top-level design) of the operational system. It is the top-most stuff. There is a large number of software engines running on multiple cores on a single board. I call it a SW Engine grid (my made-up term). And some of the engines are defined as being invoked via a function pointers. I don't yet know why they are invoked via function pointers and have not had time to ask.
So ... in my company, function pointers are used to invoke entire modules.
>> Here's an approach to address this kind of question. Write out the code you want to replicate and then reverse engineer it into Rhapsody and take a look. Thanks. It would be a good idea. But I have been doing my so called modeling just by drawing SysML/UML diagrams using Visio. That's what I have. No actual MSBE platform (yet). So I am wondering what difference it should make in the SysML/UML diagram: (i) Action A passes control to action B
as opposed to (ii) Action A sends a function pointer to action B, which uses it to invoke some action C. That was me thinking out loud ...
i need to get more info on "who" supplies the function pointer to action A, and why does this have to be an indirect function call. I.e., why does the identifying of the address of the function have to be delayed until run-time? Will share it with you when I know more.