Class FT_Generic

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class FT_Generic extends Struct<FT_Generic> implements NativeResource

 struct FT_Generic {
     void * data;
     {@link FT_Generic_FinalizerI FT_Generic_Finalizer} finalizer;
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • DATA

      public static final int DATA
      The struct member offsets.
    • FINALIZER

      public static final int FINALIZER
      The struct member offsets.
  • Constructor Details

    • FT_Generic

      public FT_Generic(ByteBuffer container)
      Creates a FT_Generic instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<FT_Generic>
    • data

      public long data()
      Returns:
      the value of the data field.
    • finalizer

      public FT_Generic_Finalizer finalizer()
      Returns:
      the value of the finalizer field.
    • data

      public FT_Generic data(long value)
      Sets the specified value to the data field.
    • finalizer

      public FT_Generic finalizer(FT_Generic_FinalizerI value)
      Sets the specified value to the finalizer field.
    • set

      public FT_Generic set(long data, FT_Generic_FinalizerI finalizer)
      Initializes this struct with the specified values.
    • set

      public FT_Generic set(FT_Generic src)
      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

      public static FT_Generic malloc()
      Returns a new FT_Generic instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static FT_Generic calloc()
      Returns a new FT_Generic instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static FT_Generic create()
      Returns a new FT_Generic instance allocated with BufferUtils.
    • create

      public static FT_Generic create(long address)
      Returns a new FT_Generic instance for the specified memory address.
    • createSafe

      public static @Nullable FT_Generic createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static FT_Generic.Buffer malloc(int capacity)
      Returns a new FT_Generic.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static FT_Generic.Buffer calloc(int capacity)
      Returns a new FT_Generic.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static FT_Generic.Buffer create(int capacity)
      Returns a new FT_Generic.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static FT_Generic.Buffer create(long address, int capacity)
      Create a FT_Generic.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      public static @Nullable FT_Generic.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • malloc

      public static FT_Generic malloc(MemoryStack stack)
      Returns a new FT_Generic instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static FT_Generic calloc(MemoryStack stack)
      Returns a new FT_Generic instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static FT_Generic.Buffer malloc(int capacity, MemoryStack stack)
      Returns a new FT_Generic.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static FT_Generic.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new FT_Generic.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • ndata

      public static long ndata(long struct)
      Unsafe version of data().
    • nfinalizer

      public static FT_Generic_Finalizer nfinalizer(long struct)
      Unsafe version of finalizer().
    • ndata

      public static void ndata(long struct, long value)
      Unsafe version of data.
    • nfinalizer

      public static void nfinalizer(long struct, FT_Generic_FinalizerI value)
      Unsafe version of finalizer.
    • validate

      public static void validate(long struct)
      Validates pointer members that should not be NULL.
      Parameters:
      struct - the struct to validate