OpenMPCD
Public Member Functions | List of all members
OpenMPCD::StridedPointerIterator< Pointee, stride > Class Template Reference

Wraps a pointer in such a way that incrementing this iterator is equivalent to incrementing the underlying pointer once or more times, depending on the stride specified. More...

#include <StridedPointerIterator.hpp>

Public Member Functions

OPENMPCD_CUDA_HOST_AND_DEVICE StridedPointerIterator ()
 The default constructor. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE StridedPointerIterator (Pointee *const start, const Pointee *const pastEnd_)
 The constructor. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE StridedPointerIterator (const StridedPointerIterator &rhs)
 The copy constructor. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE bool isSingular () const
 Returns whether this instance is singular, i.e. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE bool isPastTheEnd () const
 Returns whether this iterator is past-the-end. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE bool isDereferenceable () const
 Returns whether this instance can be dereferenced. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE bool isValid () const
 Returns whether this instance is valid. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE bool isIncrementable () const
 Returns whether this instance is incrementable. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE Pointee & operator* ()
 Dereferencing operator. More...
 
const OPENMPCD_CUDA_HOST_AND_DEVICE Pointee & operator* () const
 Dereferencing operator. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE Pointee * operator-> ()
 Member access operator. More...
 
const OPENMPCD_CUDA_HOST_AND_DEVICE Pointee * operator-> () const
 Member access operator. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE StridedPointerIteratoroperator++ ()
 The prefix increment operator. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE StridedPointerIterator operator++ (int)
 The postfix increment operator. More...
 
const OPENMPCD_CUDA_HOST_AND_DEVICE StridedPointerIteratoroperator+= (const unsigned int n)
 Advances the pointer n times, or until the past-the-end iterator is reached, whichever comes first. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE bool operator== (const StridedPointerIterator &rhs) const
 Returns whether the address this instance and rhs point to the same memory. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE bool operator!= (const StridedPointerIterator &rhs) const
 Returns whether the address this instance and rhs point to different memory. More...
 

Detailed Description

template<typename Pointee, unsigned int stride>
class OpenMPCD::StridedPointerIterator< Pointee, stride >

Wraps a pointer in such a way that incrementing this iterator is equivalent to incrementing the underlying pointer once or more times, depending on the stride specified.

Template Parameters
PointeeThe type the underlying pointer points at.
strideThe iteration stride, which must not be 0.

Definition at line 23 of file StridedPointerIterator.hpp.

Constructor & Destructor Documentation

◆ StridedPointerIterator() [1/3]

template<typename Pointee , unsigned int stride>
OPENMPCD_CUDA_HOST_AND_DEVICE OpenMPCD::StridedPointerIterator< Pointee, stride >::StridedPointerIterator ( )
inline

The default constructor.

The constructed instance is singular.

Definition at line 33 of file StridedPointerIterator.hpp.

◆ StridedPointerIterator() [2/3]

template<typename Pointee , unsigned int stride>
OPENMPCD_CUDA_HOST_AND_DEVICE OpenMPCD::StridedPointerIterator< Pointee, stride >::StridedPointerIterator ( Pointee *const  start,
const Pointee *const  pastEnd_ 
)
inline

The constructor.

Parameters
[in]startThe first element to iterate over.
[in]pastEnd_The first element that is past the end of the array to iterate over.

Definition at line 43 of file StridedPointerIterator.hpp.

◆ StridedPointerIterator() [3/3]

template<typename Pointee , unsigned int stride>
OPENMPCD_CUDA_HOST_AND_DEVICE OpenMPCD::StridedPointerIterator< Pointee, stride >::StridedPointerIterator ( const StridedPointerIterator< Pointee, stride > &  rhs)
inline

The copy constructor.

Parameters
[in]rhsThe right-hand-side instance.

Definition at line 52 of file StridedPointerIterator.hpp.

Member Function Documentation

◆ isDereferenceable()

template<typename Pointee , unsigned int stride>
OPENMPCD_CUDA_HOST_AND_DEVICE bool OpenMPCD::StridedPointerIterator< Pointee, stride >::isDereferenceable ( ) const
inline

Returns whether this instance can be dereferenced.

Definition at line 86 of file StridedPointerIterator.hpp.

◆ isIncrementable()

template<typename Pointee , unsigned int stride>
OPENMPCD_CUDA_HOST_AND_DEVICE bool OpenMPCD::StridedPointerIterator< Pointee, stride >::isIncrementable ( ) const
inline

Returns whether this instance is incrementable.

Definition at line 110 of file StridedPointerIterator.hpp.

◆ isPastTheEnd()

template<typename Pointee , unsigned int stride>
OPENMPCD_CUDA_HOST_AND_DEVICE bool OpenMPCD::StridedPointerIterator< Pointee, stride >::isPastTheEnd ( ) const
inline

Returns whether this iterator is past-the-end.

Exceptions
InvalidCallExceptionThrows if isSingular().

Definition at line 72 of file StridedPointerIterator.hpp.

◆ isSingular()

template<typename Pointee , unsigned int stride>
OPENMPCD_CUDA_HOST_AND_DEVICE bool OpenMPCD::StridedPointerIterator< Pointee, stride >::isSingular ( ) const
inline

Returns whether this instance is singular, i.e.

invalid.

Definition at line 62 of file StridedPointerIterator.hpp.

◆ isValid()

template<typename Pointee , unsigned int stride>
OPENMPCD_CUDA_HOST_AND_DEVICE bool OpenMPCD::StridedPointerIterator< Pointee, stride >::isValid ( ) const
inline

Returns whether this instance is valid.

Definition at line 101 of file StridedPointerIterator.hpp.

◆ operator!=()

template<typename Pointee , unsigned int stride>
OPENMPCD_CUDA_HOST_AND_DEVICE bool OpenMPCD::StridedPointerIterator< Pointee, stride >::operator!= ( const StridedPointerIterator< Pointee, stride > &  rhs) const
inline

Returns whether the address this instance and rhs point to different memory.

This function does not consider whether both this instance and rhs have the same iteration range.

Parameters
[in]rhsThe right-hand-side instance.
Exceptions
InvalidCallExceptionThrows if !isValid().

Definition at line 272 of file StridedPointerIterator.hpp.

◆ operator*() [1/2]

template<typename Pointee , unsigned int stride>
OPENMPCD_CUDA_HOST_AND_DEVICE Pointee& OpenMPCD::StridedPointerIterator< Pointee, stride >::operator* ( )
inline

Dereferencing operator.

Exceptions
InvalidCallExceptionThrows if !isDereferenceable().

Definition at line 127 of file StridedPointerIterator.hpp.

◆ operator*() [2/2]

template<typename Pointee , unsigned int stride>
const OPENMPCD_CUDA_HOST_AND_DEVICE Pointee& OpenMPCD::StridedPointerIterator< Pointee, stride >::operator* ( ) const
inline

Dereferencing operator.

Exceptions
InvalidCallExceptionThrows if !isDereferenceable().

Definition at line 142 of file StridedPointerIterator.hpp.

◆ operator++() [1/2]

template<typename Pointee , unsigned int stride>
OPENMPCD_CUDA_HOST_AND_DEVICE StridedPointerIterator& OpenMPCD::StridedPointerIterator< Pointee, stride >::operator++ ( )
inline

The prefix increment operator.

Exceptions
InvalidCallExceptionThrows if !isDereferenceable().

Definition at line 187 of file StridedPointerIterator.hpp.

◆ operator++() [2/2]

template<typename Pointee , unsigned int stride>
OPENMPCD_CUDA_HOST_AND_DEVICE StridedPointerIterator OpenMPCD::StridedPointerIterator< Pointee, stride >::operator++ ( int  )
inline

The postfix increment operator.

Exceptions
InvalidCallExceptionThrows if !isDereferenceable().

Definition at line 210 of file StridedPointerIterator.hpp.

◆ operator+=()

template<typename Pointee , unsigned int stride>
const OPENMPCD_CUDA_HOST_AND_DEVICE StridedPointerIterator& OpenMPCD::StridedPointerIterator< Pointee, stride >::operator+= ( const unsigned int  n)
inline

Advances the pointer n times, or until the past-the-end iterator is reached, whichever comes first.

Parameters
[in]nThe number of times to advance the pointer.

Definition at line 235 of file StridedPointerIterator.hpp.

◆ operator->() [1/2]

template<typename Pointee , unsigned int stride>
OPENMPCD_CUDA_HOST_AND_DEVICE Pointee* OpenMPCD::StridedPointerIterator< Pointee, stride >::operator-> ( )
inline

Member access operator.

Exceptions
InvalidCallExceptionThrows if !isDereferenceable().

Definition at line 157 of file StridedPointerIterator.hpp.

◆ operator->() [2/2]

template<typename Pointee , unsigned int stride>
const OPENMPCD_CUDA_HOST_AND_DEVICE Pointee* OpenMPCD::StridedPointerIterator< Pointee, stride >::operator-> ( ) const
inline

Member access operator.

Exceptions
InvalidCallExceptionThrows if !isDereferenceable().

Definition at line 172 of file StridedPointerIterator.hpp.

◆ operator==()

template<typename Pointee , unsigned int stride>
OPENMPCD_CUDA_HOST_AND_DEVICE bool OpenMPCD::StridedPointerIterator< Pointee, stride >::operator== ( const StridedPointerIterator< Pointee, stride > &  rhs) const
inline

Returns whether the address this instance and rhs point to the same memory.

This function does not consider whether both this instance and rhs have the same iteration range.

Parameters
[in]rhsThe right-hand-side instance.
Exceptions
InvalidCallExceptionThrows if !isValid().

Definition at line 255 of file StridedPointerIterator.hpp.


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