The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator > Struct Template Reference

An iterator struct for this array. More...

#include <Array.hpp>

Inheritance diagram for sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >:
Collaboration diagram for sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >:

Public Member Functions

 ArrayIterator ()=default
 Default constructor.
 
 ArrayIterator (const ArrayIterator< false > &other)
 a copy constructor that allows for implicit conversion from a regular iterator to a const_iterator.
 
 ArrayIterator (const ArrayIterator< true > &other)
 a copy constructor that allows for implicit conversion from a const_iterator to a regular iterator.
 
ArrayIteratoroperator= (const ArrayIterator &other)=default
 Assignment operator.
 
void reset ()
 Reset the iterator to an invalid value.
 
bool isIndexValid () const
 Determine whether this iterator has been initialized with a valid index.
 
uint32_t getIndex () const
 What index does our iterator currently represent.
 
bool isValid () const
 Determine whether this array entry pointed to by this iterator is valid.
 
bool isOlder (const uint32_t idx) const
 determine if the data at this iterator was written before the data at another index.
 
bool isOlder (const ArrayIterator &other) const
 Overload isOlder to accept another iterator instead of an index.
 
bool isYounger (const uint32_t idx) const
 determine if the data at this iterator was written to more recently than another index.
 
bool isYounger (const ArrayIterator &other) const
 Overload isYounger to accept another iterator instead of index.
 
bool operator< (const ArrayIterator &rhs) const
 
bool operator== (const ArrayIterator &rhs) const
 
bool operator== (const uint32_t &rhs) const
 
bool operator!= (const ArrayIterator &rhs) const
 
DataReferenceType operator* ()
 support the dereference operator, non-const
 
DataReferenceType operator* () const
 support the dereference operator, const
 
value_type * operator-> ()
 support -> operator.
 
const value_type * operator-> () const
 
ArrayIteratoroperator++ ()
 pre-increment operator.
 
ArrayIterator operator++ (int)
 post-increment operator.
 

Additional Inherited Members

- Public Types inherited from sparta::utils::IteratorTraits< std::forward_iterator_tag, value_type >
using difference_type = long
 
using value_type = value_type
 
using pointer = const value_type *
 
using reference = const value_type &
 
using iterator_category = std::forward_iterator_tag
 

Detailed Description

template<class DataT, ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
struct sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >

An iterator struct for this array.

The iterator is a forward iterator and responds to post increment operators. The iterator will also wrap over the array when it reaches the end. The iterator can be queried for the validity of the position. The iterator provides public access to resetting the index it points to. Iterators can be dereferenced to provide the data at the index for which they point.

Definition at line 110 of file Array.hpp.

Constructor & Destructor Documentation

◆ ArrayIterator() [1/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::ArrayIterator ( const ArrayIterator< false > &  other)
inline

a copy constructor that allows for implicit conversion from a regular iterator to a const_iterator.

Definition at line 165 of file Array.hpp.

◆ ArrayIterator() [2/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::ArrayIterator ( const ArrayIterator< true > &  other)
inline

a copy constructor that allows for implicit conversion from a const_iterator to a regular iterator.

Definition at line 177 of file Array.hpp.

Member Function Documentation

◆ getIndex()

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
uint32_t sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::getIndex ( ) const
inline

What index does our iterator currently represent.

Definition at line 203 of file Array.hpp.

Here is the call graph for this function:

◆ isIndexValid()

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
bool sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::isIndexValid ( ) const
inline

Determine whether this iterator has been initialized with a valid index.

Definition at line 197 of file Array.hpp.

Here is the call graph for this function:

◆ isOlder() [1/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
bool sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::isOlder ( const ArrayIterator< is_const_iterator > &  other) const
inline

Overload isOlder to accept another iterator instead of an index.

Definition at line 233 of file Array.hpp.

Here is the call graph for this function:

◆ isOlder() [2/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
bool sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::isOlder ( const uint32_t  idx) const
inline

determine if the data at this iterator was written before the data at another index.

Parameters
otherthe other index.
Returns
true if the data at this iterator is older than the data at other.

Definition at line 225 of file Array.hpp.

Here is the call graph for this function:

◆ isValid()

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
bool sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::isValid ( ) const
inline

Determine whether this array entry pointed to by this iterator is valid.

Definition at line 211 of file Array.hpp.

◆ isYounger() [1/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
bool sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::isYounger ( const ArrayIterator< is_const_iterator > &  other) const
inline

Overload isYounger to accept another iterator instead of index.

Definition at line 256 of file Array.hpp.

Here is the call graph for this function:

◆ isYounger() [2/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
bool sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::isYounger ( const uint32_t  idx) const
inline

determine if the data at this iterator was written to more recently than another index.

Parameters
idxthe index of the other entry to be compared.
Returns
true if the data at this iterator was written to more frequently than the data at idx.

Definition at line 248 of file Array.hpp.

Here is the call graph for this function:

◆ operator!=()

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
bool sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::operator!= ( const ArrayIterator< is_const_iterator > &  rhs) const
inline

Definition at line 277 of file Array.hpp.

◆ operator*() [1/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
DataReferenceType sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::operator* ( )
inline

support the dereference operator, non-const

Definition at line 283 of file Array.hpp.

Here is the call graph for this function:

◆ operator*() [2/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
DataReferenceType sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::operator* ( ) const
inline

support the dereference operator, const

Definition at line 291 of file Array.hpp.

Here is the call graph for this function:

◆ operator++() [1/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
ArrayIterator & sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::operator++ ( )
inline

pre-increment operator.

Definition at line 314 of file Array.hpp.

Here is the call graph for this function:

◆ operator++() [2/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
ArrayIterator sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::operator++ ( int  )
inline

post-increment operator.

Definition at line 358 of file Array.hpp.

Here is the call graph for this function:

◆ operator->() [1/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
value_type * sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::operator-> ( )
inline

support -> operator.

Definition at line 299 of file Array.hpp.

Here is the call graph for this function:

◆ operator->() [2/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
const value_type * sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::operator-> ( ) const
inline

Definition at line 306 of file Array.hpp.

◆ operator<()

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
bool sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::operator< ( const ArrayIterator< is_const_iterator > &  rhs) const
inline

comparison operators NOTE: operator< and operator> were removed b/c they have no use case.

Definition at line 263 of file Array.hpp.

Here is the call graph for this function:

◆ operator==() [1/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
bool sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::operator== ( const ArrayIterator< is_const_iterator > &  rhs) const
inline

Definition at line 267 of file Array.hpp.

◆ operator==() [2/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
bool sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::operator== ( const uint32_t &  rhs) const
inline

Definition at line 272 of file Array.hpp.

◆ reset()

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
template<bool is_const_iterator = true>
void sparta::Array< DataT, ArrayT >::ArrayIterator< is_const_iterator >::reset ( )
inline

Reset the iterator to an invalid value.

Definition at line 191 of file Array.hpp.

Here is the call graph for this function:

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