holoscan::DataLoggerQueue

Beta
View as Markdown
template <typename T>
class DataLoggerQueue

Abstract base class for data logger queues.

This interface allows different queue implementations to be used by AsyncDataLoggerResource, enabling trade-offs between performance and ordering guarantees.

All implementations must be thread-safe for concurrent access from multiple producers and a single consumer (MPSC - Multiple Producer Single Consumer).

#include <holoscan/data_logger_queue.hpp>

Template parameters

T
typename

The type of elements stored in the queue (typically DataEntry)


Constructors

Destructor

~DataLoggerQueue

virtual holoscan::DataLoggerQueue<T>::~DataLoggerQueue() = defaultvirtual holoscan::DataLoggerQueue<T>::~DataLoggerQueue() = default

Methods

try_enqueue

virtual bool holoscan::DataLoggerQueue<T>::try_enqueue(
T &&item
)

Attempt to enqueue an item (thread-safe).

Returns: true if successfully enqueued, false if queue is full

Parameters

item
T &&

The item to enqueue (will be moved)

try_dequeue

virtual bool holoscan::DataLoggerQueue<T>::try_dequeue(
T &item
)

Attempt to dequeue an item (thread-safe).

Returns: true if an item was dequeued, false if queue is empty

Parameters

item
T &

Output parameter where the dequeued item will be moved

size_approx

virtual size_t holoscan::DataLoggerQueue<T>::size_approx() const

Get size of the queue (thread-safe).

Note: The accuracy of this value depends on the implementation:

  • LockFreeQueue: Returns an approximation that may be stale by the time it’s returned
  • OrderedQueue: Returns the exact size at the moment the mutex was acquired

Returns: Number of items in the queue (approximation or exact, depending on implementation)