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: List of attributes given a stereotype
Topic Summary:
Created On: 5-Apr-2006 10:48
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.
Answer This question was answered by Greg Gorman, on Tuesday, April 25, 2006 9:07 AM

Answer:
Nitin,
You have to go back to the stereotype definition, each instance only stores the modified elements for efficiency. I wrote this routine a while back to find them, see if it will help you. Sorry about the formatting, it doesn't look like this BBS has a "code" tag to preserve indenting.

quote:


# This routine prints either the tagged value or the value of EMPTY_CELL_STRING,
# using the fields in the stereotype definition.
#
proc getTaggedValues { pStSought pElem sSTName } {
global EMPTY_CELL_STRING
# Find the names of the tagged values on the stereotype definition
set tvPtrs [u2::GetEntities $pStSought Attribute]
set retStr ""

# Loop over all tagged value names and get their values
foreach tvPtr $tvPtrs {
if {0 == $tvPtr} {
continue
}
set tv [u2::GetValue $tvPtr Name]
set tvStr [u2::GetTaggedValue $pElem "'$sSTName' (. '$tv' .)"]
if {$tvStr != 0} {
if {[u2::IsKindOf $tvStr ListExpr]} {
append retStr " \""
foreach str [u2::GetEntities $tvStr Expression] {
if {0 == $str} {
continue
}
append retStr "[u2::GetValue $str ValueString] "
}
append retStr "\""
} elseif {[u2::IsKindOf $tvStr Ident]} {
append retStr " \"[u2::GetValue $tvStr Name]\""
} elseif {[u2::IsKindOf $tvStr InstanceExpr]} {
append retStr " \"[taggedValuesToString $tvStr]\""
} else {
append retStr " \"[u2::GetValue $tvStr Value]\""
}
} else {
append retStr " \"$EMPTY_CELL_STRING\""
}
}
return $retStr
}

 5-Apr-2006 10:48
User is offline View Users Profile Print this message


Nitin Bharathy

Posts: 4
Joined: 4-Apr-2006

Hi,

Given an instance of a stereotype, I would like to get a list of all the attributes valid for it. I tried Unparse but it returns only those attributes with non zero values. I want to retreive the null attributes as well.

How can I get a list of all attributes for a stereotype?

Thanks and Regards,
Nitin

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


Greg Gorman

Posts: 75
Joined: 4-Oct-2002

Answer Answer
Nitin,
You have to go back to the stereotype definition, each instance only stores the modified elements for efficiency. I wrote this routine a while back to find them, see if it will help you. Sorry about the formatting, it doesn't look like this BBS has a "code" tag to preserve indenting.

quote:


# This routine prints either the tagged value or the value of EMPTY_CELL_STRING,
# using the fields in the stereotype definition.
#
proc getTaggedValues { pStSought pElem sSTName } {
global EMPTY_CELL_STRING
# Find the names of the tagged values on the stereotype definition
set tvPtrs [u2::GetEntities $pStSought Attribute]
set retStr ""

# Loop over all tagged value names and get their values
foreach tvPtr $tvPtrs {
if {0 == $tvPtr} {
continue
}
set tv [u2::GetValue $tvPtr Name]
set tvStr [u2::GetTaggedValue $pElem "'$sSTName' (. '$tv' .)"]
if {$tvStr != 0} {
if {[u2::IsKindOf $tvStr ListExpr]} {
append retStr " \""
foreach str [u2::GetEntities $tvStr Expression] {
if {0 == $str} {
continue
}
append retStr "[u2::GetValue $str ValueString] "
}
append retStr "\""
} elseif {[u2::IsKindOf $tvStr Ident]} {
append retStr " \"[u2::GetValue $tvStr Name]\""
} elseif {[u2::IsKindOf $tvStr InstanceExpr]} {
append retStr " \"[taggedValuesToString $tvStr]\""
} else {
append retStr " \"[u2::GetValue $tvStr Value]\""
}
} else {
append retStr " \"$EMPTY_CELL_STRING\""
}
}
return $retStr
}



-------------------------
Greg Gorman
Vice President, Product Management
Modeling and Test Products
Telelogic AB

Edited: 29-Apr-2006 at 19:12 by Greg Gorman
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.