Class BGFXMemory

  • All Implemented Interfaces:
    java.lang.AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer

    public class BGFXMemory
    extends org.lwjgl.system.Struct
    implements org.lwjgl.system.NativeResource
    Memory must be obtained by calling alloc, copy, or make_ref.

    It is illegal to create this structure on stack and pass it to any bgfx API.

    Member documentation

    • data – pointer to data
    • size – data size

    Layout

    
     struct bgfx_memory_t {
         uint8_t * data;
         uint32_t size;
     }
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  BGFXMemory.Buffer
      An array of BGFXMemory structs.
      • Nested classes/interfaces inherited from interface org.lwjgl.system.Pointer

        org.lwjgl.system.Pointer.Default
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ALIGNOF
      The struct alignment in bytes.
      static int DATA
      SIZE
      The struct member offsets.
      static int SIZEOF
      The struct size in bytes.
      • Fields inherited from interface org.lwjgl.system.Pointer

        BITS32, BITS64, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE
    • Constructor Summary

      Constructors 
      Constructor Description
      BGFXMemory​(java.nio.ByteBuffer container)
      Creates a BGFXMemory instance at the current position of the specified ByteBuffer container.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static BGFXMemory calloc()
      Returns a new BGFXMemory instance allocated with memCalloc.
      static BGFXMemory.Buffer calloc​(int capacity)
      Returns a new BGFXMemory.Buffer instance allocated with memCalloc.
      static BGFXMemory callocStack()
      Returns a new BGFXMemory instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      static BGFXMemory.Buffer callocStack​(int capacity)
      Returns a new BGFXMemory.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      static BGFXMemory.Buffer callocStack​(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new BGFXMemory.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      static BGFXMemory callocStack​(org.lwjgl.system.MemoryStack stack)
      Returns a new BGFXMemory instance allocated on the specified MemoryStack and initializes all its bits to zero.
      static BGFXMemory create()
      Returns a new BGFXMemory instance allocated with BufferUtils.
      static BGFXMemory.Buffer create​(int capacity)
      Returns a new BGFXMemory.Buffer instance allocated with BufferUtils.
      static BGFXMemory create​(long address)
      Returns a new BGFXMemory instance for the specified memory address.
      static BGFXMemory.Buffer create​(long address, int capacity)
      Create a BGFXMemory.Buffer instance at the specified memory.
      static BGFXMemory createSafe​(long address)
      Like create, but returns null if address is NULL.
      static BGFXMemory.Buffer createSafe​(long address, int capacity)
      Like create, but returns null if address is NULL.
      java.nio.ByteBuffer data()
      Returns a ByteBuffer view of the data pointed to by the data field.
      BGFXMemory data​(java.nio.ByteBuffer value)
      Sets the address of the specified ByteBuffer to the data field.
      static BGFXMemory malloc()
      Returns a new BGFXMemory instance allocated with memAlloc.
      static BGFXMemory.Buffer malloc​(int capacity)
      Returns a new BGFXMemory.Buffer instance allocated with memAlloc.
      static BGFXMemory mallocStack()
      Returns a new BGFXMemory instance allocated on the thread-local MemoryStack.
      static BGFXMemory.Buffer mallocStack​(int capacity)
      Returns a new BGFXMemory.Buffer instance allocated on the thread-local MemoryStack.
      static BGFXMemory.Buffer mallocStack​(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new BGFXMemory.Buffer instance allocated on the specified MemoryStack.
      static BGFXMemory mallocStack​(org.lwjgl.system.MemoryStack stack)
      Returns a new BGFXMemory instance allocated on the specified MemoryStack.
      static java.nio.ByteBuffer ndata​(long struct)
      Unsafe version of data.
      static void ndata​(long struct, java.nio.ByteBuffer value)
      Unsafe version of data.
      static int nsize​(long struct)
      Unsafe version of size().
      static void nsize​(long struct, int value)
      Sets the specified value to the size field of the specified struct.
      BGFXMemory set​(BGFXMemory src)
      Copies the specified struct data to this struct.
      int size()
      Returns the value of the size field.
      int sizeof()  
      static void validate​(long struct)
      Validates pointer members that should not be NULL.
      static void validate​(long array, int count)
      Calls validate(long) for each struct contained in the specified struct array.
      • Methods inherited from interface org.lwjgl.system.NativeResource

        close, free
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from class org.lwjgl.system.Pointer.Default

        address, equals, hashCode, toString
      • Methods inherited from class org.lwjgl.system.Struct

        clear, free, isNull
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • DATA, SIZE

        The struct member offsets.
    • Constructor Detail

      • BGFXMemory

        public BGFXMemory​(java.nio.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 Detail

      • sizeof

        public int sizeof()
        Specified by:
        sizeof in class org.lwjgl.system.Struct
      • data

        public java.nio.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​(java.nio.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

        @Nullable
        public static 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

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

        public static BGFXMemory mallocStack()
        Returns a new BGFXMemory instance allocated on the thread-local MemoryStack.
      • callocStack

        public static BGFXMemory callocStack()
        Returns a new BGFXMemory instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

        public static BGFXMemory mallocStack​(org.lwjgl.system.MemoryStack stack)
        Returns a new BGFXMemory instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static BGFXMemory callocStack​(org.lwjgl.system.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
      • mallocStack

        public static BGFXMemory.Buffer mallocStack​(int capacity)
        Returns a new BGFXMemory.Buffer instance allocated on the thread-local MemoryStack.
        Parameters:
        capacity - the buffer capacity
      • callocStack

        public static BGFXMemory.Buffer callocStack​(int capacity)
        Returns a new BGFXMemory.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
        Parameters:
        capacity - the buffer capacity
      • mallocStack

        public static BGFXMemory.Buffer mallocStack​(int capacity,
                                                    org.lwjgl.system.MemoryStack stack)
        Returns a new BGFXMemory.Buffer instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • callocStack

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

        public static java.nio.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,
                                 java.nio.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
      • validate

        public static void validate​(long array,
                                    int count)
        Calls validate(long) for each struct contained in the specified struct array.
        Parameters:
        array - the struct array to validate
        count - the number of structs in array