org.jruby.ext.ffi
Class StructLayout.Member

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

public static final class StructLayout.Member
extends java.lang.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 Summary
protected StructLayout.Member(StructLayout.Field f, int index, int cacheIndex, int referenceIndex)
          Initializes a new Member instance
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 IRubyObject get(ThreadContext context, StructLayout.Storage cache, AbstractMemory ptr)
          Reads a ruby value from the struct member.
 int hashCode()
           
 int offset()
           
 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.
 Type type()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StructLayout.Member

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

Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.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:
runtime - The ruby runtime
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()


Copyright © 2002-2009 JRuby Team. All Rights Reserved.