Questions ad marshalling multi-dimensional arrays

rony rony at wu.ac.at
Thu Jun 23 06:52:41 PDT 2011


Simon,

again, many thanks for your explanations!

---rony


On 23.06.2011 14:54, Simon McVittie wrote:
> On Thu, 23 Jun 2011 at 14:33:37 +0200, rony wrote:
>   
>> On 23.06.2011 13:59, Simon McVittie wrote:
>>     
>>> You can choose whether to use "row-major" or "column-major" ordering.
>>> Whichever you do, document it as part of your API specification, preferably
>>> with an example.
>>>   
>>>       
>> Hmm, so there is no pre-determined ordering, independent of language or
>> programming style when using multidimensional arrays?
>>     
> As I said, there are no multi-dimensional arrays on D-Bus. If your language
> has multi-dimensional arrays, it's up to you to turn them into arrays-of-arrays
> or "stride-based" arrays.
>
>   
>> Was wondering in what sequences I should expect something like "aai" or
>> "aaa(su{so})" got marshalled, such that unmarshalling would create an
>> array with the same ordering as the sender.
>>     
> Any D-Bus type has a well-defined ordering in the D-Bus wire protocol
> (depth-first: if you have an array of arrays, the first inner array is
> completely marshalled before you start on the second inner array).
>
> However, multi-dimensional arrays are not a D-Bus type; D-Bus only has
> (single-dimensional) arrays, aX for any type X. Because the type system is
> recursive, X can itself be an array type, so you can have an array of
> (arrays of ...) arrays, with a signature like aai.
>
> aai unmarshals into an array of array of integer, which isn't the same thing
> as a 2D array of integers. (Think "list of lists" in Python or Perl,
> or List<List<Int>> in Java or C#, or whatever.) I would not recommend trying
> to convert an array-of-arrays into a multi-dimensional array automatically
> during unmarshalling, because an array-of-arrays isn't necessarily
> rectangular/cuboid/hypercuboid/whatever higher dimension you're in.
>
>     S
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
>
>   


More information about the dbus mailing list