template parameter [message #760715] |
Sun, 04 December 2011 13:08  |
Eclipse User |
|
|
|
Hello,
I need to define a class template, whose argument is a generic class T. That is, the easiest thing. Something that in C++ code would be
template <class T> class MyClass {...
I created the class, added the RedefinableTemplateSignature and finally added the ClassifierTemplateParameter to such signature.
It displays <UNDEFINED>; I understand that I have to set one of the properties of the parameter (which one? "parametered element"?) to make it "point" to an actual type. If I try it, I need to select either an existing element of my diagram or create a new one.
This is confusing, since I know that there would be another step ("constraining classifier") to constrain the template parameter to some specific element (which is a very important feature); but now I do not understand what I am supposed to choose at this stage, if I want my template parameter to be just a generic class T.
Any hint appreciated
Thank you.
B
|
|
|
Re: template parameter [message #760718 is a reply to message #760715] |
Sun, 04 December 2011 13:26   |
Eclipse User |
|
|
|
Hi Bruce
My sympathies. When the tools fail to abstract the details you have to
understand the details which are not easy. Once you understand what you
would like your UML model to look like, you should then understand how
to control it with Papyrus. Beware that the UML model has magic
synonyms, so parameteredElement and ownedParameteredElement are related.
You may find some working examples of templates in
org.eclipse.ocl/model/OCL.uml and org.eclipse.ocl.uml/model/OCLUML.uml.
Regards
Ed Willink
On 04/12/2011 18:08, Bruce wrote:
> Hello,
>
> I need to define a class template, whose argument is a generic class
> T. That is, the easiest thing. Something that in C++ code would be
>
> template <class T> class MyClass {...
>
> I created the class, added the RedefinableTemplateSignature and
> finally added the ClassifierTemplateParameter to such signature.
>
> It displays <UNDEFINED>; I understand that I have to set one of the
> properties of the parameter (which one? "parametered element"?) to
> make it "point" to an actual type. If I try it, I need to select
> either an existing element of my diagram or create a new one.
> This is confusing, since I know that there would be another step
> ("constraining classifier") to constrain the template parameter to
> some specific element (which is a very important feature); but now I
> do not understand what I am supposed to choose at this stage, if I
> want my template parameter to be just a generic class T.
>
> Any hint appreciated
>
> Thank you.
> B
|
|
|
|
Re: template parameter [message #760759 is a reply to message #760723] |
Mon, 05 December 2011 01:35  |
Eclipse User |
|
|
|
Hi
org.eclipse.ocl is the Eclipse (MDT) OCL project, which forms part of
the standard Modeling EPP, so you may just import it as a fragament.
Alternatively its GIT is at
http://git.eclipse.org/c/mdt/org.eclipse.ocl.git/tree/plugins/org.eclipse.ocl/model/OCL.uml.
Regards
Ed Willink
On 04/12/2011 20:14, Bruce wrote:
> yeah... I know that..
>
> That's why I looked into the UML specifications to figure out how the
> metamodel looks like, but it's such a mess.. I was hoping to find a
> quicker solution, but I guess I have no choice..
>
> What are those URLs you suggested me? They don't look like web pointers..
>
> Thanks so much.
>
> B
|
|
|
Powered by
FUDForum. Page generated in 0.03835 seconds