Sparx Systems Forum

Enterprise Architect => Suggestions and Requests => Topic started by: kovacsp on January 31, 2005, 06:36:14 am

Title: c++ reverse engineering, CArray
Post by: kovacsp on January 31, 2005, 06:36:14 am
When reverse engineering our project, I've found a deficiency.

If I have references to other classes in CArrays or CMaps, EA doesn't create the associations for them. Maybe the reverse engineering process should keep an eye on these common templates as well as STL templates.

Is this going to be fixed?

Thanks,
Peter
Title: Re: c++ reverse engineering, CArray
Post by: eta on June 06, 2006, 04:21:11 am
I have the same problem.
We are heavily making use of templates, but when using EA Corp. Edition these references are skipped.

Work arround for this:
typedef CArray<Test*,Test*> CTestArray;

Could be:
class CTestArray : public CArray<Test*,Test*>
{
     Test** m_pDummy;
}

Now Enterprise Architect will now the class used in the template.
But this is a crappy solution and i have to bloat all our sources with these wrapper classes.

It would be great if there is a way to get EA to understand this:
typedef CArray<Test*,Test*> CTestArray;

Maybe EA should make use of the preprocessor output of the compiler?
(We are using VS6.0)

Thanx
Title: Re: c++ reverse engineering, CArray
Post by: Eve on June 06, 2006, 02:55:45 pm
What version of EA are you using?  I just tested this with build 791 and it imported the typedef.
Title: Re: c++ reverse engineering, CArray
Post by: eta on June 06, 2006, 11:37:14 pm
I am using 790.
Maybe they fixed it last week?  ;D
I will install the update and check it now
Title: Re: c++ reverse engineering, CArray
Post by: eta on June 07, 2006, 12:02:23 am
Quote
What version of EA are you using?  I just tested this with build 791 and it imported the typedef.


I does import the typedef in this new release.
But it does not make a association between the:
CProtocolArray (typedef CArray<CTestProtocol*,CTestProtocol*>) and the CTestProtocol class.

http://www.cyberpoint.nl/~ehart/IHC/EA_CARRAY.PNG
(http://www.cyberpoint.nl/~ehart/IHC/EA_CARRAY.PNG)

Based on this code:
Code: [Select]

#include <afxtempl.h>

class CTestProtocol
{
public:

CTestProtocol();

virtual ~CTestProtocol();

};

typedef CArray<CTestProtocol*,CTestProtocol*> CProtocolArray;

class AFX_EXT_CLASS CProtocolHandler  
{
public:

CProtocolHandler();

virtual ~CProtocolHandler();

protected:

CProtocolArray

m_aProtocol;
};
Title: Re: c++ reverse engineering, CArray
Post by: SF_lt on June 07, 2006, 12:19:34 pm
nothing more could be done by EA from the strict UML view - typedef only defines, what type of elements will be stored.

From relaxed UML view, dependency from typedef class to CTestProtocol could be added, stereotype for dependency could be <<use>> or other
Title: Re: c++ reverse engineering, CArray
Post by: eta on June 07, 2006, 11:04:25 pm
Quote
typedef only defines, what type of elements will be stored.

I dont understand what you mean :-[. Do you mean that my typedef just defines that the CArray will store CTestProtocol*? In that case there would be a relation for EA to detect.

When the typedef does not work, should this work then?
defining a class derived from CArray<CTestProtocol*,CTestProtocol*> ?
Code: [Select]
#include <afxtempl.h>

class CTestProtocol
{
public:

CTestProtocol();

virtual ~CTestProtocol();

};

class CProtocolArray : public CArray<CTestProtocol*,CTestProtocol*>
{
   ;
};

class AFX_EXT_CLASS CProtocolHandler  
{
public:

CProtocolHandler();

virtual ~CProtocolHandler();

protected:
CProtocolArray m_aProtocol;
};


Because this also doesn't put a link between CProtocolArray and CTestProtocol
Title: Re: c++ reverse engineering, CArray
Post by: SF_lt on June 08, 2006, 08:47:36 am

to be short - there is no way for the EA to build any link except dependency from CProtocolArray and CTestProtocol.

You won't get any more details from reverse engineering, because here EA strictly follows UML - and UML is not for any particular coding language, it's an independent notation.
Also you won't get any links for method argument list or method body code, however any user will say, that there are some dependencies...
You will have to add dependencies manually  ::)