Class StructLayout.Member

java.lang.Object
org.jruby.ext.ffi.StructLayout.Member
Enclosing class:
StructLayout

public static final class StructLayout.Member extends Object
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 Details

    • Member

      protected Member(StructLayout.Field f, int index, int cacheIndex, int referenceIndex)
      Initializes a new Member instance
  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • 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 context
      cache - The value cache
      ptr - The struct memory area.
      value - The ruby value to write to the native struct member.
    • get

      public final IRubyObject get(ThreadContext context, StructLayout.Storage cache, AbstractMemory ptr)
      Reads a ruby value from the struct member.
      Parameters:
      cache - The cache used to store
      ptr - The struct memory area.
      Returns:
      A ruby object equivalent to the native member value.
    • offset

      public final int offset()
    • type

      public final Type type()