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: Getting values attached to a stereotype
Topic Summary:
Created On: 4-Apr-2006 09:51
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.
 4-Apr-2006 09:51
User is offline View Users Profile Print this message


Nitin Bharathy

Posts: 4
Joined: 4-Apr-2006

Hi,

I have a use case and a couple of stereotypes applied to it. I want to get the values of all the attributes attached to that stereotypes. I have tried to use GetTaggedValue but in vain.

I also want to query a particular stereotype with an attribute and retreive its value.

Please tell me how to do these two things.

Thanks,
Nitin

Report this to a Moderator Report this to a Moderator
 4-Apr-2006 17:22
User is offline View Users Profile Print this message


Ian Barnard

Posts: 91
Joined: 4-Jul-2002

Nitin

GetTaggedValue is along the right lines; you need to then correctly read the value it returns.

If you're using tcl, this routine may do want you want (replace or comment the DebugOutput lines as appropriate):

#
# read a tagvalue from a stname
#
proc gettagvalue { e tagname stname } {
# DebugOutput "tag $tagname st $stname for $e [u2::GetMetaClassName $e]"
set instexpression [u2::GetTaggedValue $e "'$stname' (. '$tagname' .)"]
# DebugOutput "instvalue = $instexpression\n"
if { $instexpression == 0 } {
# DebugOutput "St $stname tag $tagname Not found - returning 0\n"
return 0
}
# DebugOutput "inst type=[u2::GetMetaClassName $instexpression]\n"
if { [u2::IsKindOf $instexpression Ident] } {
set value [u2::GetValue $instexpression Name]
} elseif { [u2::IsKindOf $instexpression ListExpr] } {
# combine the list values with \n
set value ""
foreach e [u2::GetEntities $instexpression Expression] {
append value "[u2::GetValue $e ValueString]\n"
}
} elseif { [u2::IsKindOf $instexpression CharstringValue] } {
# DebugOutput "CharstringValue"
set value [u2::GetValue $instexpression Value]
} else {
set value [u2::GetValue $instexpression ValueString]
}
# DebugOutput " value='$value'\n"
return $value
}

and you should be able to translate this into the equivalent C++ fairly easily.

HTH
Ian


-------------------------
=============
Ian Barnard
Principal Consultant
Telelogic UK, an IBM company
Report this to a Moderator Report this to a Moderator
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.