# Class VulkanLWJGLTemporaryAllocator

java.lang.Object
com.io7m.jcoronado.lwjgl.VulkanLWJGLTemporaryAllocator

All Implemented Interfaces:
  `VulkanTemporaryAllocatorType`

public final class VulkanLWJGLTemporaryAllocator extends Object implements VulkanTemporaryAllocatorType
An LWJGL based implementation of the `VulkanTemporaryAllocatorType` interface.

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface VulkanTemporaryAllocatorType

  `VulkanTemporaryAllocatorType.ByteBufferMemoryReceiverType<T,E>, VulkanTemporaryAllocatorType.RawMemoryReceiverType<T,E>`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static VulkanTemporaryAllocatorType`
  `create()`
  `<T, E extends Exception>
  T`
  `withAllocation(long size, long alignment, VulkanTemporaryAllocatorType.RawMemoryReceiverType<T,E> receiver)`
  Allocate `size` octets of memory, aligned to `alignment`, pass it to `receiver`, then unconditionally deallocate the memory before returning the value of `T` returned by `receiver`.
  `<T, E extends Exception>
  T`
  `withAllocationBuffer(long size, long alignment, VulkanTemporaryAllocatorType.ByteBufferMemoryReceiverType<T,E> receiver)`
  Allocate `size` octets of memory, aligned to `alignment`, pass it to `receiver`, then unconditionally deallocate the memory before returning the value of `T` returned by `receiver`.
  `<T, E extends Exception>
  T`
  `withAllocationBufferInitialized(byte[] data, long alignment, VulkanTemporaryAllocatorType.ByteBufferMemoryReceiverType<T,E> receiver)`
  Allocate `data.length` octets of memory, aligned to `alignment`, initialize it with the contents of `data`, pass it to `receiver`, then unconditionally deallocate the memory before returning the value of `T` returned by `receiver`.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### create

    public static VulkanTemporaryAllocatorType create()
    Returns:
      A new temporary allocator

  - ### withAllocation

    public <T, E extends Exception> T withAllocation(long size, long alignment, VulkanTemporaryAllocatorType.RawMemoryReceiverType<T,E> receiver) throws VulkanException, E
    Description copied from interface: `VulkanTemporaryAllocatorType`
    Allocate `size` octets of memory, aligned to `alignment`, pass it to `receiver`, then unconditionally deallocate the memory before returning the value of `T` returned by `receiver`.
    Specified by:
      `withAllocation` in interface `VulkanTemporaryAllocatorType`
    Type Parameters:
      `T` - The type of returned values
      `E` - The type of raised exceptions
    Parameters:
      `size` - The size of the memory
      `alignment` - The alignment of the memory
      `receiver` - The receiver of the allocated memory
    Returns:
      The value returned by `receiver`
    Throws:
      `VulkanException` - If `receiver` raises `VulkanException`
      `E` - If `receiver` raises `E`

  - ### withAllocationBuffer

    public <T, E extends Exception> T withAllocationBuffer(long size, long alignment, VulkanTemporaryAllocatorType.ByteBufferMemoryReceiverType<T,E> receiver) throws VulkanException, E
    Description copied from interface: `VulkanTemporaryAllocatorType`
    Allocate `size` octets of memory, aligned to `alignment`, pass it to `receiver`, then unconditionally deallocate the memory before returning the value of `T` returned by `receiver`.
    Specified by:
      `withAllocationBuffer` in interface `VulkanTemporaryAllocatorType`
    Type Parameters:
      `T` - The type of returned values
      `E` - The type of raised exceptions
    Parameters:
      `size` - The size of the memory
      `alignment` - The alignment of the memory
      `receiver` - The receiver of the allocated memory
    Returns:
      The value returned by `receiver`
    Throws:
      `VulkanException` - If `receiver` raises `VulkanException`
      `E` - If `receiver` raises `E`

  - ### withAllocationBufferInitialized

    public <T, E extends Exception> T withAllocationBufferInitialized(byte[] data, long alignment, VulkanTemporaryAllocatorType.ByteBufferMemoryReceiverType<T,E> receiver) throws VulkanException, E
    Description copied from interface: `VulkanTemporaryAllocatorType`
    Allocate `data.length` octets of memory, aligned to `alignment`, initialize it with the contents of `data`, pass it to `receiver`, then unconditionally deallocate the memory before returning the value of `T` returned by `receiver`.
    Specified by:
      `withAllocationBufferInitialized` in interface `VulkanTemporaryAllocatorType`
    Type Parameters:
      `T` - The type of returned values
      `E` - The type of raised exceptions
    Parameters:
      `data` - The initial contents of the memory
      `alignment` - The alignment of the memory
      `receiver` - The receiver of the allocated memory
    Returns:
      The value returned by `receiver`
    Throws:
      `VulkanException` - If `receiver` raises `VulkanException`
      `E` - If `receiver` raises `E`