Class NkMemoryStatus

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class NkMemoryStatus extends Struct<NkMemoryStatus> implements NativeResource

 struct nk_memory_status {
     void * memory;
     unsigned int type;
     nk_size size;
     nk_size allocated;
     nk_size needed;
     nk_size calls;
 }
  • Field Details

    • SIZEOF

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

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

      public static final int MEMORY
      The struct member offsets.
    • TYPE

      public static final int TYPE
      The struct member offsets.
    • SIZE

      public static final int SIZE
      The struct member offsets.
    • ALLOCATED

      public static final int ALLOCATED
      The struct member offsets.
    • NEEDED

      public static final int NEEDED
      The struct member offsets.
    • CALLS

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

    • NkMemoryStatus

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

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

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

      public long size()
      Returns:
      the value of the size field.
    • allocated

      public long allocated()
      Returns:
      the value of the allocated field.
    • needed

      public long needed()
      Returns:
      the value of the needed field.
    • calls

      public long calls()
      Returns:
      the value of the calls field.
    • malloc

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

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

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

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

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

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

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

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

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

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

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

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

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

      public static NkMemoryStatus.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new NkMemoryStatus.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
    • nmemory

      public static ByteBuffer nmemory(long struct)
      Unsafe version of memory.
    • ntype

      public static int ntype(long struct)
      Unsafe version of type().
    • nsize

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

      public static long nallocated(long struct)
      Unsafe version of allocated().
    • nneeded

      public static long nneeded(long struct)
      Unsafe version of needed().
    • ncalls

      public static long ncalls(long struct)
      Unsafe version of calls().