/** * Create a {@link AIBone.Buffer} instance at the specified memory. * * @param address the memory address * @param capacity the buffer capacity */ public static AIBone.Buffer create(long address, int capacity) { return wrap(Buffer.class, address, capacity); }
/** Returns a new {@link AIBone} instance for the specified memory address. */ public static AIBone create(long address) { return wrap(AIBone.class, address); }
/** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */ @Nullable public static AIBone createSafe(long address) { return address == NULL ? null : wrap(AIBone.class, address); }
/** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */ @Nullable public static AIBone.Buffer createSafe(long address, int capacity) { return address == NULL ? null : wrap(Buffer.class, address, capacity); }
/** * Returns a new {@link AIBone.Buffer} instance allocated on the specified {@link MemoryStack}. * * @param stack the stack from which to allocate * @param capacity the buffer capacity */ public static AIBone.Buffer mallocStack(int capacity, MemoryStack stack) { return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity); }
/** * Returns a new {@link AIBone.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. * * @param capacity the buffer capacity */ public static AIBone.Buffer calloc(int capacity) { return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity); }
/** * Returns a new {@link AIBone} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. * * @param stack the stack from which to allocate */ public static AIBone callocStack(MemoryStack stack) { return wrap(AIBone.class, stack.ncalloc(ALIGNOF, 1, SIZEOF)); }
/** * Returns a new {@link AIBone} instance allocated on the specified {@link MemoryStack}. * * @param stack the stack from which to allocate */ public static AIBone mallocStack(MemoryStack stack) { return wrap(AIBone.class, stack.nmalloc(ALIGNOF, SIZEOF)); }
/** Returns a new {@link AIBone} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */ public static AIBone calloc() { return wrap(AIBone.class, nmemCallocChecked(1, SIZEOF)); }
/** * Returns a new {@link AIBone.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. * * @param stack the stack from which to allocate * @param capacity the buffer capacity */ public static AIBone.Buffer callocStack(int capacity, MemoryStack stack) { return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity); }
/** Returns a new {@link AIBone} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */ public static AIBone malloc() { return wrap(AIBone.class, nmemAllocChecked(SIZEOF)); }
/** * Returns a new {@link AIBone.Buffer} instance allocated with {@link BufferUtils}. * * @param capacity the buffer capacity */ public static AIBone.Buffer create(int capacity) { ByteBuffer container = __create(capacity, SIZEOF); return wrap(Buffer.class, memAddress(container), capacity, container); }
/** * Returns a new {@link AIBone.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. * * @param capacity the buffer capacity */ public static AIBone.Buffer malloc(int capacity) { return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity); }
/** Returns a new {@link AIBone} instance allocated with {@link BufferUtils}. */ public static AIBone create() { ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF); return wrap(AIBone.class, memAddress(container), container); }