Struct UnmanagedMemoryBlock<T>
public struct UnmanagedMemoryBlock<T> : IUnmanagedMemoryBlock, IMemoryBlock<T>, IMemoryBlock, IEnumerable<T>, IEnumerable, IEquatable<UnmanagedMemoryBlock<T>>, ICloneable where T : unmanaged
Type Parameters
T
- Implements
-
IMemoryBlock<T>IEnumerable<T>
- Inherited Members
- Extension Methods
Constructors
UnmanagedMemoryBlock(long)
public UnmanagedMemoryBlock(long count)
Parameters
countlongThe length in objects of
Tand not in bytes.
Remarks
Does claim ownership since allocation is publicly.
UnmanagedMemoryBlock(long, T)
public UnmanagedMemoryBlock(long count, T fill)
Parameters
countlongThe length in objects of
Tand not in bytes.fillT
UnmanagedMemoryBlock(GCHandle, long)
Construct with externally allocated memory settings this memory block as owner.
public UnmanagedMemoryBlock(GCHandle handle, long count)
Parameters
Remarks
Does claim ownership.
UnmanagedMemoryBlock(GCHandle, long, Action)
Construct with externally allocated memory and a custom dispose function.
public UnmanagedMemoryBlock(GCHandle handle, long count, Action dispose)
Parameters
Remarks
Does claim ownership.
UnmanagedMemoryBlock(T*, long)
Construct as a wrapper around pointer and given length without claiming ownership.
public UnmanagedMemoryBlock(T* ptr, long count)
Parameters
ptrT*countlongThe length in objects of
Tand not in bytes.
Remarks
Does claim ownership.
UnmanagedMemoryBlock(T*, long, Action)
Construct with externally allocated memory and a custom dispose function.
public UnmanagedMemoryBlock(T* start, long count, Action dispose)
Parameters
Remarks
Does claim ownership.
Fields
Address
public readonly T* Address
Field Value
- T*
BytesCount
public readonly long BytesCount
Field Value
Count
public readonly long Count
Field Value
Properties
this[int]
public T this[int index] { get; set; }
Parameters
indexint
Property Value
- T
Methods
Clone()
Performs a copy to this memory block.
public UnmanagedMemoryBlock<T> Clone()
Returns
Contains(T)
public bool Contains(T item)
Parameters
itemT
Returns
Copy(UnmanagedMemoryBlock<T>)
public static UnmanagedMemoryBlock<T> Copy(UnmanagedMemoryBlock<T> source)
Parameters
sourceUnmanagedMemoryBlock<T>
Returns
Copy(nint, int)
public static UnmanagedMemoryBlock<T> Copy(nint address, int count)
Parameters
Returns
Copy(void*, int)
public static UnmanagedMemoryBlock<T> Copy(void* address, int count)
Parameters
Returns
Copy(T*, int)
public static UnmanagedMemoryBlock<T> Copy(T* address, int count)
Parameters
addressT*The address of the first
TcountintHow many
Tto copy, not how many bytes.
Returns
CopyTo(UnmanagedMemoryBlock<T>, long)
public void CopyTo(UnmanagedMemoryBlock<T> memoryBlock, long arrayIndex)
Parameters
memoryBlockUnmanagedMemoryBlock<T>arrayIndexlong
CopyTo(Array, int)
Copies the elements of the ICollection to an Array, starting at a particular Array index.
public void CopyTo(Array array, int arrayIndex)
Parameters
arrayArrayThe one-dimensional Array that is the destination of the elements copied from ICollection. The Array must have zero-based indexing.
arrayIndexintThe zero-based index in
arrayat which copying begins.
Exceptions
- ArgumentNullException
arrayis null.- ArgumentOutOfRangeException
arrayIndexis less than zero.- ArgumentException
arrayis multidimensional.-or- The number of elements in the source ICollection is greater than the available space fromarrayIndexto the end of the destinationarray.-or-The type of the source ICollection cannot be cast automatically to the type of the destinationarray.
CopyTo(T*, long, long)
public void CopyTo(T* array, long arrayIndex, long lengthToCopy)
Parameters
CopyTo(T[], int)
public void CopyTo(T[] array, int arrayIndex)
Parameters
arrayT[]arrayIndexint
Equals(UnmanagedMemoryBlock<T>)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(UnmanagedMemoryBlock<T> other)
Parameters
otherUnmanagedMemoryBlock<T>An object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
Fill(T)
Fills the contents of this span with the given value.
public void Fill(T value)
Parameters
valueT
Fill(T, long, long)
Fills the contents of this span with the given value.
public void Fill(T value, long offset, long count)
Parameters
Free()
public void Free()
FromArray(T[,,,,,,,,,,,,,,,])
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,,,,,,,,] arr)
Parameters
arrT[,,,,,,,,,,,,,,,]
Returns
FromArray(T[,,,,,,,,,,,,,,,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,,,,,,,,] arr, bool copy)
Parameters
arrT[,,,,,,,,,,,,,,,]copybool
Returns
FromArray(T[,,,,,,,,,,,,,,])
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,,,,,,,] arr)
Parameters
arrT[,,,,,,,,,,,,,,]
Returns
FromArray(T[,,,,,,,,,,,,,,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,,,,,,,] arr, bool copy)
Parameters
arrT[,,,,,,,,,,,,,,]copybool
Returns
FromArray(T[,,,,,,,,,,,,,])
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,,,,,,] arr)
Parameters
arrT[,,,,,,,,,,,,,]
Returns
FromArray(T[,,,,,,,,,,,,,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,,,,,,] arr, bool copy)
Parameters
arrT[,,,,,,,,,,,,,]copybool
Returns
FromArray(T[,,,,,,,,,,,,])
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,,,,,] arr)
Parameters
arrT[,,,,,,,,,,,,]
Returns
FromArray(T[,,,,,,,,,,,,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,,,,,] arr, bool copy)
Parameters
arrT[,,,,,,,,,,,,]copybool
Returns
FromArray(T[,,,,,,,,,,,])
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,,,,] arr)
Parameters
arrT[,,,,,,,,,,,]
Returns
FromArray(T[,,,,,,,,,,,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,,,,] arr, bool copy)
Parameters
arrT[,,,,,,,,,,,]copybool
Returns
FromArray(T[,,,,,,,,,,])
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,,,] arr)
Parameters
arrT[,,,,,,,,,,]
Returns
FromArray(T[,,,,,,,,,,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,,,] arr, bool copy)
Parameters
arrT[,,,,,,,,,,]copybool
Returns
FromArray(T[,,,,,,,,,])
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,,] arr)
Parameters
arrT[,,,,,,,,,]
Returns
FromArray(T[,,,,,,,,,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,,] arr, bool copy)
Parameters
arrT[,,,,,,,,,]copybool
Returns
FromArray(T[,,,,,,,,])
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,] arr)
Parameters
arrT[,,,,,,,,]
Returns
FromArray(T[,,,,,,,,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,,] arr, bool copy)
Parameters
arrT[,,,,,,,,]copybool
Returns
FromArray(T[,,,,,,,])
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,] arr)
Parameters
arrT[,,,,,,,]
Returns
FromArray(T[,,,,,,,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,,] arr, bool copy)
Parameters
arrT[,,,,,,,]copybool
Returns
FromArray(T[,,,,,,])
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,] arr)
Parameters
arrT[,,,,,,]
Returns
FromArray(T[,,,,,,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,,] arr, bool copy)
Parameters
arrT[,,,,,,]copybool
Returns
FromArray(T[,,,,,])
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,] arr)
Parameters
arrT[,,,,,]
Returns
FromArray(T[,,,,,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,,] arr, bool copy)
Parameters
arrT[,,,,,]copybool
Returns
FromArray(T[,,,,])
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,] arr)
Parameters
arrT[,,,,]
Returns
FromArray(T[,,,,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,,,,] arr, bool copy)
Parameters
arrT[,,,,]copybool
Returns
FromArray(T[,,,])
public static UnmanagedMemoryBlock<T> FromArray(T[,,,] arr)
Parameters
arrT[,,,]
Returns
FromArray(T[,,,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,,,] arr, bool copy)
Parameters
arrT[,,,]copybool
Returns
FromArray(T[,,])
public static UnmanagedMemoryBlock<T> FromArray(T[,,] arr)
Parameters
arrT[,,]
Returns
FromArray(T[,,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,,] arr, bool copy)
Parameters
arrT[,,]copybool
Returns
FromArray(T[,])
public static UnmanagedMemoryBlock<T> FromArray(T[,] arr)
Parameters
arrT[,]
Returns
FromArray(T[,], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[,] arr, bool copy)
Parameters
arrT[,]copybool
Returns
FromArray(T[])
public static UnmanagedMemoryBlock<T> FromArray(T[] arr)
Parameters
arrT[]
Returns
FromArray(T[], bool)
public static UnmanagedMemoryBlock<T> FromArray(T[] arr, bool copy)
Parameters
arrT[]copybool
Returns
FromBuffer(byte[])
public static UnmanagedMemoryBlock<T> FromBuffer(byte[] arr)
Parameters
arrbyte[]
Returns
FromBuffer(byte[], bool)
public static UnmanagedMemoryBlock<T> FromBuffer(byte[] arr, bool copy)
Parameters
Returns
FromPool(StackedMemoryPool)
public static UnmanagedMemoryBlock<T> FromPool(StackedMemoryPool manager)
Parameters
managerStackedMemoryPool
Returns
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<T> GetEnumerator()
Returns
- IEnumerator<T>
An enumerator that can be used to iterate through the collection.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
GetIndex(int)
public T GetIndex(int index)
Parameters
indexint
Returns
- T
GetIndex(long)
public T GetIndex(long index)
Parameters
indexlong
Returns
- T
GetRefTo(int)
public ref T GetRefTo(int index)
Parameters
indexint
Returns
- T
GetRefTo(long)
public ref T GetRefTo(long index)
Parameters
indexlong
Returns
- T
Reallocate(long, bool)
public void Reallocate(long length, bool copyOldValues = false)
Parameters
Reallocate(long, T, bool)
public void Reallocate(long length, T fill, bool copyOldValues = false)
Parameters
SetIndex(int, T)
public void SetIndex(int index, T value)
Parameters
indexintvalueT
SetIndex(int, ref T)
public void SetIndex(int index, ref T value)
Parameters
indexintvalueT
SetIndex(long, T)
public void SetIndex(long index, T value)
Parameters
indexlongvalueT
SetIndex(long, ref T)
public void SetIndex(long index, ref T value)
Parameters
indexlongvalueT
Operators
operator ==(UnmanagedMemoryBlock<T>, UnmanagedMemoryBlock<T>)
Returns a value that indicates whether the values of two NumSharp.Backends.Unmanaged.UnmanagedArray`1 objects are equal.
public static bool operator ==(UnmanagedMemoryBlock<T> left, UnmanagedMemoryBlock<T> right)
Parameters
leftUnmanagedMemoryBlock<T>The first value to compare.
rightUnmanagedMemoryBlock<T>The second value to compare.
Returns
- bool
true if the
leftandrightparameters have the same value; otherwise, false.
operator !=(UnmanagedMemoryBlock<T>, UnmanagedMemoryBlock<T>)
Returns a value that indicates whether two NumSharp.Backends.Unmanaged.UnmanagedArray`1 objects have different values.
public static bool operator !=(UnmanagedMemoryBlock<T> left, UnmanagedMemoryBlock<T> right)
Parameters
leftUnmanagedMemoryBlock<T>The first value to compare.
rightUnmanagedMemoryBlock<T>The second value to compare.
Returns
- bool
true if
leftandrightare not equal; otherwise, false.