Class AbstractMemory

All Implemented Interfaces:
Serializable, Cloneable, Comparable<IRubyObject>, InstanceVariables, InternalVariables, IRubyObject, CoreObjectType
Direct Known Subclasses:
Buffer, Pointer

public abstract class AbstractMemory extends MemoryObject
A abstract memory object that defines operations common to both pointers and memory buffers
See Also:
  • Field Details

    • ABSTRACT_MEMORY_RUBY_CLASS

      public static final String ABSTRACT_MEMORY_RUBY_CLASS
      See Also:
    • size

      protected long size
      The total size of the memory area
    • typeSize

      protected int typeSize
      The size of each element of this memory area - e.g. :char is 1, :int is 4
  • Constructor Details

    • AbstractMemory

      protected AbstractMemory(Ruby runtime, RubyClass klass, MemoryIO io, long size)
    • AbstractMemory

      protected AbstractMemory(Ruby runtime, RubyClass klass, MemoryIO io, long size, int typeSize)
  • Method Details

    • createAbstractMemoryClass

      public static RubyClass createAbstractMemoryClass(ThreadContext context, RubyModule FFI, RubyClass Object)
    • calculateTypeSize

      protected static final int calculateTypeSize(ThreadContext context, IRubyObject sizeArg)
    • checkArray

      protected static final RubyArray checkArray(IRubyObject obj)
    • allocateMemoryIO

      protected MemoryIO allocateMemoryIO()
      Specified by:
      allocateMemoryIO in class MemoryObject
    • getOffset

      protected final long getOffset(IRubyObject offset)
      Calculates the absolute offset within the base memory pointer for a given offset.
      Parameters:
      offset - The offset to add to the base offset.
      Returns:
      The total offset from the base memory pointer.
    • getSize

      public final long getSize()
      Gets the size of the memory area.
      Returns:
      The size of the memory area.
    • hash

      public RubyFixnum hash(ThreadContext context)
      Calculates a hash code for the pointer.
      Overrides:
      hash in class RubyBasicObject
      Parameters:
      context - the current thread context
      Returns:
      A RubyFixnum containing the hash code.
    • aref

      public final IRubyObject aref(ThreadContext context, IRubyObject indexArg)
    • equals

      public boolean equals(Object obj)
      Compares this MemoryPointer to another MemoryPointer.
      Overrides:
      equals in class RubyObject
      Parameters:
      obj - The other MemoryPointer to compare to.
      Returns:
      true if the memory address of obj is equal to the address of this MemoryPointer.
      See Also:
    • op_equal

      public IRubyObject op_equal(ThreadContext context, IRubyObject obj)
      Description copied from class: RubyBasicObject
      rb_obj_equal Will by default use identity equality to compare objects. This follows the Ruby semantics. The name of this method doesn't follow the convention because hierarchy problems
      Specified by:
      op_equal in interface IRubyObject
      Overrides:
      op_equal in class RubyBasicObject
    • hashCode

      public int hashCode()
      Calculates the hash code for this MemoryPointer
      Overrides:
      hashCode in class RubyObject
      Returns:
      The hashcode of the memory address.
      See Also:
    • clear

      public IRubyObject clear(ThreadContext context)
      Clears (zeros out) the memory contents.
      Parameters:
      context - the thread context
      Returns:
      this
    • total

      public IRubyObject total(ThreadContext context)
      Gets the total size (in bytes) of the Memory.
      Parameters:
      context - the thread context
      Returns:
      The total size in bytes.
    • type_size

      public final IRubyObject type_size(ThreadContext context)
      Indicates how many bytes the intrinsic type of the memory uses.
      Parameters:
      context - the thread context
      Returns:
      the type size
    • write_char

      public IRubyObject write_char(ThreadContext context, IRubyObject value)
      Writes a 8 bit signed integer value to the memory area.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_int8

      public IRubyObject put_int8(ThreadContext context, IRubyObject value)
      Writes a 8 bit signed integer value to the memory area.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_int8

      public IRubyObject put_int8(ThreadContext context, IRubyObject offset, IRubyObject value)
      Writes a 8 bit signed integer value to the memory area.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to write the value.
      value - The value to write.
      Returns:
      The value written.
    • read_char

      public IRubyObject read_char(ThreadContext context)
      Reads an 8 bit signed integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_int8

      public IRubyObject get_int8(ThreadContext context)
      Reads an 8 bit signed integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_int8

      public IRubyObject get_int8(ThreadContext context, IRubyObject offset)
      Reads an 8 bit signed integer value from the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to read the value.
      Returns:
      The value read from the address.
    • write_uchar

      public IRubyObject write_uchar(ThreadContext context, IRubyObject value)
      Writes a 8 bit unsigned integer value to the memory area.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_uint8

      public IRubyObject put_uint8(ThreadContext context, IRubyObject value)
      Writes a 8 bit unsigned integer value to the memory area.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_uint8

      public IRubyObject put_uint8(ThreadContext context, IRubyObject offset, IRubyObject value)
      Writes a 8 bit unsigned integer value to the memory area.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to write the value.
      value - The value to write.
      Returns:
      The value written.
    • read_uchar

      public IRubyObject read_uchar(ThreadContext context)
      Reads an 8 bit unsigned integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_uint8

      public IRubyObject get_uint8(ThreadContext context)
      Reads an 8 bit unsigned integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_uint8

      public IRubyObject get_uint8(ThreadContext context, IRubyObject offset)
      Reads an 8 bit unsigned integer value from the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to read the value.
      Returns:
      The value read from the address.
    • write_short

      public IRubyObject write_short(ThreadContext context, IRubyObject value)
      Writes a 16 bit signed integer value to the memory address.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_int16

      public IRubyObject put_int16(ThreadContext context, IRubyObject value)
      Writes a 16 bit signed integer value to the memory address.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_int16

      public IRubyObject put_int16(ThreadContext context, IRubyObject offset, IRubyObject value)
      Writes a 16 bit signed integer value to the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to write the value.
      value - The value to write.
      Returns:
      The value written.
    • read_short

      public IRubyObject read_short(ThreadContext context)
      Reads a 16 bit signed integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_int16

      public IRubyObject get_int16(ThreadContext context)
      Reads a 16 bit signed integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_int16

      public IRubyObject get_int16(ThreadContext context, IRubyObject offset)
      Reads a 16 bit signed integer value from the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to read the value.
      Returns:
      The value read from the address.
    • write_ushort

      public IRubyObject write_ushort(ThreadContext context, IRubyObject value)
      Writes a 16 bit unsigned integer value to the memory address.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_uint16

      public IRubyObject put_uint16(ThreadContext context, IRubyObject value)
      Writes a 16 bit unsigned integer value to the memory address.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_uint16

      public IRubyObject put_uint16(ThreadContext context, IRubyObject offset, IRubyObject value)
      Writes a 16 bit unsigned integer value to the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to write the value.
      value - The value to write.
      Returns:
      The value written.
    • read_ushort

      public IRubyObject read_ushort(ThreadContext context)
      Reads a 16 bit unsigned integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_uint16

      public IRubyObject get_uint16(ThreadContext context)
      Reads a 16 bit unsigned integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_uint16

      public IRubyObject get_uint16(ThreadContext context, IRubyObject offset)
      Reads a 16 bit unsigned integer value from the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to read the value.
      Returns:
      The value read from the address.
    • write_int

      public IRubyObject write_int(ThreadContext context, IRubyObject value)
      Writes a 32 bit signed integer value to the memory address.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_int32

      public IRubyObject put_int32(ThreadContext context, IRubyObject value)
      Writes a 32 bit signed integer value to the memory address.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_int32

      public IRubyObject put_int32(ThreadContext context, IRubyObject offset, IRubyObject value)
      Writes a 32 bit signed integer value to the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to write the value.
      value - The value to write.
      Returns:
      The value written.
    • read_int

      public IRubyObject read_int(ThreadContext context)
      Reads a 32 bit signed integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_int32

      public IRubyObject get_int32(ThreadContext context)
      Reads a 32 bit signed integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_int32

      public IRubyObject get_int32(ThreadContext context, IRubyObject offset)
      Reads a 32 bit signed integer value from the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to read the value.
      Returns:
      The value read from the address.
    • write_uint

      public IRubyObject write_uint(ThreadContext context, IRubyObject value)
      Writes an 32 bit unsigned integer value to the memory address.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_uint32

      public IRubyObject put_uint32(ThreadContext context, IRubyObject value)
      Writes an 32 bit unsigned integer value to the memory address.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_uint32

      public IRubyObject put_uint32(ThreadContext context, IRubyObject offset, IRubyObject value)
      Writes an 32 bit unsigned integer value to the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to write the value.
      value - The value to write.
      Returns:
      The value written.
    • read_uint8

      public IRubyObject read_uint8(ThreadContext context)
      Reads a 8 bit unsigned integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • read_uint16

      public IRubyObject read_uint16(ThreadContext context)
      Reads a 16 bit unsigned integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • read_uint

      public IRubyObject read_uint(ThreadContext context)
      Reads a 32 bit unsigned integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_uint32

      public IRubyObject get_uint32(ThreadContext context)
      Reads a 32 bit unsigned integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_uint32

      public IRubyObject get_uint32(ThreadContext context, IRubyObject offset)
      Reads a 32 bit unsigned integer value from the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to read the value.
      Returns:
      The value read from the address.
    • write_long_long

      public IRubyObject write_long_long(ThreadContext context, IRubyObject value)
      Writes a 64 bit integer value to the memory area.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_int64

      public IRubyObject put_int64(ThreadContext context, IRubyObject value)
      Writes a 64 bit integer value to the memory area.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_int64

      public IRubyObject put_int64(ThreadContext context, IRubyObject offset, IRubyObject value)
      Writes a 64 bit integer value to the memory area.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to write the value.
      value - The value to write.
      Returns:
      The value written.
    • read_long_long

      public IRubyObject read_long_long(ThreadContext context)
      Reads a 64 bit integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_int64

      public IRubyObject get_int64(ThreadContext context)
      Reads a 64 bit integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_int64

      public IRubyObject get_int64(ThreadContext context, IRubyObject offset)
      Reads a 64 bit integer value from the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to read the value.
      Returns:
      The value read from the address.
    • write_ulong_long

      public IRubyObject write_ulong_long(ThreadContext context, IRubyObject value)
      Writes a 64 bit unsigned integer value to the memory area.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_uint64

      public IRubyObject put_uint64(ThreadContext context, IRubyObject value)
      Writes a 64 bit unsigned integer value to the memory area.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_uint64

      public IRubyObject put_uint64(ThreadContext context, IRubyObject offset, IRubyObject value)
      Writes a 64 bit unsigned integer value to the memory area.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to write the value.
      value - The value to write.
      Returns:
      The value written.
    • read_ulong_long

      public IRubyObject read_ulong_long(ThreadContext context)
      Reads a 64 bit unsigned integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_uint64

      public IRubyObject get_uint64(ThreadContext context)
      Reads a 64 bit unsigned integer value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_uint64

      public IRubyObject get_uint64(ThreadContext context, IRubyObject offset)
      Reads a 64 bit unsigned integer value from the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to read the value.
      Returns:
      The value read from the address.
    • write_long

      public IRubyObject write_long(ThreadContext context, IRubyObject value)
      Writes a C long integer value to the memory area. This version is added to support the "write_long" alias for the single-arg "put_long".
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_long

      public IRubyObject put_long(ThreadContext context, IRubyObject value)
      Writes a C long integer value to the memory area.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_long

      public IRubyObject put_long(ThreadContext context, IRubyObject offset, IRubyObject value)
      Writes a C long integer value to the memory area.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to write the value.
      value - The value to write.
      Returns:
      The value written.
    • read_long

      public IRubyObject read_long(ThreadContext context)
      Reads a C long integer value from the memory area.
      Parameters:
      context - the thread context
      Returns:
      The value read.
    • get_long

      public IRubyObject get_long(ThreadContext context)
      Reads a C long integer value from the memory area.
      Parameters:
      context - the thread context
      Returns:
      The value read.
    • get_long

      public IRubyObject get_long(ThreadContext context, IRubyObject offset)
      Reads a C long integer value from the memory area.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to read the value.
      Returns:
      The value read.
    • put_ulong

      public IRubyObject put_ulong(ThreadContext context, IRubyObject value)
      Writes a C long integer value to the memory area.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_ulong

      public IRubyObject put_ulong(ThreadContext context, IRubyObject offset, IRubyObject value)
      Writes a C long integer value to the memory area.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to write the value.
      value - The value to write.
      Returns:
      The value written.
    • read_ulong

      public IRubyObject read_ulong(ThreadContext context)
      Reads a C unsigned long integer value from the memory area.
      Parameters:
      context - the thread context
      Returns:
      The value read.
    • get_ulong

      public IRubyObject get_ulong(ThreadContext context)
      Reads a C unsigned long integer value from the memory area.
      Parameters:
      context - the thread context
      Returns:
      The value read.
    • get_ulong

      public IRubyObject get_ulong(ThreadContext context, IRubyObject offset)
      Reads a C unsigned long integer value from the memory area.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to read the value.
      Returns:
      The value read.
    • write_float

      public IRubyObject write_float(ThreadContext context, IRubyObject value)
      Writes an 32 bit floating point value to the memory area.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_float32

      public IRubyObject put_float32(ThreadContext context, IRubyObject value)
      Writes an 32 bit floating point value to the memory area.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_float32

      public IRubyObject put_float32(ThreadContext context, IRubyObject offset, IRubyObject value)
      Writes an 32 bit floating point value to the memory area.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to write the value.
      value - The value to write.
      Returns:
      The value written.
    • read_float

      public IRubyObject read_float(ThreadContext context)
      Reads a 32 bit floating point value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_float32

      public IRubyObject get_float32(ThreadContext context)
      Reads a 32 bit floating point value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_float32

      public IRubyObject get_float32(ThreadContext context, IRubyObject offset)
      Reads a 32 bit floating point value from the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to read the value.
      Returns:
      The value read from the address.
    • write_double

      public IRubyObject write_double(ThreadContext context, IRubyObject value)
      Writes an 64 bit floating point value to the memory area.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_float64

      public IRubyObject put_float64(ThreadContext context, IRubyObject value)
      Writes an 64 bit floating point value to the memory area.
      Parameters:
      context - the thread context
      value - The value to write.
      Returns:
      The value written.
    • put_float64

      public IRubyObject put_float64(ThreadContext context, IRubyObject offset, IRubyObject value)
      Writes an 64 bit floating point value to the memory area.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to write the value.
      value - The value to write.
      Returns:
      The value written.
    • read_double

      public IRubyObject read_double(ThreadContext context)
      Reads a 64 bit floating point value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_float64

      public IRubyObject get_float64(ThreadContext context)
      Reads a 64 bit floating point value from the memory address.
      Parameters:
      context - the thread context
      Returns:
      The value read from the address.
    • get_float64

      public IRubyObject get_float64(ThreadContext context, IRubyObject offset)
      Reads a 64 bit floating point value from the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the base pointer address to read the value.
      Returns:
      The value read from the address.
    • get_array_of_int8

      public IRubyObject get_array_of_int8(ThreadContext context, IRubyObject offset, IRubyObject length)
      Reads an array of signed 8 bit integer values from the memory address.
      Parameters:
      context - the thread context
      offset - The offset from the start of the memory area to read the values.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • put_array_of_int8

      public IRubyObject put_array_of_int8(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
      Writes an array of signed 8 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to write the values.
      arrParam - Array of values to write to memory.
      Returns:
      this object.
    • get_array_of_uint8

      public IRubyObject get_array_of_uint8(ThreadContext context, IRubyObject offset, IRubyObject length)
      Reads an array of unsigned 8 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to read the values.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • put_array_of_uint8

      public IRubyObject put_array_of_uint8(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
      Writes an array of unsigned 8 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to write the values.
      arrParam - Array of values to write to memory.
      Returns:
      this object.
    • get_array_of_int16

      public IRubyObject get_array_of_int16(ThreadContext context, IRubyObject offset, IRubyObject length)
      Reads an array of signed 16 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to read the values.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • put_array_of_int16

      public IRubyObject put_array_of_int16(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
      Writes an array of signed 16 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to write the values.
      arrParam - Array of values to write to memory.
      Returns:
      this object.
    • get_array_of_uint16

      public IRubyObject get_array_of_uint16(ThreadContext context, IRubyObject offset, IRubyObject length)
      Reads an array of unsigned 16 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to read the values.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • put_array_of_uint16

      public IRubyObject put_array_of_uint16(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
      Writes an array of unsigned 16 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to write the values.
      arrParam - Array of values to write to memory.
      Returns:
      this object.
    • get_array_of_int32

      public IRubyObject get_array_of_int32(ThreadContext context, IRubyObject offset, IRubyObject length)
      Reads an array of signed 32 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to read the values.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • put_array_of_int32

      public IRubyObject put_array_of_int32(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
      Writes an array of signed 32 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to write the values.
      arrParam - Array of values to write to memory.
      Returns:
      this object.
    • get_array_of_uint32

      public IRubyObject get_array_of_uint32(ThreadContext context, IRubyObject offset, IRubyObject length)
      Reads an array of unsigned 32 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to read the values.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • put_array_of_uint32

      public IRubyObject put_array_of_uint32(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
      Writes an array of unsigned 32 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to write the values.
      arrParam - Array of values to write to memory.
      Returns:
      this object.
    • get_array_of_long

      public IRubyObject get_array_of_long(ThreadContext context, IRubyObject offset, IRubyObject length)
      Reads an array of signed long integer values from the memory address.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to read the values.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • put_array_of_long

      public IRubyObject put_array_of_long(ThreadContext context, IRubyObject offset, IRubyObject arr)
      Writes an array of signed long integer values to the memory area.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to write the values.
      arr - Array of values to write to memory.
      Returns:
      this object.
    • get_array_of_ulong

      public IRubyObject get_array_of_ulong(ThreadContext context, IRubyObject offset, IRubyObject length)
      Reads an array of unsigned long integer values from the memory address.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to read the values.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • put_array_of_ulong

      public IRubyObject put_array_of_ulong(ThreadContext context, IRubyObject offset, IRubyObject arr)
      Writes an array of unsigned long integer values to the memory area.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to write the values.
      arr - Array of values to write to memory.
      Returns:
      this object.
    • get_array_of_int64

      public IRubyObject get_array_of_int64(ThreadContext context, IRubyObject offset, IRubyObject length)
      Reads an array of signed 64 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to read the values.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • put_array_of_int64

      public IRubyObject put_array_of_int64(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
      Writes an array of signed 64 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to write the values.
      arrParam - Array of values to write to memory.
      Returns:
      this object.
    • get_array_of_uint64

      public IRubyObject get_array_of_uint64(ThreadContext context, IRubyObject offset, IRubyObject length)
      Reads an array of unsigned 64 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to read the values.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • put_array_of_uint64

      public IRubyObject put_array_of_uint64(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
      Writes an array of unsigned 64 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to write the values.
      arrParam - Array of values to write to memory.
      Returns:
      this object.
    • get_array_of_float

      public IRubyObject get_array_of_float(ThreadContext context, IRubyObject offset, IRubyObject length)
      Reads an array of signed 32 bit floating point values from the memory address.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to read the values.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • put_array_of_float

      public IRubyObject put_array_of_float(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
      Writes an array of 32 bit floating point values to the memory area.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to write the values.
      arrParam - Array of values to write to memory.
      Returns:
      this object.
    • get_array_of_float64

      public IRubyObject get_array_of_float64(ThreadContext context, IRubyObject offset, IRubyObject length)
      Reads an array of signed 64 bit floating point values from the memory address.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to read the values.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • put_array_of_float64

      public IRubyObject put_array_of_float64(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
      Writes an array of 64 bit floating point values to the memory area.
      Parameters:
      context - The thread context.
      offset - The offset from the start of the memory area to write the values.
      arrParam - Array of values to write to memory.
      Returns:
      this object.
    • read_array_of_int8

      public IRubyObject read_array_of_int8(ThreadContext context, IRubyObject length)
      Reads an array of signed 8 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • write_array_of_int8

      public IRubyObject write_array_of_int8(ThreadContext context, IRubyObject ary)
      Writes an array of signed 8 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      ary - The array of values to write to the memory area.
      Returns:
      this object.
    • read_array_of_uint8

      public IRubyObject read_array_of_uint8(ThreadContext context, IRubyObject length)
      Reads an array of unsigned 8 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • write_array_of_uint8

      public IRubyObject write_array_of_uint8(ThreadContext context, IRubyObject ary)
      Writes an array of unsigned 8 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      ary - Array of values to write to memory.
      Returns:
      this object.
    • read_array_of_int16

      public IRubyObject read_array_of_int16(ThreadContext context, IRubyObject length)
      Reads an array of signed 16 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • write_array_of_int16

      public IRubyObject write_array_of_int16(ThreadContext context, IRubyObject ary)
      Writes an array of signed 16 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      ary - The array of values to write to the memory area.
      Returns:
      this object.
    • read_array_of_uint16

      public IRubyObject read_array_of_uint16(ThreadContext context, IRubyObject length)
      Reads an array of unsigned 16 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • write_array_of_uint16

      public IRubyObject write_array_of_uint16(ThreadContext context, IRubyObject ary)
      Writes an array of unsigned 16 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      ary - The array of values to write to the memory area.
      Returns:
      this object.
    • read_array_of_int32

      public IRubyObject read_array_of_int32(ThreadContext context, IRubyObject length)
      Reads an array of signed 32 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • write_array_of_int32

      public IRubyObject write_array_of_int32(ThreadContext context, IRubyObject ary)
      Writes an array of signed 32 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      ary - The array of values to write to the memory area.
      Returns:
      this object.
    • read_array_of_uint32

      public IRubyObject read_array_of_uint32(ThreadContext context, IRubyObject length)
      Reads an array of unsigned 32 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • write_array_of_uint32

      public IRubyObject write_array_of_uint32(ThreadContext context, IRubyObject ary)
      Writes an array of unsigned 32 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      ary - The array of values to write to the memory area.
      Returns:
      this object.
    • read_array_of_int64

      public IRubyObject read_array_of_int64(ThreadContext context, IRubyObject length)
      Reads an array of signed 64 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • write_array_of_int64

      public IRubyObject write_array_of_int64(ThreadContext context, IRubyObject ary)
      Writes an array of signed 64 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      ary - The array of values to write to the memory area.
      Returns:
      this object.
    • read_array_of_uint64

      public IRubyObject read_array_of_uint64(ThreadContext context, IRubyObject length)
      Reads an array of unsigned 64 bit integer values from the memory address.
      Parameters:
      context - The thread context.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • write_array_of_uint64

      public IRubyObject write_array_of_uint64(ThreadContext context, IRubyObject ary)
      Writes an array of unsigned 64 bit integer values to the memory area.
      Parameters:
      context - The thread context.
      ary - The array of values to write to the memory area.
      Returns:
      this object.
    • read_array_of_long

      public IRubyObject read_array_of_long(ThreadContext context, IRubyObject length)
      Reads an array of signed long integer values from the memory address.
      Parameters:
      context - The thread context.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • write_array_of_long

      public IRubyObject write_array_of_long(ThreadContext context, IRubyObject ary)
      Writes an array of signed long integer values to the memory area.
      Parameters:
      context - The thread context.
      ary - The array of values to write to the memory area.
      Returns:
      this object.
    • read_array_of_ulong

      public IRubyObject read_array_of_ulong(ThreadContext context, IRubyObject length)
      Reads an array of unsigned long integer values from the memory address.
      Parameters:
      context - The thread context.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • write_array_of_ulong

      public IRubyObject write_array_of_ulong(ThreadContext context, IRubyObject ary)
      Writes an array of unsigned long integer values to the memory area.
      Parameters:
      context - The thread context.
      ary - The array of values to write to the memory area.
      Returns:
      this object.
    • read_array_of_float

      public IRubyObject read_array_of_float(ThreadContext context, IRubyObject length)
      Reads an array of signed 32 bit floating point values from the memory address.
      Parameters:
      context - The thread context.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • write_array_of_float

      public IRubyObject write_array_of_float(ThreadContext context, IRubyObject ary)
      Writes an array of 32 bit floating point values to the memory area.
      Parameters:
      context - The thread context.
      ary - The array of values to write to the memory area.
      Returns:
      this object.
    • read_array_of_float64

      public IRubyObject read_array_of_float64(ThreadContext context, IRubyObject length)
      Reads an array of signed 64 bit floating point values from the memory address.
      Parameters:
      context - The thread context.
      length - The number of values to be read from memory.
      Returns:
      An array containing the values.
    • write_array_of_float64

      public IRubyObject write_array_of_float64(ThreadContext context, IRubyObject ary)
      Writes an array of 64 bit floating point values to the memory area.
      Parameters:
      context - The thread context.
      ary - The array of values to write to the memory area.
      Returns:
      this object.
    • read_array_of_type

      public IRubyObject read_array_of_type(ThreadContext context, IRubyObject typeArg, IRubyObject lenArg)
    • read_array_of_type

      public IRubyObject read_array_of_type(ThreadContext context, IRubyObject typeArg, IRubyObject reader, IRubyObject lenArg)
    • write_array_of_type

      public IRubyObject write_array_of_type(ThreadContext context, IRubyObject typeArg, IRubyObject aryArg)
    • write_array_of_type

      public IRubyObject write_array_of_type(ThreadContext context, IRubyObject typeArg, IRubyObject writer, IRubyObject aryArg)
    • read_string

      public IRubyObject read_string(ThreadContext context)
    • read_string

      public IRubyObject read_string(ThreadContext context, IRubyObject rbLength)
    • get_string

      public IRubyObject get_string(ThreadContext context)
    • get_string

      public IRubyObject get_string(ThreadContext context, IRubyObject offArg)
    • get_string

      public IRubyObject get_string(ThreadContext context, IRubyObject offArg, IRubyObject lenArg)
    • get_array_of_string

      public IRubyObject get_array_of_string(ThreadContext context, IRubyObject rbOffset)
    • get_array_of_string

      public IRubyObject get_array_of_string(ThreadContext context, IRubyObject rbOffset, IRubyObject rbCount)
    • read_array_of_string

      public IRubyObject read_array_of_string(ThreadContext context)
    • read_array_of_string

      public IRubyObject read_array_of_string(ThreadContext context, IRubyObject rbLength)
    • put_string

      public IRubyObject put_string(ThreadContext context, IRubyObject offArg, IRubyObject strArg)
    • write_string

      public IRubyObject write_string(ThreadContext context, IRubyObject strArg)
    • write_string

      public IRubyObject write_string(ThreadContext context, IRubyObject strArg, IRubyObject lenArg)
    • get_bytes

      public IRubyObject get_bytes(ThreadContext context, IRubyObject offArg, IRubyObject lenArg)
    • put_bytes

      public IRubyObject put_bytes(ThreadContext context, IRubyObject[] args)
    • read_bytes

      public IRubyObject read_bytes(ThreadContext context, IRubyObject lenArg)
    • write_bytes

      public IRubyObject write_bytes(ThreadContext context, IRubyObject[] args)
    • read_pointer

      public IRubyObject read_pointer(ThreadContext context)
    • get_pointer

      public IRubyObject get_pointer(ThreadContext context)
    • get_pointer

      public IRubyObject get_pointer(ThreadContext context, IRubyObject offset)
    • write_pointer

      public IRubyObject write_pointer(ThreadContext context, IRubyObject value)
    • put_pointer

      public IRubyObject put_pointer(ThreadContext context, IRubyObject value)
    • put_pointer

      public IRubyObject put_pointer(ThreadContext context, IRubyObject offset, IRubyObject value)
    • get_array_of_pointer

      public IRubyObject get_array_of_pointer(ThreadContext context, IRubyObject offset, IRubyObject length)
    • put_array_of_pointer

      public IRubyObject put_array_of_pointer(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
    • read_array_of_pointer

      public IRubyObject read_array_of_pointer(ThreadContext context, IRubyObject length)
    • write_array_of_pointer

      public IRubyObject write_array_of_pointer(ThreadContext context, IRubyObject arrParam)
    • put_callback

      public IRubyObject put_callback(ThreadContext context, IRubyObject offset, IRubyObject proc, IRubyObject cbInfo)
    • op_plus

      public IRubyObject op_plus(ThreadContext context, IRubyObject value)
    • order

      public final IRubyObject order(ThreadContext context)
    • order

      public final IRubyObject order(ThreadContext context, IRubyObject byte_order)
    • to_ptr

      public final IRubyObject to_ptr(ThreadContext context)
    • slice

      public final IRubyObject slice(ThreadContext context, IRubyObject offset, IRubyObject size)
    • put

      public final IRubyObject put(ThreadContext context, IRubyObject typeName, IRubyObject offset)
    • get

      public final IRubyObject get(ThreadContext context, IRubyObject typeName, IRubyObject offset, IRubyObject value)
    • order

      public abstract AbstractMemory order(Ruby runtime, ByteOrder order)
    • slice

      protected abstract AbstractMemory slice(Ruby runtime, long offset)
    • slice

      protected abstract AbstractMemory slice(Ruby runtime, long offset, long size)
    • getPointer

      protected abstract Pointer getPointer(Ruby runtime, long offset)