![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Creating new arrays and storing into skip Topic Summary: Created On: 1-Oct-2008 20:50 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|||
Hi all
I am pretty new in dxl and need your help. My problem is that I`d like to create a Skip containing 2 Strings, 1 Integer and 1 array. Actually the array is the problem. I`ve created a method that shall put all the string the integer and the array into the list. The problem is that the array I put into the skip each time I run my method contains the same values. It seems that the array is always the same and just a reference is put into the skip. I need to create a new array (new reference) and put it in. Could it be possible that the same variable name, like that of my array (attributesArray) always references the same memory register? Can someone give me a helping hand. Thank you in advance. Best regards. Olimpia
Edited: 1-Oct-2008 at 20:52 by Olimipia Pospiech |
|||
![]() |
|||
![]() |
|||
I believe you need to change definition of skip list to create instead of createString.
|
|||
![]() |
|||
![]() |
|||
I don't see how that would change what's happening with his array ron.
DXL is likely overwriting the previous array by putting it at the same memory address. I would suggest using another Skip list or a DXL Array. If you use a skip list, use create() to create it not createString. Then use an integer key so the elements will be kept in order. Just be sure to delete all of these skip lists or arrays when your program is done. ------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com |
|||
![]() |
|||
![]() |
|||
Hi Boys
Thanks you for the very fast answer. I didn`t expect it that fast. ![]() Best regards, Olimpia Edited: 1-Oct-2008 at 21:23 by Olimipia Pospiech |
|||
![]() |
|||
![]() |
|||
I would do this using an array type.
The following example is not working code, just an example of how it might work. You have a row in the array for each profile. The index to the row would be the same as the integer key in your skip list. Entries in the row are accessed using indices. An attribute count allows you to count through the atribute values. The advantage of this method is that you only need one data structure and that the array expands automatically, so you don't need to worry about creating stuff before inserting into the skip. ------------------------- Tony Goodman Smart DXL limited www.smartdxl.com |
|||
![]() |
|||
![]() |
|||
Tony the only reason I'm not a big fan of Arrays in DXL is that I've had issues with them that made no sense. I would put a string into an array and then get an error that crashed DOORS when I tried to take it out (yes into a string variable). Ever since my initial bad taste I've been wary about using them.
------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com |
|||
![]() |
|||
![]() |
|||
David,
In my experience, that error is nearly always down to the string not being defined on the same line as the get statement. ie String str = get(array, i, j) is fine String str str = get(array, i, j) is not as the DXL interpreter struggles to work out which variation of get to use (string get(), int get(), real get() etc...) String str str = (string get(array, i j)) is fine Paul |
|||
![]() |
|||
![]() |
|||
Yes, I always explicitly cast the value, just to be sure to be sure.
In fact, for a program with lots of array gets, I would use wrapper functions for example: string getArrayValue(array arr, int x, int y) { return(string get(arr, x, y)) } int getArrayValue(array arr, int x, int y) { return(int get(arr, x, y)) } ------------------------- Tony Goodman Smart DXL limited www.smartdxl.com |
|||
![]() |
Telelogic DOORS
» DXL Exchange
»
Creating new arrays and storing into skip
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.