Class MemoryTools
Inherited Members
Namespace: VIVE.OpenXR
Assembly: VIVE.OpenXR.dll
Syntax
public static class MemoryTools
Methods
CopyFromRawMemory<T>(T[], IntPtr, int)
Copy the raw memory to the array. You should make sure the array has the same size as the raw memory.
Declaration
public static void CopyFromRawMemory<T>(T[] array, IntPtr raw, int count = 0)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The output array. |
IntPtr | raw | The data source in raw memory form. |
int | count | Specify the copy count. Count should be less than array length. |
Type Parameters
Name | Description |
---|---|
T | Convert the memory to this type array. |
CopyToRawMemory<T>(IntPtr, T[])
Make the same size raw buffer from input array. Make sure the raw has enough size.
Declaration
public static void CopyToRawMemory<T>(IntPtr raw, T[] array)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | raw | The output data in raw memory form |
T[] | array | The data source |
Type Parameters
Name | Description |
---|---|
T | Convert this type array to raw memory. |
MakeRawMemory<T>(T[])
Make the same size raw buffer from input array.
Declaration
public static IntPtr MakeRawMemory<T>(T[] refArray)
Parameters
Type | Name | Description |
---|---|---|
T[] | refArray | The data array |
Returns
Type | Description |
---|---|
IntPtr | The memory handle. Should release by ReleaseRawMemory(IntPtr) |
Type Parameters
Name | Description |
---|---|
T | Data type could be primitive type or struct. Should call ReleaseRawMemory(IntPtr) after use. |
ReleaseRawMemory(IntPtr)
Release the raw memory handle which is created by MakeRawMemory<T>(T[])
Declaration
public static void ReleaseRawMemory(IntPtr ptr)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | ptr |
ToIntPtr<T>(T[])
Convert the enum array to IntPtr. Should call ReleaseRawMemory(IntPtr) after use.
Declaration
public static IntPtr ToIntPtr<T>(T[] array) where T : Enum
Parameters
Type | Name | Description |
---|---|---|
T[] | array |
Returns
Type | Description |
---|---|
IntPtr |
Type Parameters
Name | Description |
---|---|
T |