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)

Returns a new instance of Mapped



85
86
87
88
# File 'lib/ffi/struct.rb', line 85

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

Instance Method Details

- (Object) get(ptr)



90
91
92
# File 'lib/ffi/struct.rb', line 90

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

- (Object) put(ptr, value)



94
95
96
# File 'lib/ffi/struct.rb', line 94

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