|
||||||||||
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, RubyBasicObject.VariableTableEntry |
Field Summary | |
---|---|
static java.lang.String |
ABSTRACT_MEMORY_RUBY_CLASS
|
protected MemoryIO |
io
The Memory I/O object |
protected long |
offset
The offset from the base memory pointer |
protected long |
size
The total size of the memory area |
Fields inherited from class org.jruby.RubyObject |
---|
OBJECT_ALLOCATOR |
Fields inherited from class org.jruby.RubyBasicObject |
---|
ALL_F, dataStruct, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, TAINTED_F, UNDEF, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, VARIABLE_TABLE_DEFAULT_CAPACITY, VARIABLE_TABLE_EMPTY_TABLE, VARIABLE_TABLE_LOAD_FACTOR, VARIABLE_TABLE_MAXIMUM_CAPACITY, variableTable, variableTableSize, variableTableThreshold |
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject |
---|
NULL_ARRAY |
Constructor Summary | |
---|---|
protected |
AbstractMemory(Ruby runtime,
RubyClass klass,
MemoryIO io,
long offset,
long size)
|
Method Summary | |
---|---|
protected long |
checkBounds(ThreadContext context,
IRubyObject offArg,
long len)
|
protected void |
checkBounds(ThreadContext context,
long off,
long len)
|
protected static void |
checkBounds(ThreadContext context,
long size,
long off,
long len)
|
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_buffer(ThreadContext context,
IRubyObject off,
IRubyObject len_)
|
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_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. |
protected MemoryIO |
getMemoryIO()
Gets the memory I/O accessor to read/write to the memory area. |
protected long |
getOffset()
Gets the offset within 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 |
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_buffer(ThreadContext context,
IRubyObject off,
IRubyObject str,
IRubyObject len_)
|
IRubyObject |
put_bytes(ThreadContext context,
IRubyObject[] args)
|
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_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_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 |
to_s(ThreadContext context,
IRubyObject[] args)
|
IRubyObject |
total(ThreadContext context)
Gets the total size (in bytes) of the MemoryPointer. |
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 offset
protected final long size
protected final MemoryIO io
Constructor Detail |
---|
protected AbstractMemory(Ruby runtime, RubyClass klass, MemoryIO io, long offset, long size)
Method Detail |
---|
public static RubyClass createAbstractMemoryClass(Ruby runtime, RubyModule module)
protected final MemoryIO getMemoryIO()
protected final long getOffset(IRubyObject offset)
offset
- The offset to add to the base offset.
protected final long getOffset()
protected final long getSize()
public RubyFixnum hash(ThreadContext context)
public IRubyObject to_s(ThreadContext context, IRubyObject[] args)
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)
protected static final void checkBounds(ThreadContext context, long size, long off, long len)
protected final void checkBounds(ThreadContext context, long off, long len)
protected final long checkBounds(ThreadContext context, IRubyObject offArg, long len)
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_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 get_string(ThreadContext context, IRubyObject offArg)
public IRubyObject get_string(ThreadContext context, IRubyObject offArg, IRubyObject lenArg)
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 get_buffer(ThreadContext context, IRubyObject off, IRubyObject len_)
public IRubyObject put_buffer(ThreadContext context, IRubyObject off, IRubyObject str, IRubyObject len_)
protected abstract Pointer getPointer(Ruby runtime, long offset)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |