livox_mid360_core
C++ driver library for the Livox Mid-360 LiDAR
Loading...
Searching...
No Matches
livox::mid360::BoundedQueue< T > Class Template Reference

Bounded single-producer / multi-consumer queue for handing Frames or ImuData from the receive thread to any other thread. More...

#include <livox/mid360/frame.hpp>

Public Member Functions

 BoundedQueue (std::size_t capacity=8)
 An empty, open queue that holds at most capacity items.
void push (T &&item)
 Producer side (receive thread). Never blocks.
std::optional< T > pop (std::chrono::nanoseconds timeout)
 Consumer side. Empty after timeout or once closed and drained.
std::optional< T > try_pop ()
 Consumer side without waiting. Empty when nothing is queued.
void close ()
 Wakes every waiting pop(); later pushes are ignored, queued items can still be popped.
std::uint64_t dropped () const
 Items discarded by overflow so far.
std::size_t size () const
 Items currently queued.
std::size_t capacity () const noexcept
 Maximum number of queued items, as passed to the constructor.

Detailed Description

template<class T>
class livox::mid360::BoundedQueue< T >

Bounded single-producer / multi-consumer queue for handing Frames or ImuData from the receive thread to any other thread.

Overflow drops the OLDEST element (newest data wins) and counts it in dropped(). Not part of Device: connect it yourself, e.g.

device.on_frame([&](Frame && f) { q.push(std::move(f)); });
void push(T &&item)
Producer side (receive thread). Never blocks.
Definition frame.hpp:123
BoundedQueue(std::size_t capacity=8)
An empty, open queue that holds at most capacity items.
Definition frame.hpp:120
A group of points closed by FramePolicy. Owns its storage; delivered by value.
Definition frame.hpp:63

The documentation for this class was generated from the following file: