Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic TAU (steve huntington)
Decrease font size
Increase font size
Topic Title: COM API
Topic Summary:
Created On: 28-Apr-2006 13:32
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 28-Apr-2006 13:32
User is offline View Users Profile Print this message


Javier Martínez

Posts: 11
Joined: 22-Mar-2006

Hello,fficeffice" />>>

We are developing an Add-in using COM API. Our idea is use Visual Studio 2003 and C# adding the references of Telelogic TAU:>

using U2ModelAccessTypeLib;

using TauG2IntegrationAddinLib;

>

We have been testing with a short program and we obtain the next error: Meta feature Session is derived.>

The code is show below:>>

>U2ModelAccessTypeLib.TTD_ModelAccessClass ma = new U2ModelAccessTypeLib.TTD_ModelAccessClass();

U2ModelAccessTypeLib.ITtdModel pITtdModel=ma.LoadProject("adp_adp.ttp");

U2ModelAccessTypeLib.ITtdEntity pSession=(U2ModelAccessTypeLib.ITtdEntity)pITtdModel;

try

{

ITtdEntity pPackage;

pPackage = pITtdModel.New("Package");

pPackage.SetEntity("Session", pSession, 3);

}

catch(Exception excep)

{

System.Windows.Forms.MessageBox.Show(excep.Message);

}

>

Thanks in advance.>>

Best Regards.

Report this to a Moderator Report this to a Moderator
 28-Apr-2006 16:32
User is offline View Users Profile Print this message


Ian Barnard

Posts: 91
Joined: 4-Jul-2002

Javier

Nice smilies

In the metamodel, the Session metafeature is what UML calls 'derived' which usually means it is worked out from some other metafeatures and not stored as a value itself, so you can't modify it. In this case, the Session is effectively the model instance you are using so it has a different value each time TAU runs, and modifying it wouldn't be sensible so TAU doesn't allow it.

I guess you are trying to create a package: to do this, use the Create api function, which will create an element below the thing you specify to the Create call (give it the Model to create a top-level package); then all you have to do is set its name using SetValue on the metafeature Name. Use the Create call passing it your new package to create elements in the package. The example 504 (for TAU 2.6) in the help for Create (under Customizing TAU->COM API->ITtdEntity) shows how to create a top-level package, a sequence diagram and an assignment expression.

To better understand the TAU metamodel which you are accessing using COM, if you haven't already you should download and use the SDK; when I start an addin which creates or reads model I always create an example model in TAU just like what I want the addin to create/read, and then use the debugger to explore the model and understand the relationships between elements and how to navigate between them.

I remember one thing which confused me at first when using the API (using tcl) was the difference between Get/SetEntity and Get/SetValue; use Get/SetEntity when you need a reference to a model element for example when you might then want to use Get/SetEntity or Get/SetValue on its metafeatures, but use Get/SetValue when you need to read/write the actual value of a metafeature, for example the Name of an element.

HTH
Ian

-------------------------
=============
Ian Barnard
Principal Consultant
Telelogic UK, an IBM company


Edited: 28-Apr-2006 at 16:57 by Ian Barnard
Report this to a Moderator Report this to a Moderator
 4-May-2006 08:52
User is offline View Users Profile Print this message


Javier Martínez

Posts: 11
Joined: 22-Mar-2006

Ok.

Many thanks Ian.
Report this to a Moderator Report this to a Moderator
Telelogic TAU » TAU/Developer » COM API

Topic Tools Topic Tools
Statistics
20925 users are registered to the Telelogic TAU forum.
There are currently 1 users logged in.
The most users ever online was 15 on 31-Mar-2008 at 16:22.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.