Book a Demo

Author Topic: Reverse engineering code that uses STL  (Read 4064 times)

ajaxx

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
Reverse engineering code that uses STL
« on: October 20, 2004, 01:44:35 pm »
I've got some class diagrams where I'm doing some forward engineering and a bit of reverse engineering.  Here's my scenario:

* I've modelled class A
* I've modelled class B
* I add an aggregate association between A and B such that 0..1 B's are members of 1 A.
* I set it to ordered multiplicity

This was supposed to model some simple set mechanics.  The code it generated wasn't really what I wanted, so I revised the code to reflect a truer version of what I wanted as follows:

public class A : public std::set<B*>
{
public:
   A() ;
   ~A() ;
}

Which is close enough for what I wanted at this junction.

Then I reverse engineered to synchronize.  My aggregation was gone (I figured this would happen).  But I get a small set indicator in the upper right hand of the class box.

Question #1

Where is the "set" represented in the element properties (I can't seem to find it anywhere; though the template parameters are set and instantiated).

Question #2

I am uncomfortable modelling set mechanics like this.  I want it to be represented in the diagram through an aggregate association and still retain its implementation details.



« Last Edit: October 20, 2004, 01:50:57 pm by ajaxx »

ajaxx

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
Re: Reverse engineering code that uses STL
« Reply #1 on: October 20, 2004, 01:48:49 pm »
BTW, it seems that regardless of how I try to restructure this message its corrupt.  There is some garbage about disagreeing in the middle of it which I can't find in my original text.  I'll try editing it some more to see if I can eliminate the discrepancy.

Seems there's a happy filter on there that doesn't like the word "a-s-s-o-c-i-a-t-i-o-n" and replaced it with disagree.
« Last Edit: October 20, 2004, 01:51:29 pm by ajaxx »

Martin Terreni

  • EA User
  • **
  • Posts: 672
  • Karma: +0/-0
  • Sorry, I can't write
    • View Profile
Re: Reverse engineering code that uses STL
« Reply #2 on: October 21, 2004, 01:33:52 am »
I'm not so familar with STL sets, but it seems to me that EA understood it correctly.
Exuse me if I'm totaly wronge...
Recursion definition:
If you don’t understand the definition read "Recursion definition".

ajaxx

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
Re: Reverse engineering code that uses STL
« Reply #3 on: October 21, 2004, 05:03:12 am »
I'm not saying it interpreted it wrong.   What I'm trying to say is what it the correct way to model this so that it shows up correctly in the model but additionally uses the implementation I've defined.

In this case, with A and B I want the diagram to show A and B with an aggregate relationship.  I want the implementation to reflect this through the use of a set.

The way I did this originally was to setup the class collections to use set<#TYPE#> for OrderedMultiplicity.  Then I set the association between A and B.  When I forward engineered the code the resultant code didn't include a set.

I think part of what is frustrating me is that if I define an aggregate relationship with EA, I do so by dragging an aggregate link from B to A.  It shows the diamond at A.  I then change the aggregate properties to indicate that the source multplicity is 1 .. * and the target multiplicity is 1.  Again it shows the numbers in the right places indicating a 1 to 1 or more relationship (I'd prefer a 1 to * here, but reading the documentation tells me I wouldnt get what I want).  I then set ordered multiplicity at the source.  The result I get it the default collection, not the ordered multiplicity collection.

So if someone knows what I'm doing wrong I'd really like to know.