### Home Classes Methods

### In Files

- ext/ffi_c/ffi.c

### Parent

FFI::Type

### Methods

- ::new
- #elem_type
- #length

### Files

- Makefile
- ChangeLog
- LICENSE
- README
- compile
- configure
- depcomp
- stamp-vti
- install-sh
- libtool-version
- mdate-sh
- missing

### Class/Module Index

Quicksearch

- FFI
- FFI::AbstractMemory
- FFI::ArrayType
- FFI::AutoPointer
- FFI::AutoPointer::CallableReleaser
- FFI::AutoPointer::DefaultReleaser
- FFI::AutoPointer::Releaser
- FFI::Buffer
- FFI::ConstGenerator
- FFI::ConstGenerator::Constant
- FFI::DataConverter
- FFI::DynamicLibrary
- FFI::DynamicLibrary::Symbol
- FFI::Enum
- FFI::Enums
- FFI::Function
- FFI::FunctionType
- FFI::Generator
- FFI::Generator::Task
- FFI::IO
- FFI::Library
- FFI::ManagedStruct
- FFI::MemoryPointer
- FFI::NotFoundError
- FFI::NullPointerError
- FFI::Platform
- FFI::PlatformError
- FFI::Pointer
- FFI::StrPtrConverter
- FFI::Struct
- FFI::Struct::InlineArray
- FFI::Struct::ManagedStructConverter
- FFI::StructByReference
- FFI::StructByValue
- FFI::StructGenerator
- FFI::StructGenerator::Field
- FFI::StructLayout
- FFI::StructLayout::Array
- FFI::StructLayout::Enum
- FFI::StructLayout::Field
- FFI::StructLayout::Function
- FFI::StructLayout::InnerStruct
- FFI::StructLayout::Mapped
- FFI::StructLayout::Number
- FFI::StructLayout::Pointer
- FFI::StructLayout::String
- FFI::StructLayoutBuilder
- FFI::TypesGenerator
- FFI::Union
- FFI::VariadicInvoker

No matching classes.

# FFI::ArrayType

This is a typed array. The type is a {NativeType native type}.

### Public Class Methods

initialize(component_type, length) click to toggle source
@param [Type] component_type
@param [Numeric] length
@return [self]
A new instance of ArrayType.

    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;
    }

### Public Instance Methods

element_type click to toggle source
@return [Type]
Get element type.

    static VALUE
    array_type_element_type(VALUE self)
    {
        ArrayType* array;

        Data_Get_Struct(self, ArrayType, array);

        return array->rbComponentType;
    }

length click to toggle source
@return [Numeric]
Get array's length

    static VALUE
    array_type_length(VALUE self)
    {
        ArrayType* array;

        Data_Get_Struct(self, ArrayType, array);

        return UINT2NUM(array->length);
    }

[Validate]

Generated with the Darkfish Rdoc Generator 2.