If even the macro interface is not fast enough for you, you can access the internal data structure for all the basic types except string. You cannot access the internal data structure for arrays of strings, interfaces and objects.
The basic form of the C data structure for type XXXX is:
struct sidl__array_vtable {
/* Release resources associted with the array (refcount at zero) */
void (*d_destroy)(struct sidl__array *);
/* Clone or addRef depending on whether data is borrowed */
struct sidl__array *(*d_smartcopy)(struct sidl__array *);
/* Return the type of the array. */
int32_t (*d_arraytype)(void);
};
struct sidl__array {
int32_t *d_lower;
int32_t *d_upper;
int32_t *d_stride;
const struct sidl__array_vtable *d_vtable;
int32_t d_dimen;
int32_t d_refcount;
};
struct sidl_XXXX__array {
struct sidl__array d_metadata;
<value type for XXXX> *d_firstElement;
};
The string ``
value type for XXXX
'' should be replaced by something like
sidl_boolfor an array of bool,
int32_t for any array of int,
double for an array of double,
int64_t for an array of long, etc. (See Table 5.2)
Clients should not modify d_lower, d_upper, d_stride, d_dimen, d_borrowed or (in the case of pointers) the values to which they point.
The data structure was inspired by the data structure used by Numeric Python; although, in Numeric Python, the stride is in terms of bytes. In SIDL, the stride is in terms of number of objects. One can convert to the Numeric Python view of things by multiplying the stride by the sizeof the value type.