0.4.1
Loading...
Searching...
No Matches
NAV::TsDeque< T, Alloc > Class Template Reference

Thread-safe deque. More...

Public Member Functions

template<class InputIt>
void assign (InputIt first, InputIt last)
 Replaces the contents with copies of those in the range [first, last). The behavior is undefined if either argument is an iterator into *this.
 
void assign (std::initializer_list< T > ilist)
 Replaces the contents with the elements from the initializer list ilist.
 
void assign (typename std::deque< T, Alloc >::size_type count, const T &value)
 Replaces the contents with count copies of value value.
 
auto & at (typename std::deque< T, Alloc >::size_type pos)
 Returns a reference to the element at specified location pos, with bounds checking. If pos is not within the range of the container, an exception of type std::out_of_range is thrown.
 
const auto & at (typename std::deque< T, Alloc >::size_type pos) const
 Returns a reference to the element at specified location pos, with bounds checking. If pos is not within the range of the container, an exception of type std::out_of_range is thrown.
 
auto & back ()
 Returns a reference to the last element in the container.
 
const auto & back () const
 Returns a reference to the last element in the container.
 
std::deque< T >::const_iterator begin () const noexcept
 Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end().
 
std::deque< T >::iterator begin () noexcept
 Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end().
 
std::deque< T >::const_iterator cbegin () const noexcept
 Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end().
 
std::deque< T >::const_iterator cend () const noexcept
 Returns an iterator to the element following the last element of the deque. This element acts as a placeholder; attempting to access it results in undefined behavior.
 
void clear () noexcept
 
std::deque< T >::const_reverse_iterator crbegin () const noexcept
 Returns a reverse iterator to the first element of the reversed deque. It corresponds to the last element of the non-reversed deque. If the deque is empty, the returned iterator is equal to rend().
 
std::deque< T >::const_reverse_iterator crend () const noexcept
 Returns a reverse iterator to the element following the last element of the reversed deque. It corresponds to the element preceding the first element of the non-reversed deque. This element acts as a placeholder, attempting to access it results in undefined behavior.
 
template<class... Args>
std::deque< T >::iterator emplace (typename std::deque< T >::const_iterator pos, Args &&... args)
 Inserts a new element into the container directly before pos.
 
template<class... Args>
auto & emplace_back (Args &&... args)
 Appends a new element to the end of the container.
 
template<class... Args>
auto & emplace_front (Args &&... args)
 Inserts a new element to the beginning of the container.
 
bool empty () const noexcept
 Checks if the container has no elements, i.e. whether 'begin() == end()'.
 
std::deque< T >::const_iterator end () const noexcept
 Returns an iterator to the element following the last element of the deque. This element acts as a placeholder; attempting to access it results in undefined behavior.
 
std::deque< T >::iterator end () noexcept
 Returns an iterator to the element following the last element of the deque. This element acts as a placeholder; attempting to access it results in undefined behavior.
 
std::deque< T >::iterator erase (typename std::deque< T >::const_iterator first, typename std::deque< T >::const_iterator last)
 Removes the elements in the range [first, last). All iterators and references are invalidated, unless the erased elements are at the end or the beginning of the container, in which case only the iterators and references to the erased elements are invalidated.
 
std::deque< T >::iterator erase (typename std::deque< T >::const_iterator pos)
 Removes the element at pos.
 
auto extract_front ()
 Returns a copy of the first element in the container and removes it from the container.
 
auto & front ()
 Returns a reference to the first element in the container.
 
const auto & front () const
 Returns a reference to the first element in the container.
 
std::deque< T, Alloc >::allocator_type get_allocator () const noexcept
 Returns the allocator associated with the container.
 
std::deque< T >::iterator insert (typename std::deque< T >::const_iterator pos, const T &value)
 Insert value before pos in the container.
 
template<class InputIt>
std::deque< T >::iterator insert (typename std::deque< T >::const_iterator pos, InputIt first, InputIt last)
 inserts elements from range [first, last) before pos.
 
std::deque< T >::iterator insert (typename std::deque< T >::const_iterator pos, std::initializer_list< T > ilist)
 Inserts elements from initializer list ilist before pos.
 
std::deque< T >::iterator insert (typename std::deque< T >::const_iterator pos, T &&value)
 Insert value before pos in the container.
 
std::deque< T >::iterator insert (typename std::deque< T >::const_iterator pos, typename std::deque< T, Alloc >::size_type count, const T &value)
 inserts count copies of the value before pos
 
std::deque< T, Alloc >::size_type max_size () const noexcept
 Returns the maximum number of elements the container is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest container.
 
TsDequeoperator= (const TsDeque &other)
 Copy assignment operator.
 
TsDequeoperator= (std::initializer_list< T > ilist)
 Replaces the contents with those identified by initializer list ilist.
 
TsDequeoperator= (TsDeque &&other) noexcept
 Move assignment operator.
 
auto & operator[] (typename std::deque< T, Alloc >::size_type pos)
 Returns a reference to the element at specified location pos. No bounds checking is performed.
 
const auto & operator[] (typename std::deque< T, Alloc >::size_type pos) const
 Returns a reference to the element at specified location pos. No bounds checking is performed.
 
void pop_back ()
 Removes the last element of the container.
 
void pop_front ()
 Removes the first element of the container. If there are no elements in the container, the behavior is undefined.
 
void push_back (const T &value)
 Appends the given element value to the end of the container. The new element is initialized as a copy of value.
 
void push_back (T &&value)
 Appends the given element value to the end of the container. Value is moved into the new element.
 
void push_front (const T &value)
 Prepends the given element value to the beginning of the container. The new element is initialized as a copy of value. All iterators, including the past-the-end iterator, are invalidated. No references are invalidated.
 
void push_front (T &&value)
 Prepends the given element value to the beginning of the container. Value is moved into the new element. All iterators, including the past-the-end iterator, are invalidated. No references are invalidated.
 
std::deque< T >::const_reverse_iterator rbegin () const noexcept
 Returns a reverse iterator to the first element of the reversed deque. It corresponds to the last element of the non-reversed deque. If the deque is empty, the returned iterator is equal to rend().
 
std::deque< T >::reverse_iterator rbegin () noexcept
 Returns a reverse iterator to the first element of the reversed deque. It corresponds to the last element of the non-reversed deque. If the deque is empty, the returned iterator is equal to rend().
 
std::deque< T >::const_reverse_iterator rend () const noexcept
 Returns a reverse iterator to the element following the last element of the reversed deque. It corresponds to the element preceding the first element of the non-reversed deque. This element acts as a placeholder, attempting to access it results in undefined behavior.
 
std::deque< T >::reverse_iterator rend () noexcept
 Returns a reverse iterator to the element following the last element of the reversed deque. It corresponds to the element preceding the first element of the non-reversed deque. This element acts as a placeholder, attempting to access it results in undefined behavior.
 
void resize (typename std::deque< T, Alloc >::size_type count)
 Resizes the container to contain count elements.
 
void resize (typename std::deque< T, Alloc >::size_type count, const T &value)
 Resizes the container to contain count elements.
 
void shrink_to_fit ()
 Requests the removal of unused capacity.
 
std::deque< T, Alloc >::size_type size () const noexcept
 Returns the number of elements in the container, i.e. std::distance(begin(), end()).
 
void swap (std::deque< T > &other) noexcept
 Exchanges the contents of the container with those of other. Does not invoke any move, copy, or swap operations on individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated.
 
 TsDeque ()=default
 Default Constructor. Constructs an empty container with a default-constructed allocator.
 
 TsDeque (const Alloc &alloc)
 Constructs an empty container with the given allocator alloc.
 
 TsDeque (const TsDeque &other)
 Copy constructor. Constructs the container with the copy of the contents of other.
 
 TsDeque (const TsDeque &other, const Alloc &alloc)
 Constructs the container with the copy of the contents of other, using alloc as the allocator.
 
template<class InputIt>
 TsDeque (InputIt first, InputIt last, const Alloc &alloc=Alloc())
 Constructs the container with the contents of the range [first, last).
 
 TsDeque (std::initializer_list< T > init, const Alloc &alloc=Alloc())
 Constructs the container with the contents of the initializer list init.
 
 TsDeque (TsDeque &&other) noexcept
 Move constructor. Constructs the container with the contents of other using move semantics. Allocator is obtained by move-construction from the allocator belonging to other.
 
 TsDeque (TsDeque &&other, const Alloc &alloc) noexcept
 Allocator-extended move constructor. Using alloc as the allocator for the new container, moving the contents from other; if alloc != other.get_allocator(), this results in an element-wise move.
 
 TsDeque (typename std::deque< T, Alloc >::size_type count, const Alloc &alloc=Alloc())
 Constructs the container with count default-inserted instances of T. No copies are made.
 
 TsDeque (typename std::deque< T, Alloc >::size_type count, const T &value, const Alloc &alloc=Alloc())
 Constructs the container with count copies of elements with value value.
 
 ~TsDeque ()=default
 Destructor.
 

Private Attributes

std::mutex _mutex
 Mutex to interact with the queue object.
 
std::deque< T, Alloc > _queue
 Queue with received data.
 

Detailed Description

template<class T, class Alloc = std::allocator<T>>
class NAV::TsDeque< T, Alloc >

Thread-safe deque.

Template Parameters
TThe type of the elements.
AllocAllocator that is used to acquire/release memory and to construct/destroy the elements in that memory.

Definition at line 26 of file TsDeque.hpp.

Constructor & Destructor Documentation

◆ TsDeque() [1/10]

template<class T, class Alloc = std::allocator<T>>
NAV::TsDeque< T, Alloc >::TsDeque ( )
default

Default Constructor. Constructs an empty container with a default-constructed allocator.

◆ ~TsDeque()

template<class T, class Alloc = std::allocator<T>>
NAV::TsDeque< T, Alloc >::~TsDeque ( )
default

Destructor.

◆ TsDeque() [2/10]

template<class T, class Alloc = std::allocator<T>>
NAV::TsDeque< T, Alloc >::TsDeque ( const Alloc & alloc)
inlineexplicit

Constructs an empty container with the given allocator alloc.

Parameters
allocAllocator to use for all memory allocations of this container

Definition at line 41 of file TsDeque.hpp.

◆ TsDeque() [3/10]

template<class T, class Alloc = std::allocator<T>>
NAV::TsDeque< T, Alloc >::TsDeque ( typename std::deque< T, Alloc >::size_type count,
const T & value,
const Alloc & alloc = Alloc() )
inline

Constructs the container with count copies of elements with value value.

Parameters
countThe size of the container
valueThe value to initialize elements of the container with
allocAllocator to use for all memory allocations of this container

Definition at line 48 of file TsDeque.hpp.

◆ TsDeque() [4/10]

template<class T, class Alloc = std::allocator<T>>
NAV::TsDeque< T, Alloc >::TsDeque ( typename std::deque< T, Alloc >::size_type count,
const Alloc & alloc = Alloc() )
inlineexplicit

Constructs the container with count default-inserted instances of T. No copies are made.

Parameters
countThe size of the container
allocAllocator to use for all memory allocations of this container

Definition at line 54 of file TsDeque.hpp.

◆ TsDeque() [5/10]

template<class T, class Alloc = std::allocator<T>>
template<class InputIt>
NAV::TsDeque< T, Alloc >::TsDeque ( InputIt first,
InputIt last,
const Alloc & alloc = Alloc() )
inline

Constructs the container with the contents of the range [first, last).

Parameters
firstFirst element of the range to copy the elements from
lastLast element the range to copy the elements from
allocAllocator to use for all memory allocations of this container

Definition at line 62 of file TsDeque.hpp.

◆ TsDeque() [6/10]

template<class T, class Alloc = std::allocator<T>>
NAV::TsDeque< T, Alloc >::TsDeque ( const TsDeque< T, Alloc > & other)
inline

Copy constructor. Constructs the container with the copy of the contents of other.

Parameters
otherAnother container to be used as source to initialize the elements of the container with

Definition at line 68 of file TsDeque.hpp.

◆ TsDeque() [7/10]

template<class T, class Alloc = std::allocator<T>>
NAV::TsDeque< T, Alloc >::TsDeque ( const TsDeque< T, Alloc > & other,
const Alloc & alloc )
inline

Constructs the container with the copy of the contents of other, using alloc as the allocator.

Parameters
otherAnother container to be used as source to initialize the elements of the container with
allocAllocator to use for all memory allocations of this container

Definition at line 76 of file TsDeque.hpp.

◆ TsDeque() [8/10]

template<class T, class Alloc = std::allocator<T>>
NAV::TsDeque< T, Alloc >::TsDeque ( TsDeque< T, Alloc > && other)
inlinenoexcept

Move constructor. Constructs the container with the contents of other using move semantics. Allocator is obtained by move-construction from the allocator belonging to other.

Parameters
otherAnother container to be used as source to initialize the elements of the container with

Definition at line 84 of file TsDeque.hpp.

◆ TsDeque() [9/10]

template<class T, class Alloc = std::allocator<T>>
NAV::TsDeque< T, Alloc >::TsDeque ( TsDeque< T, Alloc > && other,
const Alloc & alloc )
inlinenoexcept

Allocator-extended move constructor. Using alloc as the allocator for the new container, moving the contents from other; if alloc != other.get_allocator(), this results in an element-wise move.

Parameters
otherAnother container to be used as source to initialize the elements of the container with
allocAllocator to use for all memory allocations of this container

Definition at line 93 of file TsDeque.hpp.

◆ TsDeque() [10/10]

template<class T, class Alloc = std::allocator<T>>
NAV::TsDeque< T, Alloc >::TsDeque ( std::initializer_list< T > init,
const Alloc & alloc = Alloc() )
inline

Constructs the container with the contents of the initializer list init.

Parameters
initInitializer list to initialize the elements of the container with
allocAllocator to use for all memory allocations of this container

Definition at line 101 of file TsDeque.hpp.

Member Function Documentation

◆ assign() [1/3]

template<class T, class Alloc = std::allocator<T>>
template<class InputIt>
void NAV::TsDeque< T, Alloc >::assign ( InputIt first,
InputIt last )
inline

Replaces the contents with copies of those in the range [first, last). The behavior is undefined if either argument is an iterator into *this.

All iterators, pointers and references to the elements of the container are invalidated. The past-the-end iterator is also invalidated.

Parameters
[in]firstThe first element of the range to copy the elements from
[in]lastThe last element of the range to copy the elements from

Definition at line 150 of file TsDeque.hpp.

◆ assign() [2/3]

template<class T, class Alloc = std::allocator<T>>
void NAV::TsDeque< T, Alloc >::assign ( std::initializer_list< T > ilist)
inline

Replaces the contents with the elements from the initializer list ilist.

All iterators, pointers and references to the elements of the container are invalidated. The past-the-end iterator is also invalidated.

Parameters
ilistInitializer list to copy the values from

Definition at line 159 of file TsDeque.hpp.

◆ assign() [3/3]

template<class T, class Alloc = std::allocator<T>>
void NAV::TsDeque< T, Alloc >::assign ( typename std::deque< T, Alloc >::size_type count,
const T & value )
inline

Replaces the contents with count copies of value value.

All iterators, pointers and references to the elements of the container are invalidated. The past-the-end iterator is also invalidated.

Parameters
countThe new size of the container
valueThe value to initialize elements of the container with

Definition at line 138 of file TsDeque.hpp.

◆ at() [1/2]

template<class T, class Alloc = std::allocator<T>>
auto & NAV::TsDeque< T, Alloc >::at ( typename std::deque< T, Alloc >::size_type pos)
inline

Returns a reference to the element at specified location pos, with bounds checking. If pos is not within the range of the container, an exception of type std::out_of_range is thrown.

Parameters
[in]posPosition of the element to return
Returns
Reference to the requested element.

Definition at line 180 of file TsDeque.hpp.

◆ at() [2/2]

template<class T, class Alloc = std::allocator<T>>
const auto & NAV::TsDeque< T, Alloc >::at ( typename std::deque< T, Alloc >::size_type pos) const
inline

Returns a reference to the element at specified location pos, with bounds checking. If pos is not within the range of the container, an exception of type std::out_of_range is thrown.

Parameters
[in]posPosition of the element to return
Returns
Reference to the requested element.

Definition at line 185 of file TsDeque.hpp.

◆ back() [1/2]

template<class T, class Alloc = std::allocator<T>>
auto & NAV::TsDeque< T, Alloc >::back ( )
inline

Returns a reference to the last element in the container.

Returns
Reference to the last element

Definition at line 205 of file TsDeque.hpp.

◆ back() [2/2]

template<class T, class Alloc = std::allocator<T>>
const auto & NAV::TsDeque< T, Alloc >::back ( ) const
inline

Returns a reference to the last element in the container.

Returns
Reference to the last element

Definition at line 208 of file TsDeque.hpp.

◆ begin() [1/2]

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::const_iterator NAV::TsDeque< T, Alloc >::begin ( ) const
inlinenoexcept

Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end().

Returns
Iterator to the first element.

Definition at line 221 of file TsDeque.hpp.

◆ begin() [2/2]

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::iterator NAV::TsDeque< T, Alloc >::begin ( )
inlinenoexcept

Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end().

Returns
Iterator to the first element.

Definition at line 217 of file TsDeque.hpp.

◆ cbegin()

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::const_iterator NAV::TsDeque< T, Alloc >::cbegin ( ) const
inlinenoexcept

Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end().

Returns
Iterator to the first element.

Definition at line 225 of file TsDeque.hpp.

◆ cend()

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::const_iterator NAV::TsDeque< T, Alloc >::cend ( ) const
inlinenoexcept

Returns an iterator to the element following the last element of the deque. This element acts as a placeholder; attempting to access it results in undefined behavior.

Returns
Iterator to the element following the last element.

Definition at line 238 of file TsDeque.hpp.

◆ clear()

template<class T, class Alloc = std::allocator<T>>
void NAV::TsDeque< T, Alloc >::clear ( )
inlinenoexcept

Erases all elements from the container. After this call, size() returns zero. Invalidates any references, pointers, or iterators referring to contained elements. Any past-the-end iterators are also invalidated.

Definition at line 310 of file TsDeque.hpp.

◆ crbegin()

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::const_reverse_iterator NAV::TsDeque< T, Alloc >::crbegin ( ) const
inlinenoexcept

Returns a reverse iterator to the first element of the reversed deque. It corresponds to the last element of the non-reversed deque. If the deque is empty, the returned iterator is equal to rend().

Returns
Reverse iterator to the first element.

Definition at line 251 of file TsDeque.hpp.

◆ crend()

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::const_reverse_iterator NAV::TsDeque< T, Alloc >::crend ( ) const
inlinenoexcept

Returns a reverse iterator to the element following the last element of the reversed deque. It corresponds to the element preceding the first element of the non-reversed deque. This element acts as a placeholder, attempting to access it results in undefined behavior.

Returns
Reverse iterator to the element following the last element.

Definition at line 267 of file TsDeque.hpp.

◆ emplace()

template<class T, class Alloc = std::allocator<T>>
template<class... Args>
std::deque< T >::iterator NAV::TsDeque< T, Alloc >::emplace ( typename std::deque< T >::const_iterator pos,
Args &&... args )
inline

Inserts a new element into the container directly before pos.

Parameters
[in]posIterator before which the new element will be constructed
[in]argsArguments to forward to the constructor of the element
Returns
Iterator pointing to the emplaced element.

Definition at line 375 of file TsDeque.hpp.

◆ emplace_back()

template<class T, class Alloc = std::allocator<T>>
template<class... Args>
auto & NAV::TsDeque< T, Alloc >::emplace_back ( Args &&... args)
inline

Appends a new element to the end of the container.

Parameters
[in]argsArguments to forward to the constructor of the element
Returns
A reference to the inserted element.

Definition at line 420 of file TsDeque.hpp.

◆ emplace_front()

template<class T, class Alloc = std::allocator<T>>
template<class... Args>
auto & NAV::TsDeque< T, Alloc >::emplace_front ( Args &&... args)
inline

Inserts a new element to the beginning of the container.

Parameters
[in]argsArguments to forward to the constructor of the element
Returns
A reference to the inserted element.

Definition at line 454 of file TsDeque.hpp.

◆ empty()

template<class T, class Alloc = std::allocator<T>>
bool NAV::TsDeque< T, Alloc >::empty ( ) const
inlinenodiscardnoexcept

Checks if the container has no elements, i.e. whether 'begin() == end()'.

Returns
true if the container is empty, false otherwise

Definition at line 275 of file TsDeque.hpp.

◆ end() [1/2]

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::const_iterator NAV::TsDeque< T, Alloc >::end ( ) const
inlinenoexcept

Returns an iterator to the element following the last element of the deque. This element acts as a placeholder; attempting to access it results in undefined behavior.

Returns
Iterator to the element following the last element.

Definition at line 234 of file TsDeque.hpp.

◆ end() [2/2]

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::iterator NAV::TsDeque< T, Alloc >::end ( )
inlinenoexcept

Returns an iterator to the element following the last element of the deque. This element acts as a placeholder; attempting to access it results in undefined behavior.

Returns
Iterator to the element following the last element.

Definition at line 230 of file TsDeque.hpp.

◆ erase() [1/2]

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::iterator NAV::TsDeque< T, Alloc >::erase ( typename std::deque< T >::const_iterator first,
typename std::deque< T >::const_iterator last )
inline

Removes the elements in the range [first, last). All iterators and references are invalidated, unless the erased elements are at the end or the beginning of the container, in which case only the iterators and references to the erased elements are invalidated.

Parameters
[in]firstFirst element of the range of elements to remove
[in]lastLast element of the range of elements to remove
Returns
Iterator following the last removed element.

Definition at line 395 of file TsDeque.hpp.

◆ erase() [2/2]

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::iterator NAV::TsDeque< T, Alloc >::erase ( typename std::deque< T >::const_iterator pos)
inline

Removes the element at pos.

Parameters
[in]posIterator to the element to remove
Returns
Iterator following the last removed element.

Definition at line 384 of file TsDeque.hpp.

◆ extract_front()

template<class T, class Alloc = std::allocator<T>>
auto NAV::TsDeque< T, Alloc >::extract_front ( )
inline

Returns a copy of the first element in the container and removes it from the container.

Returns
Copy of the first element

Definition at line 494 of file TsDeque.hpp.

◆ front() [1/2]

template<class T, class Alloc = std::allocator<T>>
auto & NAV::TsDeque< T, Alloc >::front ( )
inline

Returns a reference to the first element in the container.

Returns
Reference to the first element

Definition at line 198 of file TsDeque.hpp.

◆ front() [2/2]

template<class T, class Alloc = std::allocator<T>>
const auto & NAV::TsDeque< T, Alloc >::front ( ) const
inline

Returns a reference to the first element in the container.

Returns
Reference to the first element

Definition at line 201 of file TsDeque.hpp.

◆ get_allocator()

template<class T, class Alloc = std::allocator<T>>
std::deque< T, Alloc >::allocator_type NAV::TsDeque< T, Alloc >::get_allocator ( ) const
inlinenoexcept

Returns the allocator associated with the container.

Returns
The associated allocator.

Definition at line 167 of file TsDeque.hpp.

◆ insert() [1/5]

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::iterator NAV::TsDeque< T, Alloc >::insert ( typename std::deque< T >::const_iterator pos,
const T & value )
inline

Insert value before pos in the container.

Parameters
[in]posIterator before which the content will be inserted. pos may be the end() iterator
[in]valueElement value to insert
Returns
Iterator pointing to the inserted value

Definition at line 320 of file TsDeque.hpp.

◆ insert() [2/5]

template<class T, class Alloc = std::allocator<T>>
template<class InputIt>
std::deque< T >::iterator NAV::TsDeque< T, Alloc >::insert ( typename std::deque< T >::const_iterator pos,
InputIt first,
InputIt last )
inline

inserts elements from range [first, last) before pos.

Template Parameters
InputItInput iterator type
Parameters
[in]posIterator before which the content will be inserted. pos may be the end() iterator
[in]firstThe first element of the range of elements to insert, can't be iterators into container for which insert is called
[in]lastThe last element of the range of elements to insert, can't be iterators into container for which insert is called
Returns
Iterator pointing to the first element inserted, or pos if first==last.

Definition at line 354 of file TsDeque.hpp.

◆ insert() [3/5]

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::iterator NAV::TsDeque< T, Alloc >::insert ( typename std::deque< T >::const_iterator pos,
std::initializer_list< T > ilist )
inline

Inserts elements from initializer list ilist before pos.

Parameters
[in]posIterator before which the content will be inserted. pos may be the end() iterator
[in]ilistInitializer list to insert the values from
Returns
Iterator pointing to the first element inserted, or pos if ilist is empty.

Definition at line 364 of file TsDeque.hpp.

◆ insert() [4/5]

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::iterator NAV::TsDeque< T, Alloc >::insert ( typename std::deque< T >::const_iterator pos,
T && value )
inline

Insert value before pos in the container.

Parameters
[in]posIterator before which the content will be inserted. pos may be the end() iterator
[in]valueElement value to insert
Returns
Iterator pointing to the inserted value

Definition at line 330 of file TsDeque.hpp.

◆ insert() [5/5]

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::iterator NAV::TsDeque< T, Alloc >::insert ( typename std::deque< T >::const_iterator pos,
typename std::deque< T, Alloc >::size_type count,
const T & value )
inline

inserts count copies of the value before pos

Parameters
[in]posIterator before which the content will be inserted. pos may be the end() iterator
[in]countNumber of elements to insert
[in]valueElement value to insert
Returns
Linear in count plus linear in the lesser of the distances between pos and either of the ends of the container.

Definition at line 341 of file TsDeque.hpp.

◆ max_size()

template<class T, class Alloc = std::allocator<T>>
std::deque< T, Alloc >::size_type NAV::TsDeque< T, Alloc >::max_size ( ) const
inlinenoexcept

Returns the maximum number of elements the container is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest container.

Returns
Maximum number of elements.

Definition at line 291 of file TsDeque.hpp.

◆ operator=() [1/3]

template<class T, class Alloc = std::allocator<T>>
TsDeque & NAV::TsDeque< T, Alloc >::operator= ( const TsDeque< T, Alloc > & other)
inline

Copy assignment operator.

Definition at line 105 of file TsDeque.hpp.

◆ operator=() [2/3]

template<class T, class Alloc = std::allocator<T>>
TsDeque & NAV::TsDeque< T, Alloc >::operator= ( std::initializer_list< T > ilist)
inline

Replaces the contents with those identified by initializer list ilist.

Parameters
ilistInitializer list to use as data source

Definition at line 128 of file TsDeque.hpp.

◆ operator=() [3/3]

template<class T, class Alloc = std::allocator<T>>
TsDeque & NAV::TsDeque< T, Alloc >::operator= ( TsDeque< T, Alloc > && other)
inlinenoexcept

Move assignment operator.

Definition at line 116 of file TsDeque.hpp.

◆ operator[]() [1/2]

template<class T, class Alloc = std::allocator<T>>
auto & NAV::TsDeque< T, Alloc >::operator[] ( typename std::deque< T, Alloc >::size_type pos)
inline

Returns a reference to the element at specified location pos. No bounds checking is performed.

Parameters
[in]posPosition of the element to return
Returns
Reference to the requested element.

Definition at line 190 of file TsDeque.hpp.

◆ operator[]() [2/2]

template<class T, class Alloc = std::allocator<T>>
const auto & NAV::TsDeque< T, Alloc >::operator[] ( typename std::deque< T, Alloc >::size_type pos) const
inline

Returns a reference to the element at specified location pos. No bounds checking is performed.

Parameters
[in]posPosition of the element to return
Returns
Reference to the requested element.

Definition at line 194 of file TsDeque.hpp.

◆ pop_back()

template<class T, class Alloc = std::allocator<T>>
void NAV::TsDeque< T, Alloc >::pop_back ( )
inline

Removes the last element of the container.

Definition at line 427 of file TsDeque.hpp.

◆ pop_front()

template<class T, class Alloc = std::allocator<T>>
void NAV::TsDeque< T, Alloc >::pop_front ( )
inline

Removes the first element of the container. If there are no elements in the container, the behavior is undefined.

Definition at line 461 of file TsDeque.hpp.

◆ push_back() [1/2]

template<class T, class Alloc = std::allocator<T>>
void NAV::TsDeque< T, Alloc >::push_back ( const T & value)
inline

Appends the given element value to the end of the container. The new element is initialized as a copy of value.

Parameters
[in]valueThe value of the element to append

Definition at line 403 of file TsDeque.hpp.

◆ push_back() [2/2]

template<class T, class Alloc = std::allocator<T>>
void NAV::TsDeque< T, Alloc >::push_back ( T && value)
inline

Appends the given element value to the end of the container. Value is moved into the new element.

Parameters
[in]valueThe value of the element to append

Definition at line 410 of file TsDeque.hpp.

◆ push_front() [1/2]

template<class T, class Alloc = std::allocator<T>>
void NAV::TsDeque< T, Alloc >::push_front ( const T & value)
inline

Prepends the given element value to the beginning of the container. The new element is initialized as a copy of value. All iterators, including the past-the-end iterator, are invalidated. No references are invalidated.

Parameters
[in]valueThe value of the element to prepend

Definition at line 436 of file TsDeque.hpp.

◆ push_front() [2/2]

template<class T, class Alloc = std::allocator<T>>
void NAV::TsDeque< T, Alloc >::push_front ( T && value)
inline

Prepends the given element value to the beginning of the container. Value is moved into the new element. All iterators, including the past-the-end iterator, are invalidated. No references are invalidated.

Parameters
[in]valueThe value of the element to prepend

Definition at line 444 of file TsDeque.hpp.

◆ rbegin() [1/2]

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::const_reverse_iterator NAV::TsDeque< T, Alloc >::rbegin ( ) const
inlinenoexcept

Returns a reverse iterator to the first element of the reversed deque. It corresponds to the last element of the non-reversed deque. If the deque is empty, the returned iterator is equal to rend().

Returns
Reverse iterator to the first element.

Definition at line 247 of file TsDeque.hpp.

◆ rbegin() [2/2]

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::reverse_iterator NAV::TsDeque< T, Alloc >::rbegin ( )
inlinenoexcept

Returns a reverse iterator to the first element of the reversed deque. It corresponds to the last element of the non-reversed deque. If the deque is empty, the returned iterator is equal to rend().

Returns
Reverse iterator to the first element.

Definition at line 243 of file TsDeque.hpp.

◆ rend() [1/2]

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::const_reverse_iterator NAV::TsDeque< T, Alloc >::rend ( ) const
inlinenoexcept

Returns a reverse iterator to the element following the last element of the reversed deque. It corresponds to the element preceding the first element of the non-reversed deque. This element acts as a placeholder, attempting to access it results in undefined behavior.

Returns
Reverse iterator to the element following the last element.

Definition at line 262 of file TsDeque.hpp.

◆ rend() [2/2]

template<class T, class Alloc = std::allocator<T>>
std::deque< T >::reverse_iterator NAV::TsDeque< T, Alloc >::rend ( )
inlinenoexcept

Returns a reverse iterator to the element following the last element of the reversed deque. It corresponds to the element preceding the first element of the non-reversed deque. This element acts as a placeholder, attempting to access it results in undefined behavior.

Returns
Reverse iterator to the element following the last element.

Definition at line 257 of file TsDeque.hpp.

◆ resize() [1/2]

template<class T, class Alloc = std::allocator<T>>
void NAV::TsDeque< T, Alloc >::resize ( typename std::deque< T, Alloc >::size_type count)
inline

Resizes the container to contain count elements.

Parameters
[in]countNew size of the container

Definition at line 469 of file TsDeque.hpp.

◆ resize() [2/2]

template<class T, class Alloc = std::allocator<T>>
void NAV::TsDeque< T, Alloc >::resize ( typename std::deque< T, Alloc >::size_type count,
const T & value )
inline

Resizes the container to contain count elements.

Parameters
[in]countNew size of the container
[in]valueThe value to initialize the new elements with

Definition at line 477 of file TsDeque.hpp.

◆ shrink_to_fit()

template<class T, class Alloc = std::allocator<T>>
void NAV::TsDeque< T, Alloc >::shrink_to_fit ( )
inline

Requests the removal of unused capacity.

Definition at line 298 of file TsDeque.hpp.

◆ size()

template<class T, class Alloc = std::allocator<T>>
std::deque< T, Alloc >::size_type NAV::TsDeque< T, Alloc >::size ( ) const
inlinenoexcept

Returns the number of elements in the container, i.e. std::distance(begin(), end()).

Returns
The number of elements in the container.

Definition at line 283 of file TsDeque.hpp.

◆ swap()

template<class T, class Alloc = std::allocator<T>>
void NAV::TsDeque< T, Alloc >::swap ( std::deque< T > & other)
inlinenoexcept

Exchanges the contents of the container with those of other. Does not invoke any move, copy, or swap operations on individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated.

Parameters
[in,out]otherContainer to exchange the contents with

Definition at line 486 of file TsDeque.hpp.

Field Documentation

◆ _mutex

template<class T, class Alloc = std::allocator<T>>
std::mutex NAV::TsDeque< T, Alloc >::_mutex
mutableprivate

Mutex to interact with the queue object.

Definition at line 510 of file TsDeque.hpp.

◆ _queue

template<class T, class Alloc = std::allocator<T>>
std::deque<T, Alloc> NAV::TsDeque< T, Alloc >::_queue
private

Queue with received data.

Definition at line 507 of file TsDeque.hpp.


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