pub struct CircularBuffer { /* private fields */ }Expand description
Circular buffer state for pre/post-trigger capture.
Implementations§
Source§impl CircularBuffer
impl CircularBuffer
pub fn new( pre_count: usize, post_count: usize, condition: TriggerCondition, ) -> Self
Sourcepub fn set_preset_trigger_count(&mut self, count: usize)
pub fn set_preset_trigger_count(&mut self, count: usize)
Set the preset trigger count (0 = unlimited).
Sourcepub fn trigger_count(&self) -> usize
pub fn trigger_count(&self) -> usize
C actualTriggerCount — the number of completed capture sequences.
Reads one less than the number of triggers fired while a flush is still
in progress; C only increments it at the end of the sequence.
Sourcepub fn status(&self) -> BufferStatus
pub fn status(&self) -> BufferStatus
Get the current buffer status.
Sourcepub fn set_flush_on_soft_trigger(&mut self, flush_on: i32)
pub fn set_flush_on_soft_trigger(&mut self, flush_on: i32)
Store NDCircBuffFlushOnSoftTrig as written (C setIntegerParam); the
value is interpreted only by Self::flushes_on_soft_trigger.
Sourcepub fn flushes_on_soft_trigger(&self) -> bool
pub fn flushes_on_soft_trigger(&self) -> bool
C NDPluginCircularBuff.cpp:276 — if (flushOn > 0) flushPreBuffer().
The ONLY reader of flush_on_soft_trigger: negative and zero both mean
“do not flush”, so a caput FlushOnSoftTrig -1 leaves the pre-buffer to
drain lazily with the first post-trigger frame, as in C.
Sourcepub fn start(&mut self)
pub fn start(&mut self)
C writeInt32(NDCircBuffControl, 1) (NDPluginCircularBuff.cpp:233-254):
rebuild the ring, drop the trigger state, zero the counters, and turn
acquisition on. The only way Self::push starts admitting frames.
Sourcepub fn stop(&mut self)
pub fn stop(&mut self)
C writeInt32(NDCircBuffControl, 0) (NDPluginCircularBuff.cpp:255-260):
acquisition off. C clears the trigger latches and the displayed image
count but leaves the ring alone, so a restart is a fresh start().
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
C scopeControl — is the plugin acquiring? The single gate on admitting
a frame, and the same test C’s writeInt32(NDCircBuffPreTrigger) uses to
reject a pre-count change (:281-283).
Sourcepub fn push(&mut self, array: Arc<NDArray>) -> PushResult
pub fn push(&mut self, array: Arc<NDArray>) -> PushResult
Push an array into the circular buffer.
Mirrors C++ NDPluginCircularBuff::processCallbacks: on the frame that
triggers, the pre-buffer is flushed immediately and the triggering
frame is forwarded as the first post-trigger frame; each subsequent
post-trigger frame is forwarded individually. The returned
PushResult::forward holds the frames to send downstream this call.
Sourcepub fn take_captured(&mut self) -> Vec<Arc<NDArray>>
pub fn take_captured(&mut self) -> Vec<Arc<NDArray>>
Take the captured arrays (pre + post trigger).
pub fn is_triggered(&self) -> bool
pub fn pre_buffer_len(&self) -> usize
Auto Trait Implementations§
impl !RefUnwindSafe for CircularBuffer
impl !UnwindSafe for CircularBuffer
impl Freeze for CircularBuffer
impl Send for CircularBuffer
impl Sync for CircularBuffer
impl Unpin for CircularBuffer
impl UnsafeUnpin for CircularBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more