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: Is there any way to use a buffer to get a string from a skip list?
Topic Summary: find() command
Created On: 28-Feb-2007 21:22
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.
Answer This question was answered by Reik Schroeder, on Thursday, March 1, 2007 4:29 PM

Answer:
Hi David,

AFAIK it is not possible get a string result of find directly into the buffer.

I think it makes no sense to get a string stored in Skip list back into a buffer?!
When the string is stored in the Skip list it is already placed into string table, so it would not use any more memory to get it back as string in find command.

So the only way to get the string in the buffer is to use a temporary string:


Buffer b;
mySkipList = createString();
put(mySkipList, "a", "a");

string szTemp = "";
find(mySkipList, "a", szTemp);
b = szTemp;


Greetings
Reik
 28-Feb-2007 21:22
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

I would like to know if there is any way to pass a buffer to the find command of a skip list in order to get the string value of the passed key.  Basically:

Buffer b
mySkipList = createString
put(mySkipList, "a", "a")
find(mySkipList, "a", b)

That doesn't work.  Is there a way to write it so it does?

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

Edited: 28-Feb-2007 at 21:23 by David Pechacek
Report this to a Moderator Report this to a Moderator
 1-Mar-2007 09:48
User is offline View Users Profile Print this message


Thomas Langholz

Posts: 40
Joined: 20-Oct-2005

Hi David, try to use stringof(b) instead of b to use the string representation of you buffer greetings thomas
Report this to a Moderator Report this to a Moderator
 1-Mar-2007 12:52
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Answer Answer
Hi David,

AFAIK it is not possible get a string result of find directly into the buffer.

I think it makes no sense to get a string stored in Skip list back into a buffer?!
When the string is stored in the Skip list it is already placed into string table, so it would not use any more memory to get it back as string in find command.

So the only way to get the string in the buffer is to use a temporary string:


Buffer b;
mySkipList = createString();
put(mySkipList, "a", "a");

string szTemp = "";
find(mySkipList, "a", szTemp);
b = szTemp;


Greetings
Reik

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 1-Mar-2007 16:28
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Doesn't each variable in a DXL program have its own string table or is there just one master table and all strings are stored in it?  I thought it was the former.  If the latter is the case then no using a string isn't a problem for me.  I was just trying to save some memory by using a buffer that I could delete.

Another thought is that do string variables in a skip list get stored in the master string table (if it exists globally) or are they stored in the skip lists memory alone? 

Hopefully when I go to Telelogics DOORS training classes I'll be attending, they'll explain 100% all the background stuff of DXL.  Of course hopefully by then I'll already know almost everything I need to from my own coding and all of you people's help.  I plan to have a nice question list for them though.

And just so you know Tom, the stringOf command is used only to get the value of a buffer as a string, not set it.



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

Edited: 1-Mar-2007 at 16:31 by David Pechacek
Report this to a Moderator Report this to a Moderator
 1-Mar-2007 16:39
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi David,

as a Telelogic Consultant told me in DXL-Workshop, that there is only one master string table and each string is stored there one time so if you use the same string again, it will not use more memory.


string a = "Hello";
string b = "Hello"; // will take the same reference to string table as a


In Skip lists there are stored usually only integer values, but they will be converted to the desired type on acces to Skip list. So a string ist stored by it's address in master string table. Thats why it is really dangerous to store an int and try to retrieve a string --> the interpreter takes the int as pointer to a string and causes an access violation exception.

The other way round it is always possible: to retrieve the value in Skip as int. So you will be able to cast it later with the addr_ function to the desired type. So you could store different types of variables in a Skip list and do a for int in Skip loop to get the entries.

I hope that helps you a little bit to understand strings and Skip lists

Greetings
Reik

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 1-Mar-2007 17:27
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Good to know.  Much appreciated.



-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 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 2 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.