NVIDIA DeepStream SDK API Reference

9.2 Release
sdk::common::CircularBuffer< T > Class Template Reference

Detailed Description

template<class T>
class sdk::common::CircularBuffer< T >

Definition at line 28 of file includes/opentelemetry/sdk/common/circular_buffer.h.

Public Member Functions

 CircularBuffer (size_t max_size)
 
CircularBufferRange< const AtomicUniquePtr< T > > Peek () const noexcept
 
template<class Callback >
void Consume (size_t n, Callback callback) noexcept
 Consume elements from the circular buffer's tail. More...
 
void Consume (size_t n) noexcept
 Consume elements from the circular buffer's tail. More...
 
bool Add (std::unique_ptr< T > &ptr) noexcept
 Adds an element into the circular buffer. More...
 
bool Add (std::unique_ptr< T > &&ptr) noexcept
 
void Clear () noexcept
 Clear the circular buffer. More...
 
size_t max_size () const noexcept
 
bool empty () const noexcept
 
size_t size () const noexcept
 
uint64_t consumption_count () const noexcept
 
uint64_t production_count () const noexcept
 
 CircularBuffer (size_t max_size)
 
CircularBufferRange< const AtomicUniquePtr< T > > Peek () const noexcept
 
template<class Callback >
void Consume (size_t n, Callback callback) noexcept
 Consume elements from the circular buffer's tail. More...
 
void Consume (size_t n) noexcept
 Consume elements from the circular buffer's tail. More...
 
bool Add (std::unique_ptr< T > &ptr) noexcept
 Adds an element into the circular buffer. More...
 
bool Add (std::unique_ptr< T > &&ptr) noexcept
 
void Clear () noexcept
 Clear the circular buffer. More...
 
size_t max_size () const noexcept
 
bool empty () const noexcept
 
size_t size () const noexcept
 
uint64_t consumption_count () const noexcept
 
uint64_t production_count () const noexcept
 

Constructor & Destructor Documentation

◆ CircularBuffer() [1/2]

template<class T >
sdk::common::CircularBuffer< T >::CircularBuffer ( size_t  max_size)
inlineexplicit

◆ CircularBuffer() [2/2]

template<class T >
sdk::common::CircularBuffer< T >::CircularBuffer ( size_t  max_size)
inlineexplicit

Member Function Documentation

◆ Add() [1/4]

template<class T >
bool sdk::common::CircularBuffer< T >::Add ( std::unique_ptr< T > &&  ptr)
inlinenoexcept

◆ Add() [2/4]

template<class T >
bool sdk::common::CircularBuffer< T >::Add ( std::unique_ptr< T > &&  ptr)
inlinenoexcept

◆ Add() [3/4]

template<class T >
bool sdk::common::CircularBuffer< T >::Add ( std::unique_ptr< T > &  ptr)
inlinenoexcept

Adds an element into the circular buffer.

Parameters
ptra pointer to the element to add
Returns
true if the element was successfully added; false, otherwise.

Definition at line 86 of file includes/opentelemetry/sdk/common/circular_buffer.h.

Referenced by sdk::common::CircularBuffer< T >::Add().

◆ Add() [4/4]

template<class T >
bool sdk::common::CircularBuffer< T >::Add ( std::unique_ptr< T > &  ptr)
inlinenoexcept

Adds an element into the circular buffer.

Parameters
ptra pointer to the element to add
Returns
true if the element was successfully added; false, otherwise.

Definition at line 86 of file 9.2/includes/opentelemetry/sdk/common/circular_buffer.h.

◆ Clear() [1/2]

template<class T >
void sdk::common::CircularBuffer< T >::Clear ( )
inlinenoexcept

Clear the circular buffer.

Note: This method must only be called from the consumer thread.

Definition at line 134 of file 9.2/includes/opentelemetry/sdk/common/circular_buffer.h.

References sdk::common::CircularBuffer< T >::Consume(), and sdk::common::CircularBuffer< T >::size().

◆ Clear() [2/2]

template<class T >
void sdk::common::CircularBuffer< T >::Clear ( )
inlinenoexcept

Clear the circular buffer.

Note: This method must only be called from the consumer thread.

Definition at line 134 of file includes/opentelemetry/sdk/common/circular_buffer.h.

References sdk::common::CircularBuffer< T >::Consume(), and sdk::common::CircularBuffer< T >::size().

◆ Consume() [1/4]

template<class T >
void sdk::common::CircularBuffer< T >::Consume ( size_t  n)
inlinenoexcept

Consume elements from the circular buffer's tail.

Parameters
nthe number of elements to consume

Note: This method must only be called from the consumer thread.

Definition at line 71 of file includes/opentelemetry/sdk/common/circular_buffer.h.

References sdk::common::CircularBuffer< T >::Consume(), and sdk::common::AtomicUniquePtr< T >::Reset().

◆ Consume() [2/4]

template<class T >
void sdk::common::CircularBuffer< T >::Consume ( size_t  n)
inlinenoexcept

Consume elements from the circular buffer's tail.

Parameters
nthe number of elements to consume

Note: This method must only be called from the consumer thread.

Definition at line 71 of file 9.2/includes/opentelemetry/sdk/common/circular_buffer.h.

References sdk::common::CircularBuffer< T >::Consume(), and sdk::common::AtomicUniquePtr< T >::Reset().

◆ Consume() [3/4]

template<class T >
template<class Callback >
void sdk::common::CircularBuffer< T >::Consume ( size_t  n,
Callback  callback 
)
inlinenoexcept

Consume elements from the circular buffer's tail.

Parameters
nthe number of elements to consume
callbackthe callback to invoke with an AtomicUniquePtr to each consumed element.

Note: The callback must set the passed AtomicUniquePtr to null.

Note: This method must only be called from the consumer thread.

Definition at line 56 of file includes/opentelemetry/sdk/common/circular_buffer.h.

Referenced by sdk::common::CircularBuffer< T >::Clear(), and sdk::common::CircularBuffer< T >::Consume().

◆ Consume() [4/4]

template<class T >
template<class Callback >
void sdk::common::CircularBuffer< T >::Consume ( size_t  n,
Callback  callback 
)
inlinenoexcept

Consume elements from the circular buffer's tail.

Parameters
nthe number of elements to consume
callbackthe callback to invoke with an AtomicUniquePtr to each consumed element.

Note: The callback must set the passed AtomicUniquePtr to null.

Note: This method must only be called from the consumer thread.

Definition at line 56 of file 9.2/includes/opentelemetry/sdk/common/circular_buffer.h.

◆ consumption_count() [1/2]

template<class T >
uint64_t sdk::common::CircularBuffer< T >::consumption_count ( ) const
inlinenoexcept
Returns
the number of elements consumed from the circular buffer.

Definition at line 163 of file 9.2/includes/opentelemetry/sdk/common/circular_buffer.h.

◆ consumption_count() [2/2]

template<class T >
uint64_t sdk::common::CircularBuffer< T >::consumption_count ( ) const
inlinenoexcept
Returns
the number of elements consumed from the circular buffer.

Definition at line 163 of file includes/opentelemetry/sdk/common/circular_buffer.h.

◆ empty() [1/2]

template<class T >
bool sdk::common::CircularBuffer< T >::empty ( ) const
inlinenoexcept
Returns
true if the buffer is empty.

Definition at line 144 of file includes/opentelemetry/sdk/common/circular_buffer.h.

◆ empty() [2/2]

template<class T >
bool sdk::common::CircularBuffer< T >::empty ( ) const
inlinenoexcept
Returns
true if the buffer is empty.

Definition at line 144 of file 9.2/includes/opentelemetry/sdk/common/circular_buffer.h.

◆ max_size() [1/2]

template<class T >
size_t sdk::common::CircularBuffer< T >::max_size ( ) const
inlinenoexcept
Returns
the maximum number of bytes that can be stored in the buffer.

Definition at line 139 of file 9.2/includes/opentelemetry/sdk/common/circular_buffer.h.

◆ max_size() [2/2]

template<class T >
size_t sdk::common::CircularBuffer< T >::max_size ( ) const
inlinenoexcept
Returns
the maximum number of bytes that can be stored in the buffer.

Definition at line 139 of file includes/opentelemetry/sdk/common/circular_buffer.h.

Referenced by sdk::common::CircularBuffer< T >::CircularBuffer().

◆ Peek() [1/2]

template<class T >
CircularBufferRange<const AtomicUniquePtr<T> > sdk::common::CircularBuffer< T >::Peek ( ) const
inlinenoexcept
Returns
a range of the elements in the circular buffer

Note: This method must only be called from the consumer thread.

Definition at line 40 of file includes/opentelemetry/sdk/common/circular_buffer.h.

◆ Peek() [2/2]

template<class T >
CircularBufferRange<const AtomicUniquePtr<T> > sdk::common::CircularBuffer< T >::Peek ( ) const
inlinenoexcept
Returns
a range of the elements in the circular buffer

Note: This method must only be called from the consumer thread.

Definition at line 40 of file 9.2/includes/opentelemetry/sdk/common/circular_buffer.h.

◆ production_count() [1/2]

template<class T >
uint64_t sdk::common::CircularBuffer< T >::production_count ( ) const
inlinenoexcept
Returns
the number of elements added to the circular buffer.

Definition at line 168 of file 9.2/includes/opentelemetry/sdk/common/circular_buffer.h.

◆ production_count() [2/2]

template<class T >
uint64_t sdk::common::CircularBuffer< T >::production_count ( ) const
inlinenoexcept
Returns
the number of elements added to the circular buffer.

Definition at line 168 of file includes/opentelemetry/sdk/common/circular_buffer.h.

◆ size() [1/2]

template<class T >
size_t sdk::common::CircularBuffer< T >::size ( ) const
inlinenoexcept
Returns
the number of bytes stored in the circular buffer.

Note: this method will only return a correct snapshot of the size if called from the consumer thread.

Definition at line 152 of file 9.2/includes/opentelemetry/sdk/common/circular_buffer.h.

◆ size() [2/2]

template<class T >
size_t sdk::common::CircularBuffer< T >::size ( ) const
inlinenoexcept
Returns
the number of bytes stored in the circular buffer.

Note: this method will only return a correct snapshot of the size if called from the consumer thread.

Definition at line 152 of file includes/opentelemetry/sdk/common/circular_buffer.h.

Referenced by sdk::common::CircularBuffer< T >::Clear().


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