Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Basics of DxlObject ?
Topic Summary:
Created On: 30-Jan-2008 17:09
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
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.
 30-Jan-2008 17:09
User is offline View Users Profile Print this message


David Jakad

Posts: 94
Joined: 20-Jul-2007

I've seen a few people rave about using DxlObject. I've searched the forum for more details, but have only found it briefly mentioned in a few places. Can someone explain what it is, how it works, and maybe provide a simple example? How does DxlObject differ from a Skip List? Can you store anything in a DxlObject? Is there anything you can't store in a DxlObject? Do you have to be explicit with data types when storing and retrieving information from them? Can you pass DxlObjects into functions? Can you return DxlObjects from functions?

Thanks in advance.

Edited: 30-Jan-2008 at 17:56 by David Jakad
Report this to a Moderator Report this to a Moderator
 30-Jan-2008 18:25
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

See Tony Goodman's site

http://www.smartdxl.com/undoc.html

And I see no reason why you can't pass/return a DXL Object to/from a function.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com

Edited: 30-Jan-2008 at 18:26 by David Pechacek
Report this to a Moderator Report this to a Moderator
 31-Jan-2008 08:11
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

Just a remark, if you create a Skip List containing DxlObjects (which can be extremely useful), you have to manually delete the DxlObjects before deleting the Skip List, otherwise you will have a momory leak

// Assuming dxlSkip is the SkipList

DxlObject d
for d in dxlSkip do {delete d}
delete dxlSkip


Peter
Report this to a Moderator Report this to a Moderator
 31-Jan-2008 14:57
User is offline View Users Profile Print this message


David Jakad

Posts: 94
Joined: 20-Jul-2007

Peter.... on the topic of memory management.... do you know... will all data, skip lists, dxlObjects, etc., be automatically deleted when the script ends, or when a dialog box is closed?
Report this to a Moderator Report this to a Moderator
 31-Jan-2008 16:18
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

Oh well, I would just not count on it and clean up manually in any case :-)

Peter
Report this to a Moderator Report this to a Moderator
 1-Feb-2008 08:53
User is offline View Users Profile Print this message


Marcel van der Laan

Posts: 15
Joined: 21-Sep-2007

Hi David,

Originally posted by: David Jakad

Peter.... on the topic of memory management.... do you know... will all data, skip lists, dxlObjects, etc., be automatically deleted when the script ends, or when a dialog box is closed?


I'd be happy with either of these solutions... But I think the memory leak will exist (at least?) until the DOORS client ends. So, if you run a script that causes memory leakage, you wil leak more and more memory.

Note that this is my hunch and is not founded on technical knowledge of DOORS memory management.

Marcel
Report this to a Moderator Report this to a Moderator
 1-Feb-2008 17:11
User is offline View Users Profile Print this message


David Jakad

Posts: 94
Joined: 20-Jul-2007

Thanks for all the help. I looked at Tony Goodman's site and have been practicing with the DxlObject. Now my question is, is there any way to generically dump the data from any DxlObject, or must you know the structure of the data within the DxlObject.

For example, if I have something like:

DxlObject o = new()
o->"First Name" = "John"
o->"Last Name" = "Doe"
o->"Home Town" = "Springfield"
o->"Motto" = "Hello World"

..and if I now want to dump out that data, is there any way to simply say, "for every element in the DxlObject, print the key=value pair"? Or, must you hard code it, like:

print (string o->"First Name")
print (string o->"Last Name")
print (string o->"Home Town")
print (string o->"Motto")
Report this to a Moderator Report this to a Moderator
 4-Feb-2008 08:08
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

As far as I know, there is no loop through DxlObject elements available, and as you must cast the variable type when retrieving the value, I doubt it is possible at all. A workaround could be to store all keys of the same type in a skip list and loop through the skip list when retrieving the elements.

Regards,

Peterr
Report this to a Moderator Report this to a Moderator
 4-Feb-2008 09:28
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

To get data from a DXLObject, you must know the string names of the fields. You must also explicitly cast the returned value to a the correct type.

Chances are that you will have a set structure for your DXLObjects and that knowing the structure won't be a problem.

You could write wrapper functions for put() and get() as follows:

Another common technique is to have conditional fields based on the value of a mandatory field.

bool b = (bool o->"Has Middle Name")
if (b) middleName = (string o->"Moiddle Name")
else middleName = ""

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 0 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.