Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: adeebulhafiz on July 07, 2022, 11:29:25 pm

Title: Model array, structs and enums within a C++ Class for Generating code
Post by: adeebulhafiz on July 07, 2022, 11:29:25 pm
Hi Community

I am trying to generate and build the code for an executable state machine. The class should have a user defined enum variable, an array and a struct type variable. However the code generated is not correct and throws error on compilation.
How do I model this correctly in UML so that it compiles well?
I created a data type and enum separately and then added a composition link from class to these elements. Then I used enum and the data type in the Class as an Attribute. However during code build, I am thrown with bunch of errors basically meaning that these data types are not defined anywhere.

Note: I don't want a separate Classes for the each data type element. I want them to be included in the same file as .c or .cpp file depending on the language


Class Diagram:
https://ibb.co/C5g6DX2 (https://ibb.co/C5g6DX2)

Error and relevant code snippet generated:
https://ibb.co/sQGVWvk (https://ibb.co/sQGVWvk)
https://ibb.co/tcFCDJD (https://ibb.co/tcFCDJD)

C++ Error:
https://ibb.co/0y565fB (https://ibb.co/0y565fB)

UML level: Beginner
EA version: 15.2

Thanks
Syed Adeebul Hafiz