1
General Board / Re: Some questions related to code generation / C+
« on: June 04, 2013, 04:16:28 pm »
Hi Stephane,
I've tried parantheses and also some usual ways to make a index based access (e.g. %paramName(0)%). Nothing worked.
That attributes start with m_ is not the problem, actually that is right. But when taking the attribute name to build upon this the paramname this prefix would not be right. That's what I tried to express.
After giving this conversion thing some thoughts, I came to the conclusion that this solution would be just as prone to error for the final code as what I already have. This is because I would bring naming logic into the templates, resulting in eventually not working generated code when someone doesn't mind this and defines completely different parameter names. With my list solution at least the defined parametername will be used.
But one thing still is interesting for me: user defined macros can be created? I've searched for such a possibility but did not found it. I also searched something to see which macros are already existing just to know what possibilities are given to me with existing macros. The user guide doesn't tell much about this topic (just short description of existing but not all macros).
I don't know much about MDA but I've tried it with a transformation to C++ with a single class resulting in no noticeable difference. I think that I'm already doing the UML modeling C++ specific so that there is no need for a transformation.
The solution with the classtags is an acceptable way for defining the needed namespace statements. This works well and I'll have less "after generation"-work
Thank you!
I've tried parantheses and also some usual ways to make a index based access (e.g. %paramName(0)%). Nothing worked.
That attributes start with m_ is not the problem, actually that is right. But when taking the attribute name to build upon this the paramname this prefix would not be right. That's what I tried to express.
After giving this conversion thing some thoughts, I came to the conclusion that this solution would be just as prone to error for the final code as what I already have. This is because I would bring naming logic into the templates, resulting in eventually not working generated code when someone doesn't mind this and defines completely different parameter names. With my list solution at least the defined parametername will be used.
But one thing still is interesting for me: user defined macros can be created? I've searched for such a possibility but did not found it. I also searched something to see which macros are already existing just to know what possibilities are given to me with existing macros. The user guide doesn't tell much about this topic (just short description of existing but not all macros).
Quote
Do you perform a model transformation before the code generation? I always do a two step generation for Java: MDA transformation from platform independant model to Java specific model, then code generation. My imports are solved two ways : either I create a Dependency connector between my classes, or I add a tagged value to my class:
I don't know much about MDA but I've tried it with a transformation to C++ with a single class resulting in no noticeable difference. I think that I'm already doing the UML modeling C++ specific so that there is no need for a transformation.
The solution with the classtags is an acceptable way for defining the needed namespace statements. This works well and I'll have less "after generation"-work
