${namespace} substitution not done in generated file

Please use this forum to signal bugs.
Merci d'utiliser ce forum pour signaler des bugs.

${namespace} substitution not done in generated file

Postby valade » Tue 9 Sep 2014 16:40

I use ${namespace} in the generation settings C++[1]
It substitutes when i look at the artefact in bouml
but it's not in the generated file ?!
what'wrong ?

see below for details

===== namespace is ev

within BOUML ************************************************************
--------------------------before substitution
#include <assert.h>
#ifdef _${name}_UT_
#ifdef _CLASSE_ABSTRAITE_
class Test: public ${namespace}::${name}{
public:
Test(parametres):${name}(parametres){} // si aucun parametres effacer : parametres

//définir toutes les méthodes abstraites (i.e. =0 dans le fichier en tête) avec un corps vide
};
--------------------------after substitution

#include <assert.h>

#ifdef _NoeudReseau_UT_
#ifdef _CLASSE_ABSTRAITE_
class Test: public ev::NoeudReseau{
public:
Test(parametres):NoeudReseau(parametres){} // si aucun parametres effacer : parametres

//définir toutes les méthodes abstraites (i.e. =0 dans le fichier en tête) avec un corps vide
};
outsite BOUML generated file ************************************************************
#include <assert.h>
#ifdef _NoeudReseau_UT_
#ifdef _CLASSE_ABSTRAITE_
class Test: public ${namespace}::NoeudReseau{
public:
Test(parametres):NoeudReseau(parametres){} // si aucun parametres effacer : parametres

//définir toutes les méthodes abstraites (i.e. =0 dans le fichier en tête) avec un corps vide
};
valade
 
Posts: 17
Joined: Tue 25 Sep 2012 12:46

Re: ${namespace} substitution not done in generated file

Postby Bruno Pagès » Tue 9 Sep 2014 17:24

${namespace} and ${NAMESPACE} must be used in an artifact generation only for the documentation part

The code generator manages the namespaces by itself, you don't have to add this prefix by yourself

The namespace is set at a package level, in the tab C++ when you edit it (other tabs allow to specify the Java package, the Php namespace, the Python package and IDL module)
Image

When a package specifies a namespace all the classes in the sub classviews are considered to be in this namespace
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 464
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: ${namespace} substitution not done in generated file

Postby valade » Fri 12 Sep 2014 06:42

I know this !
but as you can read in my previous post, I've added some personal code (unit tests) into the generation settings I want to be included in all
generated source files. This code is for unit test thus no link with UML to C++ conversion.
(it Is not o easy to explain)
The fact is that in bouml ${namespace} is subsituted but not in the generated file.
valade
 
Posts: 17
Joined: Tue 25 Sep 2012 12:46

Re: ${namespace} substitution not done in generated file

Postby Bruno Pagès » Tue 16 Sep 2014 13:05

Ok I will add this management

But I still think you don't use the right way, it it better to add/update your test classes as modelled classes thanks to a dedicated plug-out, to have standard code generation concerning the namespaces and to not have to do manual changes like you seem to have for "parametres". Your way is also incompatible with roundtriping
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 464
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: ${namespace} substitution not done in generated file

Postby Bruno Pagès » Sun 21 Sep 2014 16:56

Available in release 6.6.3
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 464
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: ${namespace} substitution not done in generated file

Postby valade » Mon 22 Sep 2014 10:07

Thanks
valade
 
Posts: 17
Joined: Tue 25 Sep 2012 12:46

Re: ${namespace} substitution not done in generated file

Postby valade » Mon 29 Sep 2014 11:57

When the namespace is empty the :: is generated !
::ClassName...
valade
 
Posts: 17
Joined: Tue 25 Sep 2012 12:46

Re: ${namespace} substitution not done in generated file

Postby Bruno Pagès » Mon 29 Sep 2014 14:08

of course, any text which is not a keyword ${..} or a users definition @{...} is always generated without any change, so "::" in your definition is generated

I don't proposed a new keyword also managing the "::" because "::" as a prefix is legal and indicates the next symbol is out of namespace

so what is your problem ?
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 464
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: ${namespace} substitution not done in generated file

Postby valade » Mon 29 Sep 2014 15:05

it is not a real problem for me, but I'm teacher, I think it could be confusing for my students at this moment
valade
 
Posts: 17
Joined: Tue 25 Sep 2012 12:46

Re: ${namespace} substitution not done in generated file

Postby Bruno Pagès » Mon 29 Sep 2014 16:18

ok

As I already said I think the way you use is not the right one, the right way is to create/update/delete the test classes by automatic modification of the model through a plug-out, and its implementation can be a good exercise for your students ... ;)
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 464
Joined: Mon 20 Feb 2012 08:23
Location: France


Return to Bug reports / Rapports de bugs

Who is online

Users browsing this forum: No registered users and 0 guests

cron