Book a Demo

Author Topic: simulation with javascript and code generation for C++  (Read 2971 times)

fy1997

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
simulation with javascript and code generation for C++
« on: June 10, 2020, 07:17:28 pm »
hi, I created an activity diagram, which can be used for simulation. I filled in the JavaScript code in the effect of the action of the activity diagram, and at the same time I need to use the activity diagram to produce C++ code, I also need to fill in the C++ code in the effect.How do I achieve fast switching between these two kinds of code?

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: simulation with javascript and code generation for C++
« Reply #1 on: June 10, 2020, 08:57:44 pm »
Hello,


Pretty sure you can't. Each element can really only represent a construct in one target language, and while you can change the Language property, there's only one property to hold the effect code, not one per language.

EA has a model transformation facility, which you might be able to use in this situation. With that, you create one "platform-independent" model which you transform to one or more "platform-specific" models (PIM to PSM). In this case, you would want two PSMs, one for C++ and one for Java. You'd add the effect code in the respective language separately in the two PSMs.

Model transformation is a somewhat complex field to get into, and whether it's worth investigating in your case I can't say. But I don't think there's a way of maintaining source code in two languages using a single model.

HTH,


/Uffe
My theories are always correct, just apply them to the right reality.