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.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final intThe index of this member within the struct field cache(package private) final StructLayout.Field(package private) final intThe index of this member within the struct(package private) final StructLayout.FieldIO(package private) final IRubyObject(package private) final intThe offset within the memory area of this member(package private) final intThe index of this member within the struct field reference array(package private) final TypeTheTypeof this member. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMember(StructLayout.Field f, int index, int cacheIndex, int referenceIndex) Initializes a new Member instance -
Method Summary
Modifier and TypeMethodDescriptionbooleanfinal IRubyObjectget(ThreadContext context, StructLayout.Storage cache, AbstractMemory ptr) Reads a ruby value from the struct member.(package private) final intgetIndex()(package private) final longgetOffset(IRubyObject ptr) inthashCode()final intoffset()final voidput(ThreadContext context, StructLayout.Storage cache, AbstractMemory ptr, IRubyObject value) Writes a ruby value to the native struct member as the appropriate native value.final Typetype()
-
Field Details
-
io
-
field
-
type
TheTypeof this member. -
offset
final int offsetThe offset within the memory area of this member -
cacheIndex
final int cacheIndexThe index of this member within the struct field cache -
referenceIndex
final int referenceIndexThe index of this member within the struct field reference array -
index
final int indexThe index of this member within the struct -
name
-
-
Constructor Details
-
Member
Initializes a new Member instance
-
-
Method Details
-
getOffset
-
getIndex
final int getIndex() -
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
-