Show package name in class diagram?

Show package name in class diagram?

Postby Dan » Fri 18 May 2018 14:14

Hi all,

Under the main project I created a package pack2, a class and deployment diagram and class Test.

I set the directory and name space and generate Test.cpp and Test.h as expected.

In a main project class diagram I click add class and select Test [pack2] from the list
and a class Test 'image' is added to the class diagram as expected.

But I would like 'pack2' to appear somewhere on the Test class 'image' - how can I do this?

Thanks.
Dan
 
Posts: 33
Joined: Sat 12 May 2018 13:55
Location: England

Re: Show package name in class diagram?

Postby Bruno Pagès » Fri 18 May 2018 14:58

Hello,

Dan wrote:...
In a main project class diagram I click add class and select Test [pack2] from the list
and a class Test 'image' is added to the class diagram as expected.

Please note you can also drag&drop the class Test from the browser into the diagram, this can be faster

Dan wrote:But I would like 'pack2' to appear somewhere on the Test class 'image' - how can I do this?

This is what I name "context" in the drawing settings.

If you want to do that only for Test in the diagram call the menu on the class representation (right click on it), choose "edit drawing settings" then look at the setting "show context". You have several possibilities : "no" to not indicate the context, "uml" to prefix the name of the class by the path of the uml-package containing it, "namespace" to prefix the name of the class by the C++ namespace may be set by the closer uml-package containing it, etc

The drawing setting "show context in members definition" does the same for the members supposing you asked for to show their full definitions

This is explain in the chapter class of the reference manual, search for "show context". For each kind of element the corresponding chapter explain in the second part how the element can be drawn in a diagram

Of course you can also draw the package "pack2" in the diagram and put the class representation inside
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 588
Joined: Mon 20 Feb 2012 09:23
Location: France

Re: Show package name in class diagram?

Postby Dan » Fri 18 May 2018 15:43

Thanks for that.

That solves the issue, although in the diagram settings dialog, should 'uml' be ''package'?, as that is the property set in the package dialog.

I understand that the bouml package and name space map onto generated source directory and c++ name space, but I do not understand what the bouml component does.

The help says:
>>>>>
Required classes : This tab allows to specify the list of interface the component requires.
Provided classes : This tab allows to specify the list of interface the component provides. When a component C contains nested components, it is impossible to repeat the list of provided/realized interfaces at the level of C already defined by the sub components, the right list will be provided when you will add ~~ or ~~
Realizing classes : This tab allows to specify the list of classes realizing the behavior of the component.
<<<<<<

But I have no idea what this means! Maybe something has been lost in translation ;)

In c++ there are really only classes (including abstract interfaces etc) and name spaces, so a component could be shorthand for a class / interface class or a collection of classes (name space?) maybe with a wrapper class to interact with.

So could you explain how components map onto generated c++ ?

Thanks.

Edit - In short - I understand UML component diagrams - I just don't get what BOUML does - if anything - in generating or affecting code.
Dan
 
Posts: 33
Joined: Sat 12 May 2018 13:55
Location: England

Re: Show package name in class diagram?

Postby Bruno Pagès » Fri 18 May 2018 16:28

Dan wrote:should 'uml' be ''package'?, as that is the property set in the package dialog.

The context "uml" shows the path made by the name of the packages in the UML sense, I use 'uml' rather than word 'package' because in Java and Python a 'package' is the equivalent of the (C++) namespace / (IDL) module, so 'package' is confusing

Dan wrote:... I do not understand what the bouml component does.

The components in Bouml do what they have to do to follow UML ;)
Referring to the § 11.8.6 from page 224 of UML formal 2.5.1 : "A Component represents a modular part of a system that encapsulates its contents and whose manifestation is replaceable within its environment."

Dan wrote:The help says:
...
But I have no idea what this means! Maybe something has been lost in translation ;)

I hope it is more clear after you read the norm, I know my English is perfectible :lol: , if something is wrong please propose a correction

Dan wrote:In c++ there are really only classes (including abstract interfaces etc) and name spaces, so a component could be shorthand for a class / interface class or a collection of classes (name space?) maybe with a wrapper class to interact with.
So could you explain how components map onto generated c++ ?

BoUML is not a C++ tool but first a UML tool, even it manages also C++ and other languages, several concepts in UML do not map onto C++


Dan wrote:Edit - In short - I understand UML component diagrams - I just don't get what BOUML does - if anything - in generating or affecting code.

The components have no impact in the generated code
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 588
Joined: Mon 20 Feb 2012 09:23
Location: France

Re: Show package name in class diagram?

Postby Dan » Fri 25 May 2018 11:35

Thanks for all that!
Dan
 
Posts: 33
Joined: Sat 12 May 2018 13:55
Location: England


Return to Examples - How to do / Exemples - Comment faire

Who is online

Users browsing this forum: No registered users and 1 guest

cron