Class CallbackInfo

All Implemented Interfaces:
Serializable, Cloneable, Comparable<IRubyObject>, InstanceVariables, InternalVariables, IRubyObject, CoreObjectType

public class CallbackInfo extends Type
Defines a C callback's parameters and return type.
See Also:
  • Field Details

    • CLASS_NAME

      public static final String CLASS_NAME
      See Also:
    • arity

      protected final Arity arity
      The arity of this function.
    • parameterTypes

      protected final Type[] parameterTypes
    • returnType

      protected final Type returnType
    • stdcall

      protected final boolean stdcall
  • Constructor Details

    • CallbackInfo

      public CallbackInfo(Ruby runtime, RubyClass klazz, Type returnType, Type[] paramTypes, boolean stdcall)
      Creates a new CallbackInfo instance.
      Parameters:
      runtime - The runtime to create the instance for
      klazz - The ruby class of the CallbackInfo instance
      returnType - The return type of the callback
      paramTypes - The parameter types of the callback
  • Method Details

    • createCallbackInfoClass

      public static RubyClass createCallbackInfoClass(ThreadContext context, RubyModule module, RubyClass Type)
    • newCallbackInfo

      public static final IRubyObject newCallbackInfo(ThreadContext context, IRubyObject klass, IRubyObject[] args)
      CallbackInfo.new
      Parameters:
      context - The current ruby thread context
      klass - The ruby class of the CallbackInfo instance
      args - An array containing the ruby parameter types
      Returns:
      A new CallbackInfo instance
    • getArity

      public final Arity getArity()
      Returns the Arity of this function.
      Returns:
      The Arity of the native function.
    • getReturnType

      public final Type getReturnType()
      Gets the native return type the callback should return
      Returns:
      The native return type
    • getParameterTypes

      public final Type[] getParameterTypes()
      Gets the ruby parameter types of the callback
      Returns:
      An array of the parameter types
    • isStdcall

      public final boolean isStdcall()
    • to_s

      public final IRubyObject to_s(ThreadContext context)
      Overrides:
      to_s in class RubyBasicObject
    • toString

      public final String toString()
      Description copied from class: RubyObject
      The default toString method is just a wrapper that calls the Ruby "to_s" method.
      Overrides:
      toString in class RubyObject
      Returns:
      string representation
    • result_type

      public final IRubyObject result_type(ThreadContext context)
    • param_types

      public final IRubyObject param_types(ThreadContext context)