Go to the documentation of this file.
38 #ifndef __BASE_CIRCULAR_QUEUE_HH__
39 #define __BASE_CIRCULAR_QUEUE_HH__
45 #include <type_traits>
115 static_assert(std::is_same_v<reference, T&>,
116 "reference type is not assignable as required");
341 return (ssize_t)
_idx - (ssize_t)that.
_idx;
350 template<
typename Idx>
351 typename std::enable_if_t<std::is_integral_v<Idx>,
reference>
354 return *(*
this +
index);
393 template <
typename Idx>
394 typename std::enable_if_t<std::is_integral_v<Idx>,
reference>
401 template <
typename Idx>
479 assert(num_elem <=
size());
535 if (
len > remaining) {
580 iterator
end() {
return iterator(
this,
tail() + 1); }
size_t idx() const
OutputIterator has no extra requirements.
void advance_tail()
Increases the tail by one.
iterator & operator+=(const difference_type &t)
RandomAccessIterator requirements.
friend iterator operator+(const difference_type &t, iterator &it)
std::ptrdiff_t difference_type
void advance_tail(size_t len)
Increases the tail by a specified number of steps.
bool operator!=(const iterator &that)
Inequality operator.
iterator & operator--()
ForwardIterator The multipass guarantee is provided by the reliance on _idx.
reference operator*()
Dereference operator.
typename std::vector< Tick >::const_reference const_reference
bool isValidIdx(size_t idx) const
Test if the index is in the range of valid elements.
static void overflow(double &c, const scfx_params ¶ms, bool &o_flag)
std::enable_if_t< std::is_integral_v< Idx >, reference > operator[](const Idx &index)
difference_type operator-(const iterator &that)
Difference operator.
iterator(const iterator &it)
Trait reference type iterator satisfies OutputIterator, therefore reference must be T&.
void push_back(typename std::vector< T >::value_type val)
Pushes an element at the end of the queue.
bool full() const
Is the queue full? A queue is full if the head is the 0^{th} element and the tail is the (size-1)^{th...
std::enable_if_t< std::is_integral_v< Idx >, const_reference > operator[](const Idx &index) const
const_reference operator*() const
iterator & operator=(const iterator &it)
iterator operator--(int)
Post-decrement operator.
iterator(CircularQueue *cq, size_t idx)
iterator & operator-=(const difference_type &t)
void flush()
Remove all the elements in the queue.
std::enable_if_t< std::is_integral_v< Idx >, reference > operator[](const Idx &index)
Index operator.
Iterator to the circular queue.
pointer operator->()
Dereference operator.
bool operator>(const iterator &that) const
iterator begin()
Iterators.
bool operator<(const iterator &that) const
Comparisons.
bool operator>=(const iterator &that) const
bool dereferenceable() const
Test dereferenceability.
const value_type & const_reference
iterator & operator++()
Pre-increment operator.
typename std::vector< Tick >::reference reference
const value_type * const_pointer
iterator operator+(const difference_type &t)
Addition operator.
T value_type
Iterator Traits.
friend iterator operator-(const difference_type &t, iterator &it)
void pop_front(size_t num_elem=1)
Circularly increase the head pointer.
void pop_back()
Circularly decrease the tail pointer.
bool empty() const
Is the queue empty?
CircularQueue(size_t size=0)
const_pointer operator->() const
bool operator<=(const iterator &that) const
iterator getIterator(size_t idx)
Return an iterator to an index in the queue.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
bool operator==(const iterator &that) const
InputIterator.
iterator operator++(int)
Post-increment operator.
std::random_access_iterator_tag iterator_category
iterator operator-(const difference_type &t)
Substraction operator.
Generated on Sun Jul 30 2023 01:56:50 for gem5 by doxygen 1.8.17