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

public Class CallbackInfo

extends Type
Class Inheritance
Annotations
@JRubyClass
name:FFI::CallbackInfo
parent:FFI::Type
Imports
org.jruby.Ruby, .RubyArray, .RubyClass, .RubyHash, .RubyModule, org.jruby.anno.JRubyClass, .JRubyMethod, org.jruby.api.Convert, org.jruby.runtime.Arity, .ThreadContext, org.jruby.runtime.builtin.IRubyObject

Defines a C callback's parameters and return type.

Field Summary

Modifier and TypeField and Description
protected final Arity
arity

The arity of this function.

public static final String
protected final Type[]
protected final Type
protected final boolean
Inherited from org.jruby.ext.ffi.Type:
alignmentnativeTypesize

Constructor Summary

AccessConstructor and Description
public
CallbackInfo(Ruby
The runtime to create the instance for
runtime
,
RubyClass
The ruby class of the CallbackInfo instance
klazz
,
Type
The return type of the callback
returnType
,
Type[]
The parameter types of the callback
paramTypes
,
boolean stdcall)

Creates a new CallbackInfo instance.

Method Summary

Modifier and TypeMethod and Description
public static RubyClass
public final Arity

Returns:

The Arity of the native function.
getArity
()

Returns the org.jruby.runtime.Arity of this function.

public final Type[]

Returns:

An array of the parameter types
getParameterTypes
()

Gets the ruby parameter types of the callback

public final Type

Returns:

The native return type
getReturnType
()

Gets the native return type the callback should return

public final boolean
public static final IRubyObject

Returns:

A new CallbackInfo instance
newCallbackInfo
(ThreadContext
The current ruby thread context
context
,
IRubyObject
The ruby class of the CallbackInfo instance
klass
,
IRubyObject[]
An array containing the ruby parameter types
args
)

CallbackInfo.new

public final IRubyObject
public final IRubyObject
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

arityback to summary
protected final Arity arity

The arity of this function.

CLASS_NAMEback to summary
public static final String CLASS_NAME
parameterTypesback to summary
protected final Type[] parameterTypes
returnTypeback to summary
protected final Type returnType
stdcallback to summary
protected final boolean stdcall

Constructor Detail

CallbackInfoback to summary
public CallbackInfo(Ruby runtime, RubyClass klazz, Type returnType, Type[] paramTypes, boolean stdcall)

Creates a new CallbackInfo instance.

Parameters
runtime:Ruby

The runtime to create the instance for

klazz:RubyClass

The ruby class of the CallbackInfo instance

returnType:Type

The return type of the callback

paramTypes:Type[]

The parameter types of the callback

Method Detail

createCallbackInfoClassback to summary
public static RubyClass createCallbackInfoClass(ThreadContext context, RubyModule module, RubyClass Type)
getArityback to summary
public final Arity getArity()

Returns the org.jruby.runtime.Arity of this function.

Returns:Arity

The Arity of the native function.

getParameterTypesback to summary
public final Type[] getParameterTypes()

Gets the ruby parameter types of the callback

Returns:Type[]

An array of the parameter types

getReturnTypeback to summary
public final Type getReturnType()

Gets the native return type the callback should return

Returns:Type

The native return type

isStdcallback to summary
public final boolean isStdcall()
newCallbackInfoback to summary
public static final IRubyObject newCallbackInfo(ThreadContext context, IRubyObject klass, IRubyObject[] args)

CallbackInfo.new

Parameters
context:ThreadContext

The current ruby thread context

klass:IRubyObject

The ruby class of the CallbackInfo instance

args:IRubyObject[]

An array containing the ruby parameter types

Returns:IRubyObject

A new CallbackInfo instance

Annotations
@JRubyMethod
name:new
meta:true
required:2
optional:1
checkArity:false
param_typesback to summary
public final IRubyObject param_types(ThreadContext context)
Annotations
@JRubyMethod
result_typeback to summary
public final IRubyObject result_type(ThreadContext context)
Annotations
@JRubyMethod
to_sback to summary
public final IRubyObject to_s(ThreadContext context)

Overrides org.jruby.RubyBasicObject.to_s.

Annotations
@JRubyMethod
name:to_s
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