CVB++ 15.0
RingBuffer Class Reference

Ring buffer operations on a device. More...

#include <cvb/driver/ring_buffer.hpp>

Inherits enable_shared_from_this< RingBuffer >.

Public Member Functions

DevicePtr Parent () const noexcept
 Gets the parent device of this ring buffer. More...
 
RingBufferImagePtr At (int bufferIndex) const
 Access to a single ring buffer image specified by its buffer index. More...
 
int Count () const noexcept
 Number of buffers in the ring buffer. More...
 
RingBufferLockMode LockMode () const noexcept
 Gets the current lock mode. More...
 
void SetLockMode (RingBufferLockMode ringBufferLockMode)
 Sets the current lock mode. More...
 
void ChangeCount (int numBuffers, DeviceUpdateMode mode)
 Changes the number of buffers in this ring buffer. More...
 

Detailed Description

Ring buffer operations on a device.

Member Function Documentation

◆ At()

RingBufferImagePtr At ( int  bufferIndex) const
inline

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

Parameters
[in]bufferIndexImage index of the ring buffer image to access.
Returns
A pointer to the requested image.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ ChangeCount()

void ChangeCount ( int  numBuffers,
DeviceUpdateMode  mode 
)
inline

Changes the number of buffers in this ring buffer.

Parameters
[in]numBuffersNew number of buffers in the ring buffer.
[in]modeDefines how to handle device images.
Exceptions
Anyexception derived from std::exception including CvbException.

If you are unsure about the mode, simply use DeviceUpdateMode::UpdateDeviceImage.

Attention
Calling ChangeCount in DeviceUpdateMode::UpdateDeviceImage mode will discared all buffers with which the device was created with and free the memory ONLY if no NotifyObservablePtr are held.

◆ Count()

int Count ( ) const
inlinenoexcept

Number of buffers in the ring buffer.

Returns
Number of buffers.
Exceptions
Doesnot throw any exception.

◆ LockMode()

RingBufferLockMode LockMode ( ) const
inlinenoexcept

Gets the current lock mode.

Returns
The current lock mode.
Exceptions
Doesnot throw any exception.

◆ Parent()

DevicePtr Parent ( ) const
inlinenoexcept

Gets the parent device of this ring buffer.

Returns
The parent device pointer.
Exceptions
Doesnot throw any exception.

◆ SetLockMode()

void SetLockMode ( RingBufferLockMode  ringBufferLockMode)
inline

Sets the current lock mode.

Parameters
[in]ringBufferLockModeThe new lock mode.
Exceptions
Anyexception derived from std::exception including CvbException.