Class: FFI::BitStruct
Overview
Struct that support bit fields. Currently readonly.
Direct Known Subclasses
HTS::LibHTS::BGZF, HTS::LibHTS::BamPileup1, HTS::LibHTS::Bcf1, HTS::LibHTS::BcfFmt, HTS::LibHTS::BcfInfo, HTS::LibHTS::HtsFile, HTS::LibHTS::HtsItr
Class Attribute Summary collapse
-
.bit_fields_hash_table ⇒ Object
readonly
Returns the value of attribute bit_fields_hash_table.
Class Method Summary collapse
Methods inherited from Struct
Class Attribute Details
.bit_fields_hash_table ⇒ Object (readonly)
Returns the value of attribute bit_fields_hash_table.
79 80 81 |
# File 'lib/hts/libhts.rb', line 79 def bit_fields_hash_table @bit_fields_hash_table end |
Class Method Details
.bit_fields(*args) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/hts/libhts.rb', line 107 def bit_fields(*args) unless instance_variable_defined?(:@bit_fields_hash_table) @bit_fields_hash_table = {} prepend BitFieldsModule end parent = args.shift labels = [] widths = [] args.each_slice(2) do |l, w| labels << l widths << w end starts = widths.inject([0]) do |result, w| result << (result.last + w) end labels.zip(starts, widths).each do |l, s, w| @bit_fields_hash_table[l] = [parent, s, w] end end |