Class: FFI::Struct

Inherits:
Object
  • Object
show all
Defined in:
lib/hts/ffi_ext/struct.rb

Class Method Summary collapse

Class Method Details

.struct_layout(*args) ⇒ Object

Examples:

HtsFormat

class HtsFormat < FFI::Struct
  layout \
    :category,          HtsFormatCategory,
    :format,            HtsExactFormat,
    :version,
    struct_layout(
      :major,           :short,
      :minor,           :short
    ),
    :compression,       HtsCompression,
    :compression_level, :short,
    :specific,          :pointer
end


40
41
42
# File 'lib/hts/ffi_ext/struct.rb', line 40

def struct_layout(*args)
  Class.new(FFI::Struct) { layout(*args) }
end

.union_layout(*args) ⇒ Object

Examples:

HtsOpt

class HtsOpt < FFI::Struct
  layout \
    :arg,            :string,
    :opt,            HtsFmtOption,
    :val,
    union_layout(
      :i,            :int,
      :s,            :string
    ),
    :next,           HtsOpt.ptr
end


21
22
23
# File 'lib/hts/ffi_ext/struct.rb', line 21

def union_layout(*args)
  Class.new(FFI::Union) { layout(*args) }
end