How to modify parameter passing type

Please use this forum for open discussions about Bouml.
Merci d'utiliser ce forum pour des discussions ouvertes à propos de Bouml.

How to modify parameter passing type

Postby coredmp » Sat 4 Nov 2017 10:06

Hello,

I want my parameter to be passed as pointer and not by reference. So i modify the Definition part of my function like this ( change the "&" to "*" ) :

Code: Select all
 ${comment}${inline}${class}::${name}${(}${t0} ${p0}, ${t1} * ${p1}, ${t2} * ${p2}${)} : m_nom(nom), m_test(test), m_gag(gag ) ${throw}{
  ${body}}


And the Declaration like this :

Code: Select all
    ${comment}${inline}${name}${(}${t0} ${p0}${v0}, ${t1} * ${p1}${v1}, ${t2} * ${p2}${v2}${)}${volatile}${throw}${abstract};


Which generate the good function for me in header file :

Toto(string nom, int * test, string * gag);

And the cpp part like this :

Code: Select all
Toto::Toto(string nom, int * test, string * gag) : m_nom(nom), m_test(test), m_gag(gag ) {
  ${body}}


For now everything is fine :).

But when i do a "Roundtrip C++", i have this message :

in C:\Users\fabri\Desktop\dev\Test\src\Toto.cpp line 4 Toto::Toto is lost

And it remove all the initialisation part, now my method is like this ( for the definition part, the delcaration is ok) :

Code: Select all
${comment}${inline}${class}::${name}${(}${t0} ${p0}, ${t1} * ${p1}, ${t2} * ${p2}${)}${throw}{
  ${body}}


.. I think i am doing it wrong ... but don't find how to do it ..

Someone has a solution ?

Fabrice
coredmp
 
Posts: 8
Joined: Mon 16 Oct 2017 07:57

Re: How to modify parameter passing type

Postby Bruno Pagès » Sat 4 Nov 2017 11:33

Hello,
coredmp wrote:I want my parameter to be passed as pointer and not by reference. So i modify the Definition part of my function like this ( change the "&" to "*" ) :

This is the right way

coredmp wrote:But when i do a "Roundtrip C++", i have this message :

in C:\Users\fabri\Desktop\dev\Test\src\Toto.cpp line 4 Toto::Toto is lost

And it remove all the initialisation part, now my method is like this ( for the definition part, the delcaration is ok) :

You are right, there is something wrong in the Roundtrip

Note : the reverse works well in that case
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 474
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: How to modify parameter passing type

Postby coredmp » Sat 4 Nov 2017 14:04

Ok, i will check if i can use the reverse.

Thanks for your answer

Fabrice
coredmp
 
Posts: 8
Joined: Mon 16 Oct 2017 07:57

Re: How to modify parameter passing type

Postby Bruno Pagès » Sat 18 Nov 2017 09:37

The problem is coming because your parameter has the direction "in" while for the roundtrip it is an "inout" => for it this is not the same operation. I have to change that

Note If you reverse then roundtrip there is no problem because the reverse sets the direction to be "inout"
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 474
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: How to modify parameter passing type

Postby Bruno Pagès » Mon 20 Nov 2017 19:59

Hello,

This bug is fixed in the 7.2

Best regards,

Bruno
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 474
Joined: Mon 20 Feb 2012 08:23
Location: France


Return to Open discussions / Discussions ouvertes

Who is online

Users browsing this forum: No registered users and 2 guests

cron