This is a typed array. The type is a {NativeType native type}.
static VALUE array_type_initialize(VALUE self, VALUE rbComponentType, VALUE rbLength) { ArrayType* array; int i; Data_Get_Struct(self, ArrayType, array); array->length = NUM2UINT(rbLength); array->rbComponentType = rbComponentType; Data_Get_Struct(rbComponentType, Type, array->componentType); array->ffiTypes = xcalloc(array->length + 1, sizeof(*array->ffiTypes)); array->base.ffiType->elements = array->ffiTypes; array->base.ffiType->size = array->componentType->ffiType->size * array->length; array->base.ffiType->alignment = array->componentType->ffiType->alignment; for (i = 0; i < array->length; ++i) { array->ffiTypes[i] = array->componentType->ffiType; } return self; }
static VALUE array_type_element_type(VALUE self) { ArrayType* array; Data_Get_Struct(self, ArrayType, array); return array->rbComponentType; }
static VALUE array_type_length(VALUE self) { ArrayType* array; Data_Get_Struct(self, ArrayType, array); return UINT2NUM(array->length); }