Version: 1.5.1 (using KDE 3.5.0 Level "a" , SUSE 10.0 UNSUPPORTED) Compiler: Target: i586-suse-linux OS: Linux (i686) release 2.6.13-15.7-default Setting the type of an attribute to a pointer (int *), or a reference (int&) creates new datatypes in the Datatypes list. For the C++ this is not desirable. To address this problem, handling of the datatypes would have to be language dependent rendering de model less general. You could have an option of modelling for a particular language or strict uml.
I am missing this feature in building an uml class diagramm too. I'd like to set a variable as a pointer that is pointing to an existing class. For example: Car "has" an engine(composition), but "uses" a trailer(aggregation): class Car { private: Engine myEngine; Trailer* theTrailer; };
IMHO we need an extra option for this - we can't just equate pointer types to aggregations: It may be that some association between classes is designed as a composition although the implementation type used is a pointer.
Yes, I also think, that an extra option to set a variable as a pointer is the right solution. Now Umbrello(v1.5.1) doesn't recognise the dekleration as a pointer, but think that it is a new class. It was just an example, how I'm often handling aggregations.
Why not adding C++-specific stereotypes like <<CppConstRef>> or <<CppPointer>> ?
Created attachment 88553 [details] screenshot of umbrello git master umbrello git master imports the following code fragement like shown in the screenshot ---------------------------- /// file comment /// class Trailer class Trailer { public: Trailer(); }; /// class Engine class Engine { public: Engine(); }; /// class Engine class Test { public: Test(); }; /// class Car class Car { private: Engine myEngine; Trailer* theTrailer; Test &mytest; }; ------------------------------- In datatype folder the following related types are created Engine Trailer*& Test& Test Trailer* and Test& are used as type for the related class Car members (could be seen from the saved xmi file). In the class diagram the associations are mapped to the related classes Trailer and Test and are both displayed as aggregations.
(In reply to Jose N Hinckel from comment #0) > Version: 1.5.1 (using KDE 3.5.0 Level "a" , SUSE 10.0 UNSUPPORTED) > Compiler: Target: i586-suse-linux > OS: Linux (i686) release 2.6.13-15.7-default > > Setting the type of an attribute to a pointer (int *), or a reference (int&) > creates new datatypes in the Datatypes list. Looking into a related xmi files one can see that those datatypes are no type duplicate, but contains a reference to the base type. <UML:DataType visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" elementReference="uySr5L3VImhKn" isRoot="false" xmi.id="u3bdEfBYiP9rT" name="Trailer*"/> points to <UML:Class visibility="public" isSpecification="false" namespace="Logical_View" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="uySr5L3VImhKn" comment="class Trailer" name="Trailer"> and <UML:DataType visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" elementReference="uTDYU7cG6r3iU" isRoot="false" xmi.id="uGt9gg5Idb37K" name="int*"/> points to <UML:DataType visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="uTDYU7cG6r3iU" name="int"/> Attributes in a class references the specific datatype or class (look for "u3bdEfBYiP9rT") <UML:Class visibility="public" isSpecification="false" namespace="Logical_View" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="u3Fa94HnsSyef" comment="class Car" name="Car"> <UML:Classifier.feature> <UML:Attribute visibility="private" isSpecification="false" xmi.id="uOcLoZxRkXmgY" type="u3bdEfBYiP9rT" name="theTrailer"/>