Class: FFI::StructLayout::Mapped

Inherits:
Field
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/struct_layout.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, offset, type, orig_field) ⇒ Mapped

Returns a new instance of Mapped.



82
83
84
85
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/struct_layout.rb', line 82

def initialize(name, offset, type, orig_field)
  super(name, offset, type)
  @orig_field = orig_field
end

Instance Method Details

#get(ptr) ⇒ Object



87
88
89
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/struct_layout.rb', line 87

def get(ptr)
  type.from_native(@orig_field.get(ptr), nil)
end

#put(ptr, value) ⇒ Object



91
92
93
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/struct_layout.rb', line 91

def put(ptr, value)
  @orig_field.put(ptr, type.to_native(value, nil))
end