Questions ad marshalling multi-dimensional arrays
rony
rony at wu.ac.at
Thu Jun 23 04:24:11 PDT 2011
Sorry, while changing the sample in the process of formulating the
questions the remaining sample data were posted wrongly in my last mail! :(
On 23.06.2011 12:13, rony wrote:
> Hi there,
>
> while contemplating the marshalling of multidimensional arrays I could
> not find definitive answers, hence turning to this list, requesting
> some answers (even as short as "yes" and "no"):
>
> * given an array with two dimensions (signature: aas) and the
> following set elements:
>
> arr[0,0]="a"
> arr[0,1]="b"
> arr[0,2]="c"
> arr[1,0]="A" /* no values for: arr[1,1], arr[1,2] */
> arr[2,2]="3" /* no values for: arr[2,0], arr[2,1] */
>
>
Maybe a matrix form depicts the array better, where "-" indicates no
entry/empty:
x/y | 0 1 2
----+----------
0 | a b c
1 | A - -
2 | - - 3
> *
>
> * Questions:
> o Unassigned elements (like arr[1,0], which in some
> languages could be marked explicitly as NULL/.nil) cannot
> be dropped (left-out) ?
>
The above array should read: "... (like arr[1,1] ...".
> + If must be given, then short of an explicit
> NULL/.nil sentinel value one needs to use
> # An empty (0-length) string for string-like
> types (string, object_path, signature) ?
> # The value 0 for all simple types?
>
> o Which would be the marshalling sequence in the above
> example, assuming that unassigned elements are represented
> by empty strings in this case?
> 1. [0,0], [0,1], [0,2], [1,0], [1,1], [1,2], [2,0],
> [2,1], [2,2], hence the element sequence: "a", "b",
> "c", "A", "", "", "", "", "3" ?
> or:
> 2. [0,0], [1,0], [2,0], [1,1], [2,1], [3,1], [1,2],
> [2,2], [2,3] hence the element sequence: "a", "A",
> "", "b", "", "", "c", "", "3" ?
>
The "2." above should read:
2. [0,0], [1,0], [2,0], [0,1], [1,1], [2,1], [0,2], [1,2], [2,2]
hence the element sequence: "a", "A", "", "b", "", "", "c", "", "3" ?
> o Given the above example, would it be o.k. to leave out
> "trailing empty elements of the array"?
> E.g. in case 1. marshalling above, this would yield the
> sequence (arr[1,1] and arr[1,2] are left out; the array's
> dimension can still be defined by
> open_container/close_container):
> 1. [0,0], [0,1], [0,2], [1,0], [1,1], [2,0], [2,1],
> [2,2], hence the element sequence: "a", "b", "c",
> "A", "", "", "3"
>
The above should read:
[0,0], [0,1], [0,2], [1,0], [2,0], [2,1], [2,2], hence the element
sequence: "a", "b", "c", "A", "", "", "3"
> o Is it possible to marshall an empty array by merely using
> a sequence of open_container(DBUS_TYPE_ARRAY) - no-content
> - close_container?
> (Thought that it was prohibited, but have not been able to
> find references for this)?
>
Again, sorry for the confusing data in my initial mail.
What would be the answers?
---rony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20110623/b3fb2597/attachment.html>
More information about the dbus
mailing list