Class: FFI::StructLayout::Mapped

Inherits:
Field
  • Object
show all
Defined in:
lib/ffi/struct.rb

Instance Method Summary (collapse)

Methods inherited from Field

#alignment, #name, #offset, #size, #type

Constructor Details

- (Mapped) initialize(name, offset, type, orig_field)

A new instance of Mapped



62
63
64
65
# File 'lib/ffi/struct.rb', line 62

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

Instance Method Details

- (Object) get(ptr)



67
68
69
# File 'lib/ffi/struct.rb', line 67

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

- (Object) put(ptr, value)



71
72
73
# File 'lib/ffi/struct.rb', line 71

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