Classes | Public Member Functions | Private Attributes | List of all members
Queue< T > Class Template Reference

Classes

struct  Item
 

Public Member Functions

bool isEmpty () const
 
T * peek ()
 
const T * peek () const
 
void pop ()
 
 Queue (uavcan::IPoolAllocator &arg_allocator, std::size_t block_allocation_quota)
 
template<typename... Args>
bool tryEmplace (Args... args)
 

Private Attributes

uavcan::LimitedPoolAllocator allocator_
 
uavcan::LinkedListRoot< Itemlist_
 

Detailed Description

template<typename T>
class Queue< T >

Generic queue based on the linked list class defined in libuavcan. This class does not use heap memory.

Definition at line 23 of file test_multithreading.cpp.

Constructor & Destructor Documentation

◆ Queue()

template<typename T >
Queue< T >::Queue ( uavcan::IPoolAllocator arg_allocator,
std::size_t  block_allocation_quota 
)
inline

Definition at line 37 of file test_multithreading.cpp.

Member Function Documentation

◆ isEmpty()

template<typename T >
bool Queue< T >::isEmpty ( ) const
inline

Definition at line 43 of file test_multithreading.cpp.

◆ peek() [1/2]

template<typename T >
T* Queue< T >::peek ( )
inline

Accesses the first element. Nullptr will be returned if the queue is empty. Complexity is O(1).

Definition at line 89 of file test_multithreading.cpp.

◆ peek() [2/2]

template<typename T >
const T* Queue< T >::peek ( ) const
inline

Definition at line 90 of file test_multithreading.cpp.

◆ pop()

template<typename T >
void Queue< T >::pop ( )
inline

Removes the first element. If the queue is empty, nothing will be done and assertion failure will be triggered. Complexity is O(1).

Definition at line 97 of file test_multithreading.cpp.

◆ tryEmplace()

template<typename T >
template<typename... Args>
bool Queue< T >::tryEmplace ( Args...  args)
inline

Creates one item in-place at the end of the list. Returns true if the item was appended successfully, false if there's not enough memory. Complexity is O(N) where N is queue length.

Definition at line 51 of file test_multithreading.cpp.

Member Data Documentation

◆ allocator_

template<typename T >
uavcan::LimitedPoolAllocator Queue< T >::allocator_
private

Definition at line 33 of file test_multithreading.cpp.

◆ list_

template<typename T >
uavcan::LinkedListRoot<Item> Queue< T >::list_
private

Definition at line 34 of file test_multithreading.cpp.


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


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:04