Skip to content

ArrayBufferFactory(T) Class#

A basic buffer factory that allocates arrays of a given type provided by the generic parameter.

Inheritance Hierarchy#

System.Object
  Basler.Pylon.ArrayBufferFactory(T)

Syntax#

C#

public class ArrayBufferFactory<T> : IBufferFactory

VB

Public Class ArrayBufferFactory(Of T)
    Implements IBufferFactory

Type Parameters#

 

T
The array item value type of the arrays this buffer factory allocates.
  The ArrayBufferFactory(T) type exposes the following members.

Constructors#

NameDescription
Public methodArrayBufferFactory(T) Initializes a new instance of the ArrayBufferFactory(T) class
 

Methods#

NameDescription
Public methodAllocateBuffer Allocates a buffer and provides additional context information.
Public methodFreeBuffer Frees a previously allocated buffer.
 

ArrayBufferFactory(T).AllocateBuffer Method#

Allocates a buffer and provides additional context information.

Syntax#

C#

public virtual void AllocateBuffer(
    long bufferSize,
    ref Object createdPinnedObject,
    ref IntPtr createdPinnedBuffer,
    ref Object bufferUserData
)

VB

Public Overridable Sub AllocateBuffer ( 
    bufferSize As Long,
    ByRef createdPinnedObject As Object,
    ByRef createdPinnedBuffer As IntPtr,
    ByRef bufferUserData As Object
)

Parameters#

 

bufferSize
Type: System.Int64
The size of the buffer in bytes that has to be allocated.
createdPinnedObject
Type: System.Object
Underlying object (e.g., Array of bytes) that is used for providing createdPinnedBuffer. This object is provided when FreeBuffer() is called.
createdPinnedBuffer
Type: System.IntPtr
Return the pointer to the allocated and pinned buffer. This pointer is provided when FreeBuffer() is called.
bufferUserData
Type: System.Object
User data information that belongs to the buffer. This user data information is provided when FreeBuffer() is called. The value can be left unchanged if not needed.

Implements#

IBufferFactory.AllocateBuffer(Int64, Object, IntPtr, Object)

Remarks#

Thread Safety: This method must be thread-safe.

Error Safety: Must throw an exception if the allocation fails.

ArrayBufferFactory(T).FreeBuffer Method#

Frees a previously allocated buffer.

Syntax#

C#

public virtual void FreeBuffer(
    Object createdPinnedObject,
    IntPtr createdPinnedBuffer,
    Object bufferUserData
)

VB

Public Overridable Sub FreeBuffer ( 
    createdPinnedObject As Object,
    createdPinnedBuffer As IntPtr,
    bufferUserData As Object
)

Parameters#

 

createdPinnedObject
Type: System.Object
The pointer to the allocated object. Created by this factory.
createdPinnedBuffer
Type: System.IntPtr
The pointer to the allocated buffer. Created by this factory.
bufferUserData
Type: System.Object
User data information of the buffer returned by AllocateBuffer(Int64, Object, IntPtr, Object).

Implements#

IBufferFactory.FreeBuffer(Object, IntPtr, Object)

Remarks#

Thread Safety: This method must be thread-safe.

Error Safety: Must not throw exceptions.

ArrayBufferFactory(T) Constructor#

Initializes a new instance of the ArrayBufferFactory(T) class

Syntax#

C#

public ArrayBufferFactory()

VB

Public Sub New