Using C ++ STL in Enterprise Architect

How can parts of C ++ STL be used in Enterprise Architect?
It would be nice to specify specific class attributes as std::string or use std::auto_ptr (or even std::tr1::shared_ptr ) as types.

Another interesting thing: how can I integrate container types like std::vector and std::map into EA.

+7
source share
2 answers

I taught how STL containers are similar to EA, I think it can also be extended to stl pointers:

Forward Engineering:

You can define collection classes for different multiplications around the world in the language settings or for a specific class of your project (this will determine how it is "contained" in other classes) this way . A simple example:

Set all collection classes to std :: vector

Make sure the container classes are for the target class of the association, not the source. Set the multiplicity of the target role to several (different from 0, 0..1, 1 and empty fields according to the code template). In addition, set the association target role restriction to a value to avoid creating a container pointer.

Another, more flexible way would be to change the code templates in the settings β†’ Code generation templates. I believe there is a way to override the default template for stereotyped connectors, although I have never tried. This is probably the only way to generate STL pointers, since collection class definitions are used only by EA for multiplicities greater than 1.

Reverse Engineering :

Go to Tools-> Options-> Engineering-> C ++ Source Code and add the following line to the "Extra Collection Classes":

 vector<#TYPE#*>;deque<#TYPE#*>;list<#TYPE#*>;stack<#TYPE#*>;queue<#TYPE#*>;priority_queue<#TYPE#*>;set<#TYPE#*>;map<*,#TYPE#*>;multiset<#TYPE#*>;multimap<*,#TYPE#*>; 

I have never tried, but I assume adding STL pointers to this is trivial.

Circular Technique

I do not know if this works higher if you are doing a circular motion technique. I assume that the definitions are asymmetrical and cause problems.

+3
source

I play with such things, and it is possible ... simple.

What you need to do is reverse engineer the libraries from the source code, but since EA does not contain a complete preprocessor, you will get many "You may have to define language macros" errors. Perhaps actually starting the source through the preprocessor will help.

Another way, of course, is to simply add STL classes as needed.

Regarding container types, I'm not sure EA provides any support for designs like Allocator in

 template < class T, class Allocator = allocator<T> > class vector; 

Simple template classes, however, are defined as a class with template parameters. The easiest way to create an instance is to create a new class, go to the "Templates" tab and add a binding to the Class template; this allows you to select values ​​for the formal parameters of the template.

+1
source

All Articles