Top Inners Fields Constructors Methods
org.jruby.ext.ffi

public abstract Class Type

extends RubyObject
Class Inheritance
Known Direct Subclasses
org.jruby.ext.ffi.Type.Builtin, org.jruby.ext.ffi.Type.Array, org.jruby.ext.ffi.CallbackInfo, org.jruby.ext.ffi.MappedType, org.jruby.ext.ffi.StructByValue, org.jruby.ext.ffi.StructLayout
Annotations
@JRubyClass
name:FFI::Type
parent:Object
Imports
java.util.Map, org.jruby.Ruby, .RubyClass, .RubyModule, .RubyObject, .RubySymbol, org.jruby.anno.JRubyClass, .JRubyMethod, org.jruby.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class

Field Summary

Modifier and TypeField and Description
protected final int
alignment

Minimum alignment of this type in bytes

private static final Locale
protected final NativeType
protected final int
size

Size of this type in bytes

Inherited from org.jruby.RubyObject:
IVAR_INSPECTING_OBJECT_ALLOCATOROBJECT_ALLOCATORREIFYING_OBJECT_ALLOCATOR

Constructor Summary

AccessConstructor and Description
protected
Type(Ruby runtime, RubyClass klass, NativeType type, int size, int alignment)

Initializes a new Type instance.

protected
Type(Ruby runtime, RubyClass klass, NativeType type)

Initializes a new Type instance.

Method Summary

Modifier and TypeMethod and Description
public IRubyObject

Returns:

The native alignment of this Type.
alignment
(ThreadContext
The Ruby thread context.
context
)

Gets the native alignment of this Type in bytes

public static RubyClass
private static final void
defineBuiltinType(ThreadContext context, RubyClass builtinClass, NativeType nativeType, String... names)

public final int

Returns:

The native alignment of this Type.
getNativeAlignment
()

Gets the native alignment of this Type in bytes

pack-priv static final int
public final int

Returns:

The native size of this Type.
getNativeSize
()

Gets the native size of this Type in bytes

pack-priv static final int
public final NativeType

Returns:

The native type of this Type.
getNativeType
()

Gets the native type of this Type when passed as a parameter

public static final RubyClass
getTypeClass(Ruby runtime)

private static final boolean
public IRubyObject

Returns:

The native size of this Type.
size
(ThreadContext
The Ruby thread context.
context
)

Gets the native size of this Type in bytes

Inherited from org.jruby.RubyObject:
attachToObjectSpacecallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitconvertToTypedigdig1dig2eqlInternalequalInternalequalsfinishObjectClassgetNativeClassIndexhashCodeinspectop_eqqputsspecificEvaltoRubyStringtoString

Field Detail

alignmentback to summary
protected final int alignment

Minimum alignment of this type in bytes

LOCALEback to summary
private static final Locale LOCALE
nativeTypeback to summary
protected final NativeType nativeType
sizeback to summary
protected final int size

Size of this type in bytes

Constructor Detail

Typeback to summary
protected Type(Ruby runtime, RubyClass klass, NativeType type, int size, int alignment)

Initializes a new Type instance.

Typeback to summary
protected Type(Ruby runtime, RubyClass klass, NativeType type)

Initializes a new Type instance.

Method Detail

alignmentback to summary
public IRubyObject alignment(ThreadContext context)

Gets the native alignment of this Type in bytes

Parameters
context:ThreadContext

The Ruby thread context.

Returns:IRubyObject

The native alignment of this Type.

Annotations
@JRubyMethod
name:alignment
createTypeClassback to summary
public static RubyClass createTypeClass(ThreadContext context, RubyModule FFI, RubyClass Object)
defineBuiltinTypeback to summary
private static final void defineBuiltinType(ThreadContext context, RubyClass builtinClass, NativeType nativeType, String... names)
getNativeAlignmentback to summary
public final int getNativeAlignment()

Gets the native alignment of this Type in bytes

Returns:int

The native alignment of this Type.

getNativeAlignmentback to summary
pack-priv static final int getNativeAlignment(NativeType type)
getNativeSizeback to summary
public final int getNativeSize()

Gets the native size of this Type in bytes

Returns:int

The native size of this Type.

getNativeSizeback to summary
pack-priv static final int getNativeSize(NativeType type)
getNativeTypeback to summary
public final NativeType getNativeType()

Gets the native type of this Type when passed as a parameter

Returns:NativeType

The native type of this Type.

getTypeClassback to summary
public static final RubyClass getTypeClass(Ruby runtime)
isPrimitiveback to summary
private static final boolean isPrimitive(NativeType type)
sizeback to summary
public IRubyObject size(ThreadContext context)

Gets the native size of this Type in bytes

Parameters
context:ThreadContext

The Ruby thread context.

Returns:IRubyObject

The native size of this Type.

Annotations
@JRubyMethod
name:size
org.jruby.ext.ffi back to summary

public final Class Type.Array

extends Type
Class Inheritance
Annotations
@JRubyClass
name:FFI::Type::Array
parent:FFI::Type

Field Summary

Modifier and TypeField and Description
private final Type
private final int
Inherited from org.jruby.ext.ffi.Type:
alignmentnativeTypesize

Constructor Summary

AccessConstructor and Description
public
Array(Ruby runtime, RubyClass klass, Type componentType, int length)

Initializes a new Type.Array instance.

public
Array(Ruby runtime, Type componentType, int length)

Initializes a new Type.Array instance.

Method Summary

Modifier and TypeMethod and Description
public final IRubyObject
public final Type
public final int
public final IRubyObject
public static final IRubyObject
newInstance(ThreadContext context, IRubyObject klass, IRubyObject componentType, IRubyObject length)

Inherited from org.jruby.ext.ffi.Type:
alignmentcreateTypeClassgetNativeAlignmentgetNativeAlignmentgetNativeSizegetNativeSizegetNativeTypegetTypeClasssize

Field Detail

componentTypeback to summary
private final Type componentType
lengthback to summary
private final int length

Constructor Detail

Arrayback to summary
public Array(Ruby runtime, RubyClass klass, Type componentType, int length)

Initializes a new Type.Array instance.

Arrayback to summary
public Array(Ruby runtime, Type componentType, int length)

Initializes a new Type.Array instance.

Method Detail

elem_typeback to summary
public final IRubyObject elem_type(ThreadContext context)
Annotations
@JRubyMethod
getComponentTypeback to summary
public final Type getComponentType()
lengthback to summary
public final int length()
lengthback to summary
public final IRubyObject length(ThreadContext context)
Annotations
@JRubyMethod
newInstanceback to summary
public static final IRubyObject newInstance(ThreadContext context, IRubyObject klass, IRubyObject componentType, IRubyObject length)
Annotations
@JRubyMethod
name:new
required:2
meta:true
org.jruby.ext.ffi back to summary

public final Class Type.Builtin

extends Type
Class Inheritance
Annotations
@JRubyClass
name:FFI::Type::Builtin
parent:FFI::Type

Field Summary

Modifier and TypeField and Description
private final RubySymbol
Inherited from org.jruby.ext.ffi.Type:
alignmentnativeTypesize

Constructor Summary

AccessConstructor and Description
private
Builtin(ThreadContext context, RubyClass klass, NativeType nativeType, String symName)

Initializes a new BuiltinType instance.

Method Summary

Modifier and TypeMethod and Description
public IRubyObject
public IRubyObject
equal_p(ThreadContext
the thread context
context
,
IRubyObject
to compare with
obj
)

Overrides org.jruby.RubyBasicObject.equal_p.

rb_obj_equal Will use Java identity equality.

public boolean
equals(Object
object to compare
obj
)

Overrides org.jruby.RubyObject.equals.

This override does not do a "checked" dispatch.

public int
hashCode()

Overrides org.jruby.RubyObject.hashCode.

This override does not do "checked" dispatch since Object usually has #hash defined.

public final IRubyObject
inspect(ThreadContext context)

Overrides org.jruby.RubyBasicObject.inspect.

Overrides default org.jruby.runtime.builtin.IRubyObject.inspect.

Returns a string containing a human-readable representation of obj.

public IRubyObject
op_equal(ThreadContext context, IRubyObject obj)

Overrides org.jruby.RubyBasicObject.op_equal.

Implements org.jruby.runtime.builtin.IRubyObject.op_equal.

rb_obj_equal Will by default use identity equality to compare objects.

public final IRubyObject
public final String
toString()

Overrides org.jruby.RubyObject.toString.

The default toString method is just a wrapper that calls the Ruby "to_s" method.

Inherited from org.jruby.ext.ffi.Type:
alignmentcreateTypeClassgetNativeAlignmentgetNativeAlignmentgetNativeSizegetNativeSizegetNativeTypegetTypeClasssize

Field Detail

symback to summary
private final RubySymbol sym

Constructor Detail

Builtinback to summary
private Builtin(ThreadContext context, RubyClass klass, NativeType nativeType, String symName)

Initializes a new BuiltinType instance.

Method Detail

eql_pback to summary
public IRubyObject eql_p(ThreadContext context, IRubyObject obj)

Overrides org.jruby.RubyBasicObject.eql_p.

Annotations
@JRubyMethod
name:eql?
equal_pback to summary
public IRubyObject equal_p(ThreadContext context, IRubyObject obj)

Overrides org.jruby.RubyBasicObject.equal_p.

Doc from org.jruby.RubyBasicObject.equal_p.

rb_obj_equal Will use Java identity equality.

Parameters
context:ThreadContext

the thread context

obj:IRubyObject

to compare with

Returns:IRubyObject

are they equal?

Annotations
@Override
@JRubyMethod
name:equal?
equalsback to summary
public boolean equals(Object obj)

Overrides org.jruby.RubyObject.equals.

Doc from org.jruby.RubyObject.equals.

This override does not do a "checked" dispatch.

Parameters
obj:Object

Doc from org.jruby.RubyBasicObject.equals.

object to compare

Returns:boolean

Doc from org.jruby.RubyBasicObject.equals.

true if equals

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides org.jruby.RubyObject.hashCode.

Doc from org.jruby.RubyObject.hashCode.

This override does not do "checked" dispatch since Object usually has #hash defined.

Returns:int

the hash code

Annotations
@Override
inspectback to summary
public final IRubyObject inspect(ThreadContext context)

Overrides org.jruby.RubyBasicObject.inspect.

Overrides default org.jruby.runtime.builtin.IRubyObject.inspect.

Doc from org.jruby.RubyBasicObject.inspect.

Returns a string containing a human-readable representation of obj. If not overridden, uses the to_s method to generate the string. [ 1, 2, 3..4, 'five' ].inspect #=> "[1, 2, 3..4, \"five\"]" Time.new.inspect #=> "Wed Apr 09 08:54:39 CDT 2003"

Annotations
@JRubyMethod
name:inspect
op_equalback to summary
public IRubyObject op_equal(ThreadContext context, IRubyObject obj)

Overrides org.jruby.RubyBasicObject.op_equal.

Implements org.jruby.runtime.builtin.IRubyObject.op_equal.

Doc from org.jruby.RubyBasicObject.op_equal.

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

Annotations
@Override
@JRubyMethod
name:==
to_symback to summary
public final IRubyObject to_sym(ThreadContext context)
Annotations
@JRubyMethod
toStringback to summary
public final String toString()

Overrides org.jruby.RubyObject.toString.

Doc from org.jruby.RubyObject.toString.

The default toString method is just a wrapper that calls the Ruby "to_s" method.

Returns:String

string representation

Annotations
@Override