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

Generic queue based on the linked list class defined in libuavcan. More...

#include <uavcan_virtual_can_driver.hpp>

Public Member Functions

 Queue (uavcan::IPoolAllocator &arg_allocator, std::size_t block_allocation_quota)
 
bool isEmpty () const
 
template<typename... Args>
bool tryEmplace (Args... args)
 Creates one item in-place at the end of the list. More...
 
T * peek ()
 Accesses the first element. More...
 
const T * peek () const
 
void pop ()
 Removes the first element. More...
 

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.

Member Function Documentation

§ peek()

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).

§ 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).

§ 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.


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