- java.lang.Object
-
- com.io7m.jcoronado.vma.VMAAllocationInfo
-
- All Implemented Interfaces:
VMAAllocationInfoType
public final class VMAAllocationInfo extends java.lang.Object implements VMAAllocationInfoType
Information about an allocation. This is an immutable snapshot of an allocation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VMAAllocationInfo.Builder
Builds instances of typeVMAAllocationInfo
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static VMAAllocationInfo.Builder
builder()
Creates a builder forVMAAllocationInfo
.static VMAAllocationInfo
copyOf(VMAAllocationInfoType instance)
Creates an immutable copy of aVMAAllocationInfoType
value.java.util.Optional<VulkanDeviceMemoryType>
deviceMemory()
boolean
equals(java.lang.Object another)
This instance is equal to all instances ofVMAAllocationInfo
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:memoryType
,deviceMemory
,offset
,size
.long
memoryType()
static VMAAllocationInfo
of(long memoryType, java.util.Optional<? extends VulkanDeviceMemoryType> deviceMemory, long offset, long size)
Construct a new immutableVMAAllocationInfo
instance.long
offset()
long
size()
java.lang.String
toString()
Prints the immutable valueVMAAllocationInfo
with attribute values.VMAAllocationInfo
withDeviceMemory(VulkanDeviceMemoryType value)
Copy the current immutable object by setting a present value for the optionaldeviceMemory
attribute.VMAAllocationInfo
withDeviceMemory(java.util.Optional<? extends VulkanDeviceMemoryType> optional)
Copy the current immutable object by setting an optional value for thedeviceMemory
attribute.VMAAllocationInfo
withMemoryType(long value)
Copy the current immutable object by setting a value for thememoryType
attribute.VMAAllocationInfo
withOffset(long value)
Copy the current immutable object by setting a value for theoffset
attribute.VMAAllocationInfo
withSize(long value)
Copy the current immutable object by setting a value for thesize
attribute.
-
-
-
Method Detail
-
memoryType
public long memoryType()
- Specified by:
memoryType
in interfaceVMAAllocationInfoType
- Returns:
- The memory type index that this allocation was allocated from.
-
deviceMemory
public java.util.Optional<VulkanDeviceMemoryType> deviceMemory()
- Specified by:
deviceMemory
in interfaceVMAAllocationInfoType
- Returns:
- A handle to the Vulkan memory object. Same memory object can be shared by multiple allocations. It can change after call to vmaDefragment() if this allocation is passed to the function, or if allocation is lost. If the allocation is lost, it is equal to `VK_NULL_HANDLE`.
-
offset
public long offset()
- Specified by:
offset
in interfaceVMAAllocationInfoType
- Returns:
- The offset into the device memory object to the beginning of this allocation, in bytes. (deviceMemory, offset) pair is unique to this allocation. It can change after call to vmaDefragment() if this allocation is passed to the function, or if allocation is lost.
-
size
public long size()
- Specified by:
size
in interfaceVMAAllocationInfoType
- Returns:
- The size of this allocation, in bytes. It never changes, unless allocation is lost.
-
withMemoryType
public final VMAAllocationInfo withMemoryType(long value)
Copy the current immutable object by setting a value for thememoryType
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for memoryType- Returns:
- A modified copy of the
this
object
-
withDeviceMemory
public final VMAAllocationInfo withDeviceMemory(VulkanDeviceMemoryType value)
Copy the current immutable object by setting a present value for the optionaldeviceMemory
attribute.- Parameters:
value
- The value for deviceMemory- Returns:
- A modified copy of
this
object
-
withDeviceMemory
public final VMAAllocationInfo withDeviceMemory(java.util.Optional<? extends VulkanDeviceMemoryType> optional)
Copy the current immutable object by setting an optional value for thedeviceMemory
attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for deviceMemory- Returns:
- A modified copy of
this
object
-
withOffset
public final VMAAllocationInfo withOffset(long value)
Copy the current immutable object by setting a value for theoffset
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for offset- Returns:
- A modified copy of the
this
object
-
withSize
public final VMAAllocationInfo withSize(long value)
Copy the current immutable object by setting a value for thesize
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for size- Returns:
- A modified copy of the
this
object
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofVMAAllocationInfo
that have equal attribute values.- Overrides:
equals
in classjava.lang.Object
- Returns:
true
ifthis
is equal toanother
instance
-
hashCode
public int hashCode()
Computes a hash code from attributes:memoryType
,deviceMemory
,offset
,size
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueVMAAllocationInfo
with attribute values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of the value
-
of
public static VMAAllocationInfo of(long memoryType, java.util.Optional<? extends VulkanDeviceMemoryType> deviceMemory, long offset, long size)
Construct a new immutableVMAAllocationInfo
instance.- Parameters:
memoryType
- The value for thememoryType
attributedeviceMemory
- The value for thedeviceMemory
attributeoffset
- The value for theoffset
attributesize
- The value for thesize
attribute- Returns:
- An immutable VMAAllocationInfo instance
-
copyOf
public static VMAAllocationInfo copyOf(VMAAllocationInfoType instance)
Creates an immutable copy of aVMAAllocationInfoType
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable VMAAllocationInfo instance
-
builder
public static VMAAllocationInfo.Builder builder()
Creates a builder forVMAAllocationInfo
.- Returns:
- A new VMAAllocationInfo builder
-
-