![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Returning arrays Topic Summary: Created On: 5-May-2005 20:27 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hello,
I do not believe it is possible to return arrays in DXL, and I thought I would ask anyway. If it is not possible to return an array, is it possible for an array to be assigned to a skip list, and then return a skip list? I know the last part isn't quite correct. I would probably need a reference or a pointer if DXL has such things as pointers. The code shows the essence of what I would like to do. Code attached below. Mary |
|
![]() |
|
![]() |
|
If you pass a string array into a function, DXL automatically does it by reference. You should also include the array size.
You can also do it with a skip list. See attached code: ------------------------- Bruce Tuskey Sr. Principle Engineer Tuskey@gmail.com "All that is gold does not glitter, not all those who wander are lost:..." - Gandalf the Grey (JRR Tolkien) |
|
![]() |
|
![]() |
|
The DXL manual is a little confusing, so lets make sure we are not talking about the dxl type "Array" (upper case A) which is a dynamically sized 2-dimensional construct that can contain a variety of data types; and that we are talking about an "array" (lower case a), a specifically sized 1-dimensional construct that can apply to most other Types, such as "strings" and "integers". These should be but are not called "vectors". "arrays" are defined by adding [size] to the declaration of the variable such as "string a[20]".
Array as Parameter (your 2nd example). Scalors (non-array variables with a single values) such as "string s" cannot be cleverly converted to an array. If your function has an array as a parameter such as "void GetValue(string a[])", all calls to GetValue need to already have the array declared, such as "string a[20]; GetValue(a)". Calling functions should routinely find out how big the array is with "int aSize = sizeof(a)". Array as return value (your 1st example). Likewise, your variable assignments much match: both the assigner and assignee must both be arrays or neither be an array. See attached. Notice the odd syntax for declaring a function that will return an array (brackets at the end). Notice that array assignment is by-reference, and not by-value, which is different than scaler assignment. I'd avoid functions that return arrays. - Louie |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Returning arrays
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.