docs/html/classRingBuffer.html
| | Jetson Inference
DNN Vision Library |
Public Types | Public Member Functions | Protected Attributes | List of all members
RingBuffer Class Reference Utilities Library (jetson-utils) » Multithreading
Thread-safe circular ring buffer queue. More...
#include <RingBuffer.h>
|
|
| enum | Flags {
Read = (1 << 0), ReadOnce = (1 << 1) | Read, ReadLatest = (1 << 2) | Read, ReadLatestOnce = (1 << 3) | ReadLatest,
Write = (1 << 4), Threaded = (1 << 5), ZeroCopy = (1 << 6)
} |
| | Ring buffer flags. More...
|
| |
|
|
| | RingBuffer (uint32_t flags=Threaded) |
| | Construct a new ring buffer. More...
|
| |
| | ~RingBuffer () |
| | Destructor. More...
|
| |
| bool | Alloc (uint32_t numBuffers, size_t size, uint32_t flags=0) |
| | Allocate memory for a set of buffers, where each buffer has the specified size. More...
|
| |
| void | Free () |
| | Free the buffer allocations. More...
|
| |
| void * | Peek (uint32_t flags) |
| | Get the next read/write buffer without advancing the position in the queue. More...
|
| |
| void * | Next (uint32_t flags) |
| | Get the next read/write buffer and advance the position in the queue. More...
|
| |
| uint32_t | GetFlags () const |
| | Get the flags of the ring buffer. More...
|
| |
| void | SetFlags (uint32_t flags) |
| | Set the ring buffer's flags. More...
|
| |
| void | SetThreaded (bool threaded) |
| | Enable or disable multi-threading. More...
|
| |
|
| | uint32_t | mNumBuffers | | | | uint32_t | mLatestRead | | | | uint32_t | mLatestWrite | | | | uint32_t | mFlags | | | | void ** | mBuffers | | | | size_t | mBufferSize | | | | bool | mReadOnce | | | | Mutex | mMutex | | |
Thread-safe circular ring buffer queue.
| enum RingBuffer::Flags |
Ring buffer flags.
| Enumerator |
|---|
| Read |
Read the next buffer.
| | ReadOnce |
Read the next buffer, but only if it hasn't been read before.
| | ReadLatest |
Read the latest buffer in the queue, skipping other buffers that may not have been read.
| | ReadLatestOnce |
Combination of ReadOnce and ReadLatest flags.
| | Write |
Write the next buffer.
| | Threaded |
Buffers should be thread-safe (enabled by default).
| | ZeroCopy |
Buffers should be allocated in mapped CPU/GPU zeroCopy memory (otherwise GPU only)
|
|
| RingBuffer::RingBuffer | ( | uint32_t | flags = Threaded | ) | |
| inline |
Construct a new ring buffer.
|
| RingBuffer::~RingBuffer | ( | | ) | |
| inline |
Destructor.
|
| bool RingBuffer::Alloc | ( | uint32_t | numBuffers, |
| | | size_t | size, |
| | | uint32_t | flags = 0 |
| | ) | | |
| inline |
Allocate memory for a set of buffers, where each buffer has the specified size.
If the requested allocation is compatible with what was already allocated, this will return true without performing additional allocations. Otherwise, the previous buffers are released and new ones are allocated.
Returnstrue if the allocations succeeded or was previously done. false if a memory allocation error occurred.
|
| void RingBuffer::Free | ( | | ) | |
| inline |
Free the buffer allocations.
|
| uint32_t RingBuffer::GetFlags | ( | | ) | const |
| inline |
Get the flags of the ring buffer.
|
| void* RingBuffer::Next | ( | uint32_t | flags | ) | |
| inline |
Get the next read/write buffer and advance the position in the queue.
|
| void* RingBuffer::Peek | ( | uint32_t | flags | ) | |
| inline |
Get the next read/write buffer without advancing the position in the queue.
|
| void RingBuffer::SetFlags | ( | uint32_t | flags | ) | |
| inline |
Set the ring buffer's flags.
|
| void RingBuffer::SetThreaded | ( | bool | threaded | ) | |
| inline |
Enable or disable multi-threading.
|
| void** RingBuffer::mBuffers |
| protected |
|
| size_t RingBuffer::mBufferSize |
| protected |
|
| uint32_t RingBuffer::mFlags |
| protected |
|
| uint32_t RingBuffer::mLatestRead |
| protected |
|
| uint32_t RingBuffer::mLatestWrite |
| protected |
|
| Mutex RingBuffer::mMutex |
| protected |
|
| uint32_t RingBuffer::mNumBuffers |
| protected |
|
| bool RingBuffer::mReadOnce |
| protected |
The documentation for this class was generated from the following file:
jetson-utils/RingBuffer.h
Generated on Fri Mar 17 2023 14:29:30 for Jetson Inference by 1.8.17