Class BGFXMemory

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class BGFXMemory extends Struct<BGFXMemory> implements NativeResource

 struct bgfx_memory_t {
     uint8_t * data;
     uint32_t size;
 }
  • 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.
    • SIZE

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

    • BGFXMemory

      public BGFXMemory(ByteBuffer container)
      Creates a BGFXMemory 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<BGFXMemory>
    • data

      public ByteBuffer data()
      Returns:
      a ByteBuffer view of the data pointed to by the data field.
    • size

      public int size()
      Returns:
      the value of the size field.
    • data

      public BGFXMemory data(ByteBuffer value)
      Sets the address of the specified ByteBuffer to the data field.
    • set

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      public static BGFXMemory.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new BGFXMemory.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 ByteBuffer ndata(long struct)
      Unsafe version of data.
    • nsize

      public static int nsize(long struct)
      Unsafe version of size().
    • ndata

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

      public static void nsize(long struct, int value)
      Sets the specified value to the size field of the specified struct.
    • validate

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