gem5  v20.1.0.0
Public Member Functions | Public Attributes | Private Member Functions | Friends | List of all members
CircularQueue< T >::iterator Struct Reference

Iterator to the circular queue. More...

#include <circular_queue.hh>

Public Types

using value_type = T
 Iterator Traits. More...
 
using difference_type = std::ptrdiff_t
 
using reference = value_type &
 
using const_reference = const value_type &
 
using pointer = value_type *
 
using const_pointer = const value_type *
 
using iterator_category = std::random_access_iterator_tag
 

Public Member Functions

 iterator (CircularQueue *cq, uint32_t idx, uint32_t round)
 
 iterator ()
 Trait reference type iterator satisfies OutputIterator, therefore reference must be T&. More...
 
 iterator (const iterator &it)
 
iteratoroperator= (const iterator &it)
 
 ~iterator ()
 
bool dereferenceable () const
 Test dereferenceability. More...
 
bool operator== (const iterator &that) const
 InputIterator. More...
 
bool operator!= (const iterator &that)
 Inequality operator. More...
 
reference operator* ()
 Dereference operator. More...
 
const_reference operator* () const
 
pointer operator-> ()
 Dereference operator. More...
 
const_pointer operator-> () const
 
iteratoroperator++ ()
 Pre-increment operator. More...
 
iterator operator++ (int)
 Post-increment operator. More...
 
iteratoroperator-- ()
 Pre-decrement operator. More...
 
iterator operator-- (int)
 Post-decrement operator. More...
 
iteratoroperator+= (const difference_type &t)
 RandomAccessIterator requirements. More...
 
iteratoroperator-= (const difference_type &t)
 
iterator operator+ (const difference_type &t)
 Addition operator. More...
 
iterator operator- (const difference_type &t)
 Substraction operator. More...
 
difference_type operator- (const iterator &that)
 Difference operator. More...
 
template<typename Idx >
std::enable_if< std::is_integral< Idx >::value, reference >::type operator[] (const Idx &index)
 Index operator. More...
 
bool operator< (const iterator &that) const
 Comparisons. More...
 
bool operator> (const iterator &that) const
 
bool operator>= (const iterator &that) const
 
bool operator<= (const iterator &that) const
 
size_t idx () const
 OutputIterator has no extra requirements. More...
 

Public Attributes

CircularQueue_cq
 
uint32_t _idx
 
uint32_t _round
 

Private Member Functions

bool decrementable () const
 ForwardIterator The multipass guarantee is provided by the reliance on _idx. More...
 

Friends

iterator operator+ (const difference_type &t, iterator &it)
 
iterator operator- (const difference_type &t, iterator &it)
 

Detailed Description

template<typename T>
struct CircularQueue< T >::iterator

Iterator to the circular queue.

iterator implementation to provide the circular-ness that the standard std::vector<T>::iterator does not implement. Iterators to a queue are represented by a pair of a character and the round counter. For the character, '*' denotes the element pointed to by the iterator if it is valid. 'x' denotes the element pointed to by the iterator when it is BTB or PTE. E.g.:

Definition at line 155 of file circular_queue.hh.

Member Function Documentation

◆ decrementable()

template<typename T >
bool CircularQueue< T >::iterator::decrementable ( ) const
inlineprivate

ForwardIterator The multipass guarantee is provided by the reliance on _idx.

BidirectionalIterator requirements. Test decrementability. An iterator to a non-null circular queue is not-decrementable if it is pointing to the head element, unless the queue is full and we are talking about the past-the-end iterator. In that case, the iterator round equals the cq round unless the head is at the zero position and the round is one more than the cq round.

Definition at line 347 of file circular_queue.hh.

References CircularQueue< T >::iterator::_cq, CircularQueue< T >::iterator::_idx, CircularQueue< T >::_round, CircularQueue< T >::iterator::_round, CircularQueue< T >::empty(), and CircularQueue< T >::head().

Referenced by CircularQueue< T >::iterator::operator--().

◆ idx()

template<typename T >
size_t CircularQueue< T >::iterator::idx ( ) const
inline

OutputIterator has no extra requirements.

Definition at line 510 of file circular_queue.hh.

References CircularQueue< T >::iterator::_idx.

Referenced by LSQUnit< Impl >::completeStore(), and LSQUnit< Impl >::writebackStores().

Member Data Documentation

◆ _cq

template<typename T >
CircularQueue* CircularQueue< T >::iterator::_cq

◆ _idx

template<typename T >
uint32_t CircularQueue< T >::iterator::_idx

◆ _round

template<typename T >
uint32_t CircularQueue< T >::iterator::_round

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

Generated on Wed Sep 30 2020 14:02:22 for gem5 by doxygen 1.8.17