CVB.Net 14.0
RingBuffer Class Reference

RingBuffer operations on a Device. More...

Inherits DeviceInterfaceBase, and IRingBuffer.

Public Member Functions

 RingBuffer (Device device)
 Creates a RingBuffer object from the given device . More...
 
void Dispose ()
 Disposes this ring buffer.
 
int[] GetAcquisitionSequence ()
 Creates the acquisition sequence in acquisition order. More...
 
void ChangeCount (int numBuffers, DeviceUpdateMode mode)
 Changes the number of buffers in this ring buffer. More...
 
IEnumerator< RingBufferImageGetEnumerator ()
 Gets the typed enumerator iterating all available images. More...
 
- Public Member Functions inherited from DeviceInterfaceBase
 DeviceInterfaceBase (Device device)
 Ctor. More...
 
int[] GetAcquisitionSequence ()
 Gets the sequence of ring buffer images in the order they were acquired. More...
 
void ChangeCount (int numBuffers, DeviceUpdateMode mode)
 Sets a new ring buffer size in the acquisition engine. More...
 

Protected Member Functions

virtual void Dispose (bool disposing)
 Dispose implementation with disposing flag. More...
 

Package Functions

void ResetBufferImageCache (WeakReference[] bufferImages)
 Resets the .Net cached images of this ring buffer and with that updates the memory pressure. More...
 

Static Package Functions

static RingBufferLockMode LockModeFromHandle (IntPtr handle)
 Gets the lock moder for the given native handle . More...
 

Properties

int Count [get]
 Number of buffers in the ring buffer.
 
RingBufferImage this[int bufferIndex] [get]
 Access to a single ring buffer image specified by its bufferIndex . More...
 
RingBufferLockMode LockMode [get, set]
 Gets/sets the current lock mode.
 
- Properties inherited from DeviceInterfaceBase
Device Parent [get]
 The Device this interface works on.
 
- Properties inherited from IDeviceInterface
Device Parent [get]
 The Device this interface works on.
 
- Properties inherited from IRingBuffer
int Count [get]
 Gets the number of buffers in this ring buffer.
 
RingBufferLockMode LockMode [get, set]
 Gets/sets the current lock mode.
 
RingBufferImage this[int bufferIndex] [get]
 Gets the ring buffer image at the given bufferIndex . More...
 

Detailed Description

RingBuffer operations on a Device.

Constructor & Destructor Documentation

◆ RingBuffer()

RingBuffer ( Device  device)

Creates a RingBuffer object from the given device .

Parameters
deviceParent device.

Member Function Documentation

◆ ChangeCount()

void ChangeCount ( int  numBuffers,
DeviceUpdateMode  mode 
)

Changes the number of buffers in this ring buffer.

If you are unsure about the mode , simply use DeviceUpdateMode.UpdateDeviceImage. If you use this, all RingBufferImages are disposed/unlocked.

Parameters
numBuffersNew number of buffers in the ring buffer.
modeDefines how to handle device images.

Implements IRingBuffer.

◆ Dispose()

virtual void Dispose ( bool  disposing)
protectedvirtual

Dispose implementation with disposing flag.

Parameters
disposingtrue if called from IDisposable interface; false if called from finalizer.

◆ GetAcquisitionSequence()

int[] GetAcquisitionSequence ( )

Creates the acquisition sequence in acquisition order.

Returns
First entry is the oldest.

Implements IRingBuffer.

◆ GetEnumerator()

IEnumerator< RingBufferImage > GetEnumerator ( )

Gets the typed enumerator iterating all available images.

Returns
Typed iterator.

◆ LockModeFromHandle()

static RingBufferLockMode LockModeFromHandle ( IntPtr  handle)
staticpackage

Gets the lock moder for the given native handle .

Parameters
handleNative device (image) handle to query.
Returns
The lock mode.

◆ ResetBufferImageCache()

void ResetBufferImageCache ( WeakReference[]  bufferImages)
package

Resets the .Net cached images of this ring buffer and with that updates the memory pressure.

Parameters
bufferImagesThe new (empty array) of weak references to ring buffer images.

Property Documentation

◆ this[int bufferIndex]

RingBufferImage this[int bufferIndex]
get

Access to a single ring buffer image specified by its bufferIndex .

The ring buffer images are stored as weak references and are recreated if finalized or disposed. But this also means there is at most one ring buffer image available for one buffer index.

Parameters
bufferIndexImage index of the ring buffer image to access.
Returns
The image at bufferIndex .

Implements IRingBuffer.