Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::FixedQueue< T > Class Template Reference

Very simple queue implemented with a contiguous array. More...

#include <tpl_arrayQueue.H>

Inheritance diagram for Aleph::FixedQueue< T >:
[legend]
Collaboration diagram for Aleph::FixedQueue< T >:
[legend]

Classes

struct  Iterator
 Simple iterator on elements of a queue. More...
 

Public Types

using Item_Type = T
 
using Const_Iterator = Aleph::Const_Iterator< Iterator >
 Read-only iterator: the iterator of a constant container.
 
- Public Types inherited from StlAlephIterator< FixedQueue< T > >
using iterator = StlIterator< FixedQueue< T > >
 
using const_iterator = StlConstIterator< FixedQueue< T > >
 

Public Member Functions

void swap (FixedQueue &q) noexcept
 
void empty () noexcept
 empty the queue
 
void clear () noexcept
 Empties the container.
 
 FixedQueue (size_t d=1024)
 Construct a queue of capacity the immediately two power of d
 
 ~FixedQueue ()
 
 FixedQueue (const FixedQueue &q)
 Copy constructor: the copy holds the items of q, in the same slots.
 
 FixedQueue (FixedQueue &&q) noexcept
 Move constructor: takes the array and the items of q.
 
template<template< typename > class List>
 FixedQueue (const List< T > &l)
 
template<class It >
requires (not std::is_arithmetic_v<It> and requires (It it) { *it; ++it; it != it; })
 FixedQueue (It b, It e)
 
 FixedQueue (std::initializer_list< T > l)
 
FixedQueue & operator= (const FixedQueue &q)
 Copy assign.
 
FixedQueue & operator= (FixedQueue &&q) noexcept
 Move assign.
 
T & put (const T &item) noexcept
 Put an item into the queue by copy.
 
T & put (T &&item) noexcept
 See put(const T& item).
 
T & append (const T &item) noexcept
 See put(const T& item).
 
T & append (T &&item) noexcept
 See put(const T& item).
 
T & insert (const T &item) noexcept
 See put(const T& item).
 
T & insert (T &&item) noexcept
 See put(const T& item).
 
T & putn (const size_t n) noexcept
 Put n cells to the queue in constant time.
 
T get () noexcept
 Remove the oldest item of the queue.
 
T & getn (const size_t n) noexcept
 Remove in constant time the n oldest items of the queue.
 
T & front (const size_t i=0) noexcept
 Return the i-th oldest item.
 
const T & front (const size_t i=0) const noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.
 
T & rear (const size_t i=0) noexcept
 Return the i-th youngest item.
 
const T & rear (const size_t i=0) const noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.
 
constexpr size_t size () const noexcept
 Return the number of items.
 
constexpr bool is_empty () const noexcept
 Return true if the queue is empty.
 
constexpr size_t capacity () const noexcept
 Return the queue capacity (maximum number of element to be stored)
 
template<class Operation >
requires Aleph::PredicateWith<Operation &, T &>
bool traverse (Operation &operation) noexcept(Aleph::NothrowPredicateWith< Operation &, T & >)
 Traverse all the elements from the youngest to the oldest and execute operation on each on them.
 
template<class Operation >
requires Aleph::PredicateWith<Operation &, const T &>
bool traverse (Operation &operation) const noexcept(Aleph::NothrowPredicateWith< Operation &, const T & >)
 See traverse(Operation & operation).
 
template<class Operation >
requires Aleph::PredicateWith<Operation &, const T &>
bool traverse (Operation &&operation=Operation()) const noexcept(Aleph::NothrowPredicateWith< Operation &, const T & >)
 See traverse(Operation & operation).
 
template<class Operation >
requires Aleph::PredicateWith<Operation &, T &>
bool traverse (Operation &&operation=Operation()) noexcept(Aleph::NothrowPredicateWith< Operation &, T & >)
 See traverse(Operation & operation).
 
- Public Member Functions inherited from LocateFunctions< FixedQueue< T >, T >
auto get_it ()
 Return a properly initialized iterator positioned at the first item on the container.
 
auto get_it () const
 Read-only iterator positioned at the first item.
 
auto get_it (const size_t pos)
 Return a properly initialized iterator positioned at the pos item on the container.
 
auto get_it (const size_t pos) const
 Read-only iterator positioned at the pos item.
 
auto get_itor ()
 Alias of get_it().
 
auto get_itor () const
 See get_itor().
 
T & nth_ne (const size_t n) noexcept(Aleph::dry_detail::mutable_traversal_is_noexcept< C, T >)
 Return the n‑th element without bounds checking.
 
const T & nth_ne (const size_t n) const noexcept(Aleph::dry_detail::const_traversal_is_noexcept< FixedQueue< T >, T >)
 Constant overload of nth_ne(size_t).
 
T & nth (const size_t n)
 Return the n-th item of the container.
 
const T & nth (const size_t n) const
 Const overload of nth(size_t).
 
and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< FixedQueue< T >, Operation >::type, T > T * find_ptr (Operation &operation) noexcept(mutable_search_is_noexcept< Operation >())
 Find a pointer to an item in the container according to a searching criterion.
 
const T * find_ptr (Operation &operation) const noexcept(const_search_is_noexcept< Operation >())
 Const overload of find_ptr(Operation&).
 
const T * find_ptr (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >())
 Overload of find_ptr() const that accepts rvalues.
 
and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< FixedQueue< T >, Operation >::type, T > T * find_ptr (Operation &&operation) noexcept(mutable_search_is_noexcept< Operation >())
 Overload of find_ptr() that accepts rvalues.
 
size_t find_index (Operation &operation) const noexcept(const_search_is_noexcept< Operation >())
 Find the position of an item in the container according to a searching criterion.
 
size_t find_index (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >())
 Overload of find_index() that accepts rvalues.
 
and std::default_initializable< T > and std::copy_constructible< T > std::tuple< bool, T > find_item (Operation &operation) const noexcept(find_item_is_noexcept< Operation >())
 Safe sequential searching of an item matching a criterion.
 
and std::default_initializable< T > and std::copy_constructible< T > std::tuple< bool, T > find_item (Operation &&operation) const noexcept(find_item_is_noexcept< Operation >())
 Overload of find_item() that accepts rvalues.
 
and std::copy_constructible< T > std::optional< T > find_opt (Operation &operation) const
 Copy of the first item satisfying a criterion, if any.
 
and std::copy_constructible< T > std::optional< T > find_opt (Operation &&operation) const
 Overload of find_opt() that accepts rvalues.
 
bool contains_if (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >())
 Test if an item satisfying a criterion is present in the container.
 
bool contains (const T &item) const
 Test if an item is present in the container using equality.
 
- Public Member Functions inherited from FunctionalMethods< FixedQueue< T >, T >
void emplace (Args &&... args)
 Appends a new element into the container by constructing it from the given args.
 
void emplace_end (Args &&... args)
 See emplace(Args && ... args).
 
void emplace_ins (Args &&... args)
 
size_t ninsert (Args &&... args)
 Insert n variadic items.
 
size_t nappend (Args &&... args)
 Append n variadic items.
 
void for_each (Operation &operation) const
 Traverse all the container and performs an operation on each element.
 
void for_each (Operation &&operation) const
 Overload of for_each() that accepts rvalues.
 
void each (Operation &operation) const
 Alias of for_each().
 
void each (Operation &&operation) const
 Alias of for_each() that accepts rvalues.
 
void each (const size_t pos, const size_t slice, Operation &operation) const
 Traverse the container starting at pos taking one item every slice, performing an operation on each visited element.
 
void each (const size_t pos, const size_t slice, Operation &&operation) const
 See each(size_t pos, size_t slice, Operation & operation) const.
 
and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< FixedQueue< T >, Operation >::type, T > void each (const size_t pos, const size_t slice, Operation &operation)
 Traverse the container starting at pos taking one item every slice, performing an operation that may modify each visited item.
 
and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< FixedQueue< T >, Operation >::type, T > void each (const size_t pos, const size_t slice, Operation &&operation)
 See each(size_t pos, size_t slice, Operation & operation).
 
and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< FixedQueue< T >, Operation >::type, T > void mutable_for_each (Operation &operation)
 Apply a mutable operation to each element of the container.
 
and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< FixedQueue< T >, Operation >::type, T > void mutable_for_each (Operation &&operation)
 See mutable_for_each(Operation & operation).
 
bool all (Operation &operation) const
 Check if all the elements of the container satisfy a condition.
 
bool all (Operation &&operation) const
 Overload of all() that accepts rvalues.
 
bool exists (Operation &op) const
 Test for existence in the container of an element satisfying a criterion.
 
bool exists (Operation &&op) const
 Overload of exists() that accepts rvalues.
 
bool none (Operation &op) const
 Test that no element satisfies a criterion.
 
bool none (Operation &&op) const
 Overload of none() that accepts rvalues.
 
size_t count_if (Operation &op) const
 Count the elements that satisfy a criterion.
 
size_t count_if (Operation &&op) const
 Overload of count_if() that accepts rvalues.
 
Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > maps (Operation &op) const
 
Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > maps (Operation &&op) const
 
Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > maps_if (Prop prop, Operation &op) const
 
Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > maps_if (Prop prop, Operation &&op) const
 
Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > map (Operation &op) const
 
Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > map (Operation &&op) const
 
Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > map_if (Prop prop, Operation &op) const
 
Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > map_if (Prop prop, Operation &&op) const
 
auto flat_map (Operation &op) const
 Map each element to a container and concatenate the results.
 
auto flat_map (Operation &&op) const
 Overload of flat_map() that accepts rvalues.
 
Aleph::DynList< T > to_dynlist () const
 Convert container to DynList.
 
std::vector< T > to_vector () const
 Convert container to std::vector.
 
Acc foldl (const Acc &init, Op &op) const
 Fold the elements of the container to a specific result.
 
Acc foldl (const Acc &init, Op &&op) const
 Overload of foldl() that accepts rvalues.
 
Acc fold_left (const Acc &init, Op &op) const
 Alias for foldl().
 
Acc fold_left (const Acc &init, Op &&op) const
 Overload of fold_left() that accepts rvalues.
 
T fold (const T &init, Operation &operation) const
 Simplified version of foldl() where the folded type is the same type of elements stored in the container.
 
T fold (const T &init, Operation &&operation) const
 Overload of fold() that accepts rvalues.
 
Acc foldr (const Acc &init, Op &op) const
 Fold the elements from the last to the first.
 
Acc foldr (const Acc &init, Op &&op) const
 Overload of foldr() that accepts rvalues.
 
and std::copy_constructible< U > std::optional< T > reduce (Op &op) const
 Fold the elements with no initial value.
 
and std::copy_constructible< U > std::optional< T > reduce (Op &&op) const
 Overload of reduce() that accepts rvalues.
 
Aleph::DynList< T > filter (Operation &operation) const
 Filter the elements of a container according to a matching criterion.
 
Aleph::DynList< T > filter (Operation &&operation) const
 Overload of filter() that accepts rvalues.
 
Aleph::DynList< const T * > ptr_filter (Operation &operation) const
 Filter the elements of a container according to a matching criterion and return a pointer to the matched items in the container.
 
Aleph::DynList< const T * > ptr_filter (Operation &&operation) const
 Overload of ptr_filter() that accepts rvalues.
 
Aleph::DynList< std::tuple< T, size_t > > pfilter (Operation &operation) const
 Filter the elements of a container according to a matching criterion and determine its positions respect to the traversal of container.
 
Aleph::DynList< std::tuple< T, size_t > > pfilter (Operation &&operation) const
 Overload of pfilter() that accepts rvalues.
 
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (Operation &op) const
 Exclusive partition of container according to a filter criterion.
 
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (Operation &&op) const
 Overload of partition() that accepts rvalues.
 
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (size_t n) const
 Exclusive partition of container in the nth item.
 
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > split_half () const
 Split the container into two halves by alternating elements.
 
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > tpartition (Operation &op) const
 Exclusive partition of container according to a filter criterion.
 
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > tpartition (Operation &&op) const
 Overload of tpartition() that accepts rvalues.
 
size_t length () const noexcept(Aleph::dry_detail::const_traversal_is_noexcept< FixedQueue< T >, T >)
 Count the number of elements of a container.
 
Aleph::DynList< T > rev () const
 Return a list with the elements of container in reverse order respect to its traversal order.
 
Aleph::DynList< T > take (const size_t n) const
 Return a list with the first n elements seen in the container during its traversal.
 
Aleph::DynList< T > take (size_t i, const size_t j, const size_t step=1) const
 Return a list with the elements at positions i, i + step, i + 2 step, ... that are not greater than j, respect to the traversal order.
 
Aleph::DynList< T > drop (const size_t n) const
 Drop the first n elements seen in the container during its traversal.
 
Aleph::DynList< T > take_while (Operation &op) const
 The longest prefix of elements that satisfy a criterion.
 
Aleph::DynList< T > take_while (Operation &&op) const
 Overload of take_while() that accepts rvalues.
 
Aleph::DynList< T > drop_while (Operation &op) const
 The elements after the longest prefix that satisfies a criterion.
 
Aleph::DynList< T > drop_while (Operation &&op) const
 Overload of drop_while() that accepts rvalues.
 
void mutable_drop (const size_t n)
 Drop the first n elements seen from container.
 
- Public Member Functions inherited from GenericItems< Container, T >
Aleph::DynList< T > items () const
 Return a list of all the elements of a container sorted by traversal order.
 
Aleph::DynList< T > keys () const
 See items().
 
- Public Member Functions inherited from EqualSequenceMethod< FixedQueue< T > >
bool equal_to (const FixedQueue< T > &r) const
 Equality test between this and r.
 
- Public Member Functions inherited from StlAlephIterator< FixedQueue< T > >
iterator begin () noexcept
 Return an STL-compatible iterator to the first element.
 
const_iterator begin () const noexcept
 Return a const iterator to the first element.
 
iterator end () noexcept
 Return an STL-compatible end iterator.
 
const_iterator end () const noexcept
 Return a const end iterator.
 
const_iterator cbegin () const noexcept
 Return a const iterator to the first element.
 
const_iterator cend () const noexcept
 Return a const end iterator.
 

Private Member Functions

void increase_index (size_t &i, const size_t inc=1) const noexcept
 
T & rear_item (const size_t i=0) noexcept
 
const T & rear_item (const size_t i=0) const noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.
 

Private Attributes

size_t dim
 
T * array
 
size_t front_index
 
size_t rear_index
 
size_t mask
 
size_t num_items
 

Additional Inherited Members

- Static Public Member Functions inherited from FunctionalMethods< FixedQueue< T >, T >
static FixedQueue< T > build (Items &&... items)
 Build a container that holds the given items.
 
static D build_as (Items &&... items)
 Build a D, a class derived from the container, holding the given items.
 
- Public Attributes inherited from FunctionalMethods< FixedQueue< T >, T >
 and
 Insert a new element into the container by constructing it from the given args.
 
and Aleph::InvocableWith< Operation &, const T & > and
 Conditional mapping of the elements of the container.
 

Detailed Description

template<typename T>
class Aleph::FixedQueue< T >

Very simple queue implemented with a contiguous array.

The capacity is given in construction time, but this is adjusted to the next two power immediately greater.

This queue is the fastest of Aleph-w ( \(\aleph_\omega\)), but take in account that no bound_statics cheks are performed. You must be sure that you usage is correct.

See also
ArrayQueue DynListQueue

Definition at line 661 of file tpl_arrayQueue.H.

Member Typedef Documentation

◆ Const_Iterator

Read-only iterator: the iterator of a constant container.

Definition at line 1045 of file tpl_arrayQueue.H.

◆ Item_Type

template<typename T >
using Aleph::FixedQueue< T >::Item_Type = T

Definition at line 699 of file tpl_arrayQueue.H.

Constructor & Destructor Documentation

◆ FixedQueue() [1/6]

template<typename T >
Aleph::FixedQueue< T >::FixedQueue ( size_t  d = 1024)
inline

Construct a queue of capacity the immediately two power of d

The resulting capacity will be the first number such \(2^k \geq d\),

Parameters
[in]dminimum capacity; 0 gives a capacity of 1.
Exceptions
overflow_errorif that power of two, or its bytes, do not fit in a size_t.
bad_allocif there is no memory for the array

Definition at line 737 of file tpl_arrayQueue.H.

References ah_overflow_error_if, Aleph::FixedQueue< T >::array, Aleph::FixedQueue< T >::dim, and Aleph::FixedQueue< T >::mask.

◆ ~FixedQueue()

template<typename T >
Aleph::FixedQueue< T >::~FixedQueue ( )
inline

Definition at line 757 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::array.

◆ FixedQueue() [2/6]

template<typename T >
Aleph::FixedQueue< T >::FixedQueue ( const FixedQueue< T > &  q)
inline

Copy constructor: the copy holds the items of q, in the same slots.

Parameters
[in]qthe queue to copy.
Exceptions
bad_allocif there is no enough memory, or anything that the copy assignment of T throws; nothing leaks then.

Definition at line 769 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::array, Aleph::FixedQueue< T >::front_index, Aleph::FixedQueue< T >::increase_index(), and Aleph::FixedQueue< T >::num_items.

◆ FixedQueue() [3/6]

template<typename T >
Aleph::FixedQueue< T >::FixedQueue ( FixedQueue< T > &&  q)
inlinenoexcept

Move constructor: takes the array and the items of q.

Parameters
[in,out]qthe queue to move from. It is left empty, without array and with a capacity of 0, as a moved-from FixedStack: it must be assigned another queue before it takes an item.
Note
It allocates nothing: q is not given an array of the default capacity, which could not be allocated without memory.

Definition at line 796 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::swap().

◆ FixedQueue() [4/6]

template<typename T >
template<template< typename > class List>
Aleph::FixedQueue< T >::FixedQueue ( const List< T > &  l)
inline

Definition at line 802 of file tpl_arrayQueue.H.

◆ FixedQueue() [5/6]

template<typename T >
template<class It >
requires (not std::is_arithmetic_v<It> and requires (It it) { *it; ++it; it != it; })
Aleph::FixedQueue< T >::FixedQueue ( It  b,
It  e 
)
inline

Definition at line 802 of file tpl_arrayQueue.H.

◆ FixedQueue() [6/6]

template<typename T >
Aleph::FixedQueue< T >::FixedQueue ( std::initializer_list< T >  l)
inline

Definition at line 802 of file tpl_arrayQueue.H.

Member Function Documentation

◆ append() [1/2]

template<typename T >
T & Aleph::FixedQueue< T >::append ( const T &  item)
inlinenoexcept

See put(const T& item).

Definition at line 849 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::put().

◆ append() [2/2]

template<typename T >
T & Aleph::FixedQueue< T >::append ( T &&  item)
inlinenoexcept

See put(const T& item).

Definition at line 855 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::put().

◆ capacity()

template<typename T >
constexpr size_t Aleph::FixedQueue< T >::capacity ( ) const
inlineconstexprnoexcept

Return the queue capacity (maximum number of element to be stored)

Definition at line 963 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::dim.

Referenced by TEST(), TEST(), and TEST().

◆ clear()

template<typename T >
void Aleph::FixedQueue< T >::clear ( )
inlinenoexcept

Empties the container.

Exceptions
none
See also
empty()

Definition at line 722 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::empty().

◆ empty()

template<typename T >
void Aleph::FixedQueue< T >::empty ( )
inlinenoexcept

◆ front() [1/2]

template<typename T >
const T & Aleph::FixedQueue< T >::front ( const size_t  i = 0) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.

Definition at line 925 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::array, Aleph::FixedQueue< T >::front_index, Aleph::FixedQueue< T >::mask, and Aleph::FixedQueue< T >::num_items.

◆ front() [2/2]

template<typename T >
T & Aleph::FixedQueue< T >::front ( const size_t  i = 0)
inlinenoexcept

Return the i-th oldest item.

Parameters
[in]iaccess position respect to oldest item
Returns
a modifiable reference to the i-th item

Definition at line 917 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::array, Aleph::FixedQueue< T >::front_index, Aleph::FixedQueue< T >::mask, and Aleph::FixedQueue< T >::num_items.

Referenced by TEST(), TEST(), and TEST().

◆ get()

◆ getn()

template<typename T >
T & Aleph::FixedQueue< T >::getn ( const size_t  n)
inlinenoexcept

Remove in constant time the n oldest items of the queue.

Parameters
[in]nnumber of items to remove
Returns
a modifiable reference to the current oldest item in the queue after the removal of n entries

Definition at line 904 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::array, Aleph::FixedQueue< T >::front_index, Aleph::FixedQueue< T >::increase_index(), and Aleph::FixedQueue< T >::num_items.

◆ increase_index()

◆ insert() [1/2]

template<typename T >
T & Aleph::FixedQueue< T >::insert ( const T &  item)
inlinenoexcept

See put(const T& item).

Definition at line 861 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::put().

◆ insert() [2/2]

template<typename T >
T & Aleph::FixedQueue< T >::insert ( T &&  item)
inlinenoexcept

See put(const T& item).

Definition at line 867 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::put().

◆ is_empty()

template<typename T >
constexpr bool Aleph::FixedQueue< T >::is_empty ( ) const
inlineconstexprnoexcept

◆ operator=() [1/2]

template<typename T >
FixedQueue & Aleph::FixedQueue< T >::operator= ( const FixedQueue< T > &  q)
inline

Copy assign.

Definition at line 805 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::swap().

◆ operator=() [2/2]

template<typename T >
FixedQueue & Aleph::FixedQueue< T >::operator= ( FixedQueue< T > &&  q)
inlinenoexcept

Move assign.

Definition at line 816 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::swap().

◆ put() [1/2]

◆ put() [2/2]

template<typename T >
T & Aleph::FixedQueue< T >::put ( T &&  item)
inlinenoexcept

◆ putn()

template<typename T >
T & Aleph::FixedQueue< T >::putn ( const size_t  n)
inlinenoexcept

Put n cells to the queue in constant time.

Parameters
[in]nnumber of cells
Returns
a modifiable reference to the last inserted item

Definition at line 877 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::dim, Aleph::FixedQueue< T >::increase_index(), Aleph::FixedQueue< T >::num_items, Aleph::FixedQueue< T >::rear_index, and Aleph::FixedQueue< T >::rear_item().

Referenced by main().

◆ rear() [1/2]

template<typename T >
const T & Aleph::FixedQueue< T >::rear ( const size_t  i = 0) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.

Definition at line 944 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::num_items, and Aleph::FixedQueue< T >::rear_item().

◆ rear() [2/2]

template<typename T >
T & Aleph::FixedQueue< T >::rear ( const size_t  i = 0)
inlinenoexcept

Return the i-th youngest item.

Parameters
[in]iaccess position respect to youngest item
Returns
a modifiable reference to the i-th item

Definition at line 936 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::num_items, and Aleph::FixedQueue< T >::rear_item().

Referenced by main(), TEST(), and TEST().

◆ rear_item() [1/2]

template<typename T >
const T & Aleph::FixedQueue< T >::rear_item ( const size_t  i = 0) const
inlineprivatenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.

Definition at line 691 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::array, Aleph::FixedQueue< T >::dim, Aleph::FixedQueue< T >::mask, and Aleph::FixedQueue< T >::rear_index.

◆ rear_item() [2/2]

◆ size()

template<typename T >
constexpr size_t Aleph::FixedQueue< T >::size ( ) const
inlineconstexprnoexcept

Return the number of items.

Definition at line 951 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::num_items.

Referenced by WorkersSet< WorkerFct >::schedule_call(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ swap()

◆ traverse() [1/4]

template<typename T >
template<class Operation >
requires Aleph::PredicateWith<Operation &, const T &>
bool Aleph::FixedQueue< T >::traverse ( Operation &&  operation = Operation()) const
inlinenoexcept

See traverse(Operation & operation).

Definition at line 1006 of file tpl_arrayQueue.H.

◆ traverse() [2/4]

template<typename T >
template<class Operation >
requires Aleph::PredicateWith<Operation &, T &>
bool Aleph::FixedQueue< T >::traverse ( Operation &&  operation = Operation())
inlinenoexcept

See traverse(Operation & operation).

Definition at line 1015 of file tpl_arrayQueue.H.

◆ traverse() [3/4]

template<typename T >
template<class Operation >
requires Aleph::PredicateWith<Operation &, const T &>
bool Aleph::FixedQueue< T >::traverse ( Operation &  operation) const
inlinenoexcept

◆ traverse() [4/4]

template<typename T >
template<class Operation >
requires Aleph::PredicateWith<Operation &, T &>
bool Aleph::FixedQueue< T >::traverse ( Operation &  operation)
inlinenoexcept

Traverse all the elements from the youngest to the oldest and execute operation on each on them.

Parameters
[in]operationto be performed on each element
Returns
true if operation was executed on all elements; false otherwise.

Definition at line 977 of file tpl_arrayQueue.H.

References Aleph::FixedQueue< T >::array, Aleph::FixedQueue< T >::front_index, Aleph::FixedQueue< T >::increase_index(), and Aleph::FixedQueue< T >::num_items.

Referenced by TEST(), TEST(), and TEST().

Member Data Documentation

◆ array

◆ dim

◆ front_index

◆ mask

◆ num_items

◆ rear_index


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