Package org.jruby.ext.ffi
Class StructLayout.Member
java.lang.Object
org.jruby.ext.ffi.StructLayout.Member
- Enclosing class:
StructLayout
A struct member. This defines the offset within a chunk of memory to use
when reading/writing the member, as well as how to convert between the
native representation of the member and the JRuby representation.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Member
(StructLayout.Field f, int index, int cacheIndex, int referenceIndex) Initializes a new Member instance -
Method Summary
Modifier and TypeMethodDescriptionboolean
final IRubyObject
get
(ThreadContext context, StructLayout.Storage cache, AbstractMemory ptr) Reads a ruby value from the struct member.int
hashCode()
final int
offset()
final void
put
(ThreadContext context, StructLayout.Storage cache, AbstractMemory ptr, IRubyObject value) Writes a ruby value to the native struct member as the appropriate native value.final Type
type()
-
Constructor Details
-
Member
Initializes a new Member instance
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
put
public final void put(ThreadContext context, StructLayout.Storage cache, AbstractMemory ptr, IRubyObject value) Writes a ruby value to the native struct member as the appropriate native value.- Parameters:
context
- the current contextcache
- The value cacheptr
- The struct memory area.value
- The ruby value to write to the native struct member.
-
get
Reads a ruby value from the struct member.- Parameters:
cache
- The cache used to storeptr
- The struct memory area.- Returns:
- A ruby object equivalent to the native member value.
-
offset
public final int offset() -
type
-