![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
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 |
![]() |
![]()
|
![]() 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 | |
![]() |
|
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 |
|
![]() |
|
![]() |
|
Hi David,
try to use stringof(b) instead of b to use the string representation of you buffer
greetings
thomas
|
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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. 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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
Good to know. Much appreciated. ------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.