Class: FFI::StructLayout::Enum

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

Overview

An enum Field in a FFI::StructLayout.

Instance Method Summary collapse

Instance Method Details

#get(ptr) ⇒ Object

Get an object of type #type from memory pointed by ptr.

Parameters:

Returns:



56
57
58
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/struct_layout.rb', line 56

def get(ptr)
  type.find(ptr.get_int(offset))
end

#put(ptr, value) ⇒ nil

Set value into memory pointed by ptr.

Parameters:

Returns:

  • (nil)


64
65
66
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/struct_layout.rb', line 64

def put(ptr, value)
  ptr.put_int(offset, type.find(value))
end