Book a Demo

Author Topic: duplicates after synchronization  (Read 6200 times)

r2d2

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
duplicates after synchronization
« on: November 11, 2012, 10:51:16 am »
Hi all,

i am new with EA and currently i struggle with the code synchronization (c++). A method in my class has parameters which are from an other package. When i choose the data type of the parameter from the model list (under (...)), EA always create the method on synchronization and i get duplicates. If i don't choose the type from the list, and edit the data type by hand, it will not create duplicates. But then, the internal reference inside EA ist not set. What am i doing wrong?

MREA

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: duplicates after synchronization
« Reply #1 on: November 12, 2012, 06:20:24 pm »
do you have an example for that?for a better visualisaton of the problem?
Support- Languages: German, English, French

cliint3112

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: duplicates after synchronization
« Reply #2 on: November 16, 2012, 06:35:50 pm »
Hello,

in my case, i have a c++ class with the following setup:
m_pVar1 : ns1::ns2::type1*
m_iVar2  : ns1::ns2::type2
+ Constructor()
+ ~Destructor()

After Codegeneration my class has a new Member

m_iVar2* : ns1::ns2::type2

The class has a generalization to a suerclass, is father of a subclass and has a directed association to a third class.
Evaluated this in v8.0.864 and v9 trail
I can't find any hint in any of the class setup dialoges, were this class is contained.

Greetings,
clint3112
« Last Edit: November 16, 2012, 06:48:41 pm by clint3112 »

MREA

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: duplicates after synchronization
« Reply #3 on: November 16, 2012, 06:45:05 pm »
look in tools-options - attr

here you can give the name

and i think in gernerate code

auto rolename must be off for deleting it!
Support- Languages: German, English, French

cliint3112

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: duplicates after synchronization
« Reply #4 on: November 16, 2012, 06:57:05 pm »
Hi and thanks for the fast answer.

Neither the association helped, because the association is not to type2 class, nor the autogenerated role names.

MREA

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: duplicates after synchronization
« Reply #5 on: November 16, 2012, 09:05:35 pm »
other possible things, that made me trouble in this case.
But in C

-OO-Support,
- stereotype
     -template
     - double stereodeklaratin[see element Properties: Stereotype Button[…] if there are further crosses than needed],
- filename != classname)
Support- Languages: German, English, French

r2d2

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: duplicates after synchronization
« Reply #6 on: November 19, 2012, 01:29:40 am »
Hello,

let me explain it step by step.

1.
Create a new new project with class view. Delete the created packages "System" and "Frameworks"

2.
Add a new packages "ns1" with a new diagram. Select class for the new diagram

3.
Insert a new Class into the package diagram ns1 and change the properties. Set name to "int8_t" and choose typedef as stereotype from the c++ profile. Select "c++" as language from the dropdown.

4.
Set the parent for the new class to "__int8".

5.
add a new class "Class1" to the diagram, choose "c++" for the language.

6.
add a new operation to Class1. Set name to "f1" and click edit to edit the parameter list. You will be asked to save the new operation, click yes. Type "p1" for the new operation name and click on "..." to select a parameter type. Choose the typedef int8_t from the treeview. Click save to save the operation and close the dialog.

7.
set the filename for int8_t to "c:\tmp\types.h"

8.
set the filename for Class1 to "c:\tmp\class1.h"

9.
make sure that EA will create namespaces in Options-> C++ -> Generate Namespaces.

10.
generate the packages source code.

The class declaration for Class1 will look like this:
Code: [Select]
namespace ns1
{
      class Class1
      {

      public:
            Class1();
            virtual ~Class1();

            void f1(ns1::int8_t p1);

      };

}

If you now create the package source again, EA will create another operation f1.

MREA

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: duplicates after synchronization
« Reply #7 on: November 19, 2012, 05:01:20 pm »
this are your getter and setter fkt!!

tools-options - source code - object lifetimes

constructor deconstructot must be turned off!!
than it works properly!

pls tell me if it worked
« Last Edit: November 19, 2012, 08:15:41 pm by EAIFM »
Support- Languages: German, English, French

r2d2

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: duplicates after synchronization
« Reply #8 on: November 20, 2012, 07:06:56 am »
Disabling the creation of the constructor and destructor didn't solved the problem. The function still gets created on every synchronization.

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: duplicates after synchronization
« Reply #9 on: November 20, 2012, 08:12:24 am »
ns1::int8_t looks suspect somehow, is there any code generated for the typedef?

How do you specify the parameter in the UML model (fully qalified)?

Regards,
Günther
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

r2d2

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: duplicates after synchronization
« Reply #10 on: November 22, 2012, 10:12:29 am »
i created it exactly as described in Reply #6. I tried it with importing the typedef from the source file, EA creates an element with the same settings, and the problem still exists. I don't specify the parameter manually. I always choose it from the "Select Type" dialog box. If i specify it manually, EA won't recognize changes, like renaming and moving into other packages, on the elment type.
What do you mean by 'ns1::int8_t looks suspect'?

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: duplicates after synchronization
« Reply #11 on: November 22, 2012, 10:31:18 am »
Quote
What do you mean by 'ns1::int8_t looks suspect'?

int8_t should be an integral type from global namespace not in ns1.
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/