Questions ad marshalling multi-dimensional arrays

rony rony at wu.ac.at
Thu Jun 23 03:13:48 PDT 2011


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]           */
                

    * Questions:
          o Unassigned elements (like arr[1,0], which in some languages
            could be marked explicitly as NULL/.nil) cannot be dropped
            (left-out) ?
                + 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" ?

          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"

          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)?

TIA,

---rony

P.S.: Are there perhaps any thoughts about defining an explicit
NULL/.nil value (maybe at least transportable in the context of variants) ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20110623/e68afe77/attachment.htm>


More information about the dbus mailing list