Generating class diagram from source code - c++

I'm using Enterprise Architect and I wish to generate some class diagrams for a specific set of C++ objects within a massive project. By right clicking on a particular model and choosing Code Engineering from the context menu I can import the entire source directory for the project and generate class diagrams for all objects in the project.
I can also simply generate a class diagram for a single source file. However what I'd ideally like is to generate individual class diagrams for a particular set of files within the project (for example ones which only contain the text SNMP within their names). Can anyone help me apply this filter as the class diagram for the entire project is too large and unwieldy to manage in any capacity.

In Enterprise Architect once you have imported the entire model like you have already done you can create additional diagrams to show only the parts of the model you need. In fact I consider this normal practice.
First create a new diagram with Add->New View -> Class View & diagram.
Then drag only the classes you want from Model in the Project Browser onto the new Diagram.

If you comment your code using doxygen then you can generate these class diagrams automatically. Please look at our code at github/nvmecompliance/tnvme for example. I'm not sure if this directly applies to your case if the source code you are not going to modify..

Related

C++ class diagram Visual Studio 2022. I can't add a class to the mapping

Once again, the God-fearing and beloved (no) program Vusial Studio is forcing me to ask for help! I have a problem with the class diagram in C++. I want to add a class to the display and....error
"One or more of the selected elements cannot be added to the class diagram. This may be due to several limitations of the tool. Call for help for more information."
(by dragging and dropping from the Solution Explorer to the diagram)
I have no idea how to deal with it. Maybe it has something to do with adding the project to the version control system.
This is what the project schema looks like:
Tried adding a class to the diagram and waiting for it to display
According to the document: Class Designer errors:
Class Designer does not track the location of your source files
To resolve the error, drag the modified or relocated source code to
the class diagram again to display it.
This problem also occurs in my new MFC app. I opened the class file to make some changes and save it. Then the class designer works fine.

Generate draw.io map diagram from hierarchical JSON/XML

I'd like to programmatically generate a draw.io map diagram from nested XML/JSON exported from Zotero (individual items nested in sub-collections and collections).
I already have the basic JSON/XML, which can be adapted to draw.io's format, but I'm not clear how. There seems to be no schema for the app's diagram format, and the source XML of existing diagrams includes a lot of style and layout information that I want to avoid having to calculate -- I am assuming, given that the Layout option in the app is automatic, that there must be a way to automatically render a diagram without having to include manually-specified style/layout info.
So I have three questions:
Is there a standard XML/JSON scheme for hierarchical draw.io map diagrams?
Is it possible to give draw.io just the relationship info between elements, and have it determine the layout automatically (akin to the automatic Arrange > Layout options within the app)?
Within a draw.io map, can a node be connected to more than one parent?
I've created a converter from json to drawio format. It does not work with nested collections now, but it may help anyway.
https://github.com/Voravomas/drawio_diagram_converter
How about this VS Code extension? https://github.com/hediet/vscode-drawio

How do you make a report template for a single Enterprise Architect diagram?

I have a package with about 25 diagrams in it. I have used EA templates to make a package report that gives the name and notes for each diagram. However I want make a more specific report that can generates the report for just one diagram containing the description from each element in the diagram. Is this possible? It does not seem like diagrams have anywhere I can generate reports from.
UPDATE: I am currently trying to figure out how to do this with Document Options>Except where Query excludes Package:>Custom SQL but cannot get it. Here is my SQL statement:
SELECT t_diagram.ea_guid & t_diagram.Name AS [DesiredService-Hyperlink]
FROM t_diagram
WHERE t_diagram.Name = 'Diagram_Name'
I tried putting this in the Report's Custom SQL, that didn't work. Then I tried putting it in a fragment's Custom SQL with the following in the template itself
custom >
{DesiredService-Hyperlink}
< custom
This also did not work. I have been trying to go off of various documentation and YouTube Videos. If anyone could point me in the right direction that would be great.
Enterprise Architect document generation is based more on the model structure then on the diagrams.
The easiest approach would be to put each diagram in a different package or nested under a specific element, even if only temporary to generate the document.

How can I visually design a component in C++ Builder?

I have been away from C++ for a couple of years now doing AS3/Flex work. I have gotten used to being able to create a component and place it in design mode with very little fuss and I am struggling to get my head around the C++ Builder way of doing the same thing.
I have written many components for C++ Builder in the past, but none of them have been visual. What I would like to do now is create a component for customer search and another for order processing because I want to be able to create a new instance of these on the fly. What I don't want to do is have to place each of the components like the dbgrid and search fields manually in code. I would like to do this (as well as set their properties) in design mode.
How do I go about this? I have browsed the source for other Delphi components and I notice they have dfm files which seems to be what I need. How do I do this in C++ Builder? The only option I see is to add a new form if I want a dfm, but this isn't what I want as my components will be based on TPanel.
Is there a way to do this or do I have to resort to doing it all in code with no visual reference?
Pursuing the DFM idea I did a test this morning where I created a component based on TPanel and added a new form to it which I create and parent in the constructor of the component. In design mode I set the form border to none and placed a grid on it. This all looks OK until I place the component in my application, at that point it looks like a panel with a standard looking form in it and the grid is missing. If I run the app the panel shows as expected, borderless and with a grid. The DFM appears to be ignored in design mode for some reason.
If you know a better way to do this than using components then please give me some pointers.
Any help and advice will be appreciated beyond words
You might want to have a look at frames (look for "Frame objects"). They are "subforms" you can design visually and then place on forms.
Just as an FYI item, you can also drop the panel on a form, put any other controls on it, position them, set captions, etc..
Now, click the panel to select it, and use Component->Create Component Template from the IDE's main menu. This creates a unit you can install as a component which will add the panel and it's sub-controls (as a single component) to the IDE's component palette.
Of course, you can then modify the source for that new component like any other component source.

Using JET with EMF

I need to run JET templates on a EMF model metadata - i.e. the model itself (not data) is input to my JET template.
More practically - I want generate non java code, based on EMF templates.
How I do it?
Thank you
I'm not sure I get you right, but you can pass your model just like any other object into the JET template (as described in the JET tutorial). Also, it makes no difference if you generate Java or any other text with JET. As an additional pointer, you might want to consider using Xpand (part of openArchitectureWare) for very comfortable model to text generation (including things like content assist for your model in the template editor).
For code generation, you could use Acceleo. That is like Xpand very comfortable model to text generation (Acceleo language is very intuitive for model browsing) and also less painful than JET.