Table of Contents

Interface IUnifiedMemoryBuffer

Namespace
DotCompute.Abstractions
Assembly
DotCompute.Abstractions.dll

Non-generic base interface for memory buffers.

public interface IUnifiedMemoryBuffer : IAsyncDisposable, IDisposable
Inherited Members
Extension Methods

Properties

IsDisposed

Gets whether the buffer has been disposed.

bool IsDisposed { get; }

Property Value

bool

Options

Gets the memory allocation options.

MemoryOptions Options { get; }

Property Value

MemoryOptions

SizeInBytes

Gets the size of the buffer in bytes.

long SizeInBytes { get; }

Property Value

long

State

Gets the current state of the buffer.

BufferState State { get; }

Property Value

BufferState

Methods

CopyFromAsync<T>(ReadOnlyMemory<T>, long, CancellationToken)

Copies data from a source memory into this buffer.

ValueTask CopyFromAsync<T>(ReadOnlyMemory<T> source, long offset = 0, CancellationToken cancellationToken = default) where T : unmanaged

Parameters

source ReadOnlyMemory<T>

The source memory to copy from.

offset long

The offset in bytes where to start copying.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask

A task representing the copy operation.

Type Parameters

T

The element type.

CopyToAsync<T>(Memory<T>, long, CancellationToken)

Copies data from this buffer to a destination memory.

ValueTask CopyToAsync<T>(Memory<T> destination, long offset = 0, CancellationToken cancellationToken = default) where T : unmanaged

Parameters

destination Memory<T>

The destination memory to copy to.

offset long

The offset in bytes where to start copying from.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask

A task representing the copy operation.

Type Parameters

T

The element type.