|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.ext.ffi.AbstractMemory
public abstract class AbstractMemory
A abstract memory object that defines operations common to both pointers and memory buffers
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.jruby.RubyObject |
---|
RubyObject.ObjectMethods |
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject |
---|
RubyBasicObject.BasicObjectMethods, RubyBasicObject.Finalizer |
Field Summary | |
---|---|
static java.lang.String |
ABSTRACT_MEMORY_RUBY_CLASS
|
protected MemoryIO |
io
The Memory I/O object |
protected long |
size
The total size of the memory area |
protected int |
typeSize
The size of each element of this memory area - e.g. |
Fields inherited from class org.jruby.RubyObject |
---|
OBJECT_ALLOCATOR |
Fields inherited from class org.jruby.RubyBasicObject |
---|
ALL_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, TAINTED_F, UNDEF, UNTRUSTED_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F |
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject |
---|
NULL_ARRAY |
Constructor Summary | |
---|---|
protected |
AbstractMemory(Ruby runtime,
RubyClass klass,
MemoryIO io,
long size)
|
protected |
AbstractMemory(Ruby runtime,
RubyClass klass,
MemoryIO io,
long size,
int typeSize)
|
Method Summary | |
---|---|
IRubyObject |
aref(ThreadContext context,
IRubyObject indexArg)
|
protected static int |
calculateSize(ThreadContext context,
IRubyObject sizeArg)
|
protected static RubyArray |
checkArray(IRubyObject obj)
|
IRubyObject |
clear(ThreadContext context)
Clears (zeros out) the memory contents. |
static RubyClass |
createAbstractMemoryClass(Ruby runtime,
RubyModule module)
|
boolean |
eql(IRubyObject other)
method used for Hash key comparison (specialized for String, Symbol and Fixnum) Will by default just call the Ruby method "eql?" |
boolean |
equals(java.lang.Object obj)
Compares this MemoryPointer to another MemoryPointer. |
IRubyObject |
get_array_of_float(ThreadContext context,
IRubyObject offset,
IRubyObject length)
|
IRubyObject |
get_array_of_float64(ThreadContext context,
IRubyObject offset,
IRubyObject length)
|
IRubyObject |
get_array_of_int16(ThreadContext context,
IRubyObject offset,
IRubyObject length)
|
IRubyObject |
get_array_of_int32(ThreadContext context,
IRubyObject offset,
IRubyObject length)
|
IRubyObject |
get_array_of_int64(ThreadContext context,
IRubyObject offset,
IRubyObject length)
|
IRubyObject |
get_array_of_int8(ThreadContext context,
IRubyObject offset,
IRubyObject length)
|
IRubyObject |
get_array_of_long(ThreadContext context,
IRubyObject offset,
IRubyObject length)
|
IRubyObject |
get_array_of_pointer(ThreadContext context,
IRubyObject offset,
IRubyObject length)
|
IRubyObject |
get_array_of_string(ThreadContext context,
IRubyObject rbOffset)
|
IRubyObject |
get_array_of_string(ThreadContext context,
IRubyObject rbOffset,
IRubyObject rbCount)
|
IRubyObject |
get_bytes(ThreadContext context,
IRubyObject offArg,
IRubyObject lenArg)
|
IRubyObject |
get_float32(ThreadContext context,
IRubyObject offset)
Reads a 32 bit floating point value from the memory address. |
IRubyObject |
get_float64(ThreadContext context,
IRubyObject offset)
Reads a 64 bit floating point value from the memory address. |
IRubyObject |
get_int16(ThreadContext context,
IRubyObject offset)
Reads a 16 bit signed integer value from the memory address. |
IRubyObject |
get_int32(ThreadContext context,
IRubyObject offset)
Reads a 32 bit signed integer value from the memory address. |
IRubyObject |
get_int64(ThreadContext context,
IRubyObject offset)
Reads a 64 bit integer value from the memory address. |
IRubyObject |
get_int8(ThreadContext context,
IRubyObject offset)
Reads an 8 bit signed integer value from the memory address. |
IRubyObject |
get_long(ThreadContext context,
IRubyObject offset)
Reads a C long integer value from the memory area. |
IRubyObject |
get_pointer(ThreadContext context,
IRubyObject offset)
|
IRubyObject |
get_string(ThreadContext context,
IRubyObject offArg)
|
IRubyObject |
get_string(ThreadContext context,
IRubyObject offArg,
IRubyObject lenArg)
|
IRubyObject |
get_uint16(ThreadContext context,
IRubyObject offset)
Reads a 16 bit unsigned integer value from the memory address. |
IRubyObject |
get_uint32(ThreadContext context,
IRubyObject offset)
Reads a 32 bit unsigned integer value from the memory address. |
IRubyObject |
get_uint64(ThreadContext context,
IRubyObject offset)
Reads a 64 bit unsigned integer value from the memory address. |
IRubyObject |
get_uint8(ThreadContext context,
IRubyObject offset)
Reads an 8 bit unsigned integer value from the memory address. |
IRubyObject |
get_ulong(ThreadContext context,
IRubyObject offset)
Reads a C unsigned long integer value from the memory area. |
MemoryIO |
getMemoryIO()
Gets the memory I/O accessor to read/write to the memory area. |
protected long |
getOffset(IRubyObject offset)
Calculates the absoluate offset within the base memory pointer for a given offset. |
protected abstract Pointer |
getPointer(Ruby runtime,
long offset)
|
protected long |
getSize()
Gets the size of the memory area. |
RubyFixnum |
hash(ThreadContext context)
Calculates a hash code for the pointer. |
int |
hashCode()
Calculates the hash code for this MemoryPointer |
IRubyObject |
op_equal(ThreadContext context,
IRubyObject obj)
rb_obj_equal Will by default use identity equality to compare objects. |
IRubyObject |
op_plus(ThreadContext context,
IRubyObject value)
|
IRubyObject |
put_array_of_float(ThreadContext context,
IRubyObject offset,
IRubyObject arrParam)
|
IRubyObject |
put_array_of_float64(ThreadContext context,
IRubyObject offset,
IRubyObject arrParam)
|
IRubyObject |
put_array_of_int16(ThreadContext context,
IRubyObject offset,
IRubyObject arrParam)
|
IRubyObject |
put_array_of_int32(ThreadContext context,
IRubyObject offset,
IRubyObject arrParam)
|
IRubyObject |
put_array_of_int64(ThreadContext context,
IRubyObject offset,
IRubyObject arrParam)
|
IRubyObject |
put_array_of_int8(ThreadContext context,
IRubyObject offset,
IRubyObject arrParam)
|
IRubyObject |
put_array_of_long(ThreadContext context,
IRubyObject offset,
IRubyObject arr)
|
IRubyObject |
put_array_of_pointer(ThreadContext context,
IRubyObject offset,
IRubyObject arrParam)
|
IRubyObject |
put_bytes(ThreadContext context,
IRubyObject[] args)
|
IRubyObject |
put_callback(ThreadContext context,
IRubyObject offset,
IRubyObject proc,
IRubyObject cbInfo)
|
IRubyObject |
put_float32(ThreadContext context,
IRubyObject offset,
IRubyObject value)
Writes an 32 bit floating point value to the memory area. |
IRubyObject |
put_float64(ThreadContext context,
IRubyObject offset,
IRubyObject value)
Writes an 64 bit floating point value to the memory area. |
IRubyObject |
put_int16(ThreadContext context,
IRubyObject offset,
IRubyObject value)
Writes a 16 bit signed integer value to the memory address. |
IRubyObject |
put_int32(ThreadContext context,
IRubyObject offset,
IRubyObject value)
Writes a 32 bit signed integer value to the memory address. |
IRubyObject |
put_int64(ThreadContext context,
IRubyObject offset,
IRubyObject value)
Writes a 64 bit integer value to the memory area. |
IRubyObject |
put_int8(ThreadContext context,
IRubyObject offset,
IRubyObject value)
Writes a 8 bit signed integer value to the memory area. |
IRubyObject |
put_long(ThreadContext context,
IRubyObject offset,
IRubyObject value)
Writes a C long integer value to the memory area. |
IRubyObject |
put_pointer(ThreadContext context,
IRubyObject offset,
IRubyObject value)
|
IRubyObject |
put_string(ThreadContext context,
IRubyObject offArg,
IRubyObject strArg)
|
IRubyObject |
put_uint16(ThreadContext context,
IRubyObject offset,
IRubyObject value)
Writes a 16 bit unsigned integer value to the memory address. |
IRubyObject |
put_uint32(ThreadContext context,
IRubyObject offset,
IRubyObject value)
Writes an 32 bit unsigned integer value to the memory address. |
IRubyObject |
put_uint64(ThreadContext context,
IRubyObject offset,
IRubyObject value)
Writes a 64 bit unsigned integer value to the memory area. |
IRubyObject |
put_uint8(ThreadContext context,
IRubyObject offset,
IRubyObject value)
Writes a 8 bit unsigned integer value to the memory area. |
IRubyObject |
put_ulong(ThreadContext context,
IRubyObject offset,
IRubyObject value)
Writes a C long integer value to the memory area. |
IRubyObject |
read_string(ThreadContext context)
|
IRubyObject |
read_string(ThreadContext context,
IRubyObject rbLength)
|
protected abstract AbstractMemory |
slice(Ruby runtime,
long offset)
|
IRubyObject |
to_s(ThreadContext context,
IRubyObject[] args)
|
IRubyObject |
total(ThreadContext context)
Gets the total size (in bytes) of the MemoryPointer. |
IRubyObject |
type_size(ThreadContext context)
Indicates how many bytes the intrinsic type of the memory uses. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ABSTRACT_MEMORY_RUBY_CLASS
protected final long size
protected final int typeSize
protected final MemoryIO io
Constructor Detail |
---|
protected AbstractMemory(Ruby runtime, RubyClass klass, MemoryIO io, long size)
protected AbstractMemory(Ruby runtime, RubyClass klass, MemoryIO io, long size, int typeSize)
Method Detail |
---|
public static RubyClass createAbstractMemoryClass(Ruby runtime, RubyModule module)
protected static final int calculateSize(ThreadContext context, IRubyObject sizeArg)
protected static final RubyArray checkArray(IRubyObject obj)
public final MemoryIO getMemoryIO()
protected final long getOffset(IRubyObject offset)
offset
- The offset to add to the base offset.
protected final long getSize()
public RubyFixnum hash(ThreadContext context)
public IRubyObject to_s(ThreadContext context, IRubyObject[] args)
public final IRubyObject aref(ThreadContext context, IRubyObject indexArg)
public boolean equals(java.lang.Object obj)
equals
in class RubyObject
obj
- The other MemoryPointer to compare to.
public IRubyObject op_equal(ThreadContext context, IRubyObject obj)
RubyObject
op_equal
in interface IRubyObject
op_equal
in class RubyObject
public final boolean eql(IRubyObject other)
RubyBasicObject
eql
in interface IRubyObject
eql
in class RubyBasicObject
public int hashCode()
hashCode
in class RubyObject
public IRubyObject clear(ThreadContext context)
public IRubyObject total(ThreadContext context)
public final IRubyObject type_size(ThreadContext context)
context
-
public IRubyObject put_int8(ThreadContext context, IRubyObject offset, IRubyObject value)
offset
- The offset from the base pointer address to write the value.value
- The value to write.
public IRubyObject get_int8(ThreadContext context, IRubyObject offset)
offset
- The offset from the base pointer address to read the value.
public IRubyObject put_uint8(ThreadContext context, IRubyObject offset, IRubyObject value)
offset
- The offset from the base pointer address to write the value.value
- The value to write.
public IRubyObject get_uint8(ThreadContext context, IRubyObject offset)
offset
- The offset from the base pointer address to read the value.
public IRubyObject put_int16(ThreadContext context, IRubyObject offset, IRubyObject value)
offset
- The offset from the base pointer address to write the value.value
- The value to write.
public IRubyObject get_int16(ThreadContext context, IRubyObject offset)
offset
- The offset from the base pointer address to read the value.
public IRubyObject put_uint16(ThreadContext context, IRubyObject offset, IRubyObject value)
offset
- The offset from the base pointer address to write the value.value
- The value to write.
public IRubyObject get_uint16(ThreadContext context, IRubyObject offset)
offset
- The offset from the base pointer address to read the value.
public IRubyObject put_int32(ThreadContext context, IRubyObject offset, IRubyObject value)
offset
- The offset from the base pointer address to write the value.value
- The value to write.
public IRubyObject get_int32(ThreadContext context, IRubyObject offset)
offset
- The offset from the base pointer address to read the value.
public IRubyObject put_uint32(ThreadContext context, IRubyObject offset, IRubyObject value)
offset
- The offset from the base pointer address to write the value.value
- The value to write.
public IRubyObject get_uint32(ThreadContext context, IRubyObject offset)
offset
- The offset from the base pointer address to read the value.
public IRubyObject put_int64(ThreadContext context, IRubyObject offset, IRubyObject value)
offset
- The offset from the base pointer address to write the value.value
- The value to write.
public IRubyObject get_int64(ThreadContext context, IRubyObject offset)
offset
- The offset from the base pointer address to read the value.
public IRubyObject put_uint64(ThreadContext context, IRubyObject offset, IRubyObject value)
offset
- The offset from the base pointer address to write the value.value
- The value to write.
public IRubyObject get_uint64(ThreadContext context, IRubyObject offset)
offset
- The offset from the base pointer address to read the value.
public IRubyObject put_long(ThreadContext context, IRubyObject offset, IRubyObject value)
offset
- The offset from the base pointer address to write the value.value
- The value to write.
public IRubyObject get_long(ThreadContext context, IRubyObject offset)
offset
- The offset from the base pointer address to read the value.
public IRubyObject put_ulong(ThreadContext context, IRubyObject offset, IRubyObject value)
offset
- The offset from the base pointer address to write the value.value
- The value to write.
public IRubyObject get_ulong(ThreadContext context, IRubyObject offset)
offset
- The offset from the base pointer address to read the value.
public IRubyObject put_float32(ThreadContext context, IRubyObject offset, IRubyObject value)
offset
- The offset from the base pointer address to write the value.value
- The value to write.
public IRubyObject get_float32(ThreadContext context, IRubyObject offset)
offset
- The offset from the base pointer address to read the value.
public IRubyObject put_float64(ThreadContext context, IRubyObject offset, IRubyObject value)
offset
- The offset from the base pointer address to write the value.value
- The value to write.
public IRubyObject get_float64(ThreadContext context, IRubyObject offset)
offset
- The offset from the base pointer address to read the value.
public IRubyObject get_array_of_int8(ThreadContext context, IRubyObject offset, IRubyObject length)
public IRubyObject put_array_of_int8(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
public IRubyObject get_array_of_int16(ThreadContext context, IRubyObject offset, IRubyObject length)
public IRubyObject put_array_of_int16(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
public IRubyObject get_array_of_int32(ThreadContext context, IRubyObject offset, IRubyObject length)
public IRubyObject put_array_of_int32(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
public IRubyObject get_array_of_long(ThreadContext context, IRubyObject offset, IRubyObject length)
public IRubyObject put_array_of_long(ThreadContext context, IRubyObject offset, IRubyObject arr)
public IRubyObject get_array_of_int64(ThreadContext context, IRubyObject offset, IRubyObject length)
public IRubyObject put_array_of_int64(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
public IRubyObject get_array_of_float(ThreadContext context, IRubyObject offset, IRubyObject length)
public IRubyObject put_array_of_float(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
public IRubyObject get_array_of_float64(ThreadContext context, IRubyObject offset, IRubyObject length)
public IRubyObject put_array_of_float64(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
public IRubyObject read_string(ThreadContext context)
public IRubyObject read_string(ThreadContext context, IRubyObject rbLength)
public IRubyObject get_string(ThreadContext context, IRubyObject offArg)
public IRubyObject get_string(ThreadContext context, IRubyObject offArg, IRubyObject lenArg)
public IRubyObject get_array_of_string(ThreadContext context, IRubyObject rbOffset)
public IRubyObject get_array_of_string(ThreadContext context, IRubyObject rbOffset, IRubyObject rbCount)
public IRubyObject put_string(ThreadContext context, IRubyObject offArg, IRubyObject strArg)
public IRubyObject get_bytes(ThreadContext context, IRubyObject offArg, IRubyObject lenArg)
public IRubyObject put_bytes(ThreadContext context, IRubyObject[] args)
public IRubyObject get_pointer(ThreadContext context, IRubyObject offset)
public IRubyObject put_pointer(ThreadContext context, IRubyObject offset, IRubyObject value)
public IRubyObject get_array_of_pointer(ThreadContext context, IRubyObject offset, IRubyObject length)
public IRubyObject put_array_of_pointer(ThreadContext context, IRubyObject offset, IRubyObject arrParam)
public IRubyObject put_callback(ThreadContext context, IRubyObject offset, IRubyObject proc, IRubyObject cbInfo)
public IRubyObject op_plus(ThreadContext context, IRubyObject value)
protected abstract AbstractMemory slice(Ruby runtime, long offset)
protected abstract Pointer getPointer(Ruby runtime, long offset)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |