Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » template parameter
template parameter [message #760715] Sun, 04 December 2011 18:08 Go to next message
Bruce L. is currently offline Bruce L.Friend
Messages: 81
Registered: June 2011
Member
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 18:26 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
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 #760723 is a reply to message #760718] Sun, 04 December 2011 20:14 Go to previous messageGo to next message
Bruce L. is currently offline Bruce L.Friend
Messages: 81
Registered: June 2011
Member
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
Re: template parameter [message #760759 is a reply to message #760723] Mon, 05 December 2011 06:35 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
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
Previous Topic:Can I create my own metamodels with Papyrus?
Next Topic:Installation problem in Eclipse Indigo
Goto Forum:
  


Current Time: Sat Apr 20 00:05:00 GMT 2024

Powered by FUDForum. Page generated in 0.03310 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top