For all the SIDL basic types except string, there is a C macro API for those who fear the function overhead of the C function API. When efficiency is not a concern, I recommend using the function API, but the C macro API is preferable to the direct access to the data structure. The macro API is not available for arrays of strings, interfaces or objects because the issues associated with memory and object reference management.
The macro API is very similar to the function API; however, a single set of macros applies to all the supported array types. The macro names are independent of the type of array you're accessing.
sidlArrayDim(array)Return the dimension of array.
sidlLower(array,ind)Return the lower bound on dimension ind.
sidlUpper(array,ind)Return the upper bound on dimension ind.
sidlStride(array,ind)Return the stride for dimension ind. The stride is the offset between elements in a particular dimension. It can be positive or negative. It is in terms of number of value types (i.e., it's 1 means contiguous regardless of what data type).
sidlArrayElem1(array, ind1) sidlArrayElem2(array, ind1, ind2) sidlArrayElem3(array, ind1, ind2, ind3) sidlArrayElem4(array, ind1, ind2, ind3, ind4) sidlArrayElem5(array, ind1, ind2, ind3, ind4, ind5) sidlArrayElem6(array, ind1, ind2, ind3, ind4, ind5, ind6) sidlArrayElem7(array, ind1, ind2, ind3, ind4, ind5, ind6, ind7)Provide access to array elements to arrays of dimension 1-7. This macro can appear on the left hand side of an assignment or on the right hand side in an expression. These macros blindly assume that the dimension and indices are correct.
sidlArrayAddr1(array, ind1) sidlArrayAddr2(array, ind1, ind2) sidlArrayAddr3(array, ind1, ind2, ind3) sidlArrayAddr4(array, ind1, ind2, ind3, ind4) sidlArrayAddr5(array, ind1, ind2, ind3, ind4, ind5) sidlArrayAddr6(array, ind1, ind2, ind3, ind4, ind5, ind6) sidlArrayAddr7(array, ind1, ind2, ind3, ind4, ind5, ind6, ind7)Return the address of elements in arrays of dimension 1-7. This macro can appear on the left hand side of an assignment or on the right hand side in an expression. These macros blindly assume that the dimension and indices are correct.