Class Type

All Implemented Interfaces:
Serializable, Cloneable, Comparable<IRubyObject>, InstanceVariables, InternalVariables, IRubyObject, CoreObjectType
Direct Known Subclasses:
CallbackInfo, MappedType, StructByValue, StructLayout, Type.Array, Type.Builtin

public abstract class Type extends RubyObject
See Also:
  • Field Details

    • LOCALE

      private static final Locale LOCALE
    • nativeType

      protected final NativeType nativeType
    • size

      protected final int size
      Size of this type in bytes
    • alignment

      protected final int alignment
      Minimum alignment of this type in bytes
  • Constructor Details

    • Type

      protected Type(Ruby runtime, RubyClass klass, NativeType type, int size, int alignment)
      Initializes a new Type instance.
    • Type

      protected Type(Ruby runtime, RubyClass klass, NativeType type)
      Initializes a new Type instance.
  • Method Details

    • createTypeClass

      public static RubyClass createTypeClass(Ruby runtime, RubyModule ffiModule)
    • defineBuiltinType

      private static final void defineBuiltinType(Ruby runtime, RubyClass builtinClass, NativeType nativeType, String... names)
    • getTypeClass

      public static final RubyClass getTypeClass(Ruby runtime)
    • getNativeType

      public final NativeType getNativeType()
      Gets the native type of this Type when passed as a parameter
      Returns:
      The native type of this Type.
    • getNativeSize

      public final int getNativeSize()
      Gets the native size of this Type in bytes
      Returns:
      The native size of this Type.
    • getNativeAlignment

      public final int getNativeAlignment()
      Gets the native alignment of this Type in bytes
      Returns:
      The native alignment of this Type.
    • size

      public IRubyObject size(ThreadContext context)
      Gets the native size of this Type in bytes
      Parameters:
      context - The Ruby thread context.
      Returns:
      The native size of this Type.
    • alignment

      public IRubyObject alignment(ThreadContext context)
      Gets the native alignment of this Type in bytes
      Parameters:
      context - The Ruby thread context.
      Returns:
      The native alignment of this Type.
    • isPrimitive

      private static final boolean isPrimitive(NativeType type)
    • getNativeAlignment

      static final int getNativeAlignment(NativeType type)
    • getNativeSize

      static final int getNativeSize(NativeType type)