RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
RAJA::IndexValue< TYPE, VALUE > Struct Template Reference

Strongly typed "integer" class. More...

#include <IndexValue.hpp>

Inheritance diagram for RAJA::IndexValue< TYPE, VALUE >:
RAJA::IndexValueBase

Public Types

using value_type = VALUE
 

Public Member Functions

constexpr RAJA_INLINE IndexValue ()=default
 Default constructor initializes value to 0. More...
 
constexpr RAJA_INLINE IndexValue (IndexValue const &)=default
 
constexpr RAJA_INLINE IndexValue (IndexValue &&)=default
 
RAJA_INLINE IndexValueoperator= (IndexValue const &)=default
 
RAJA_INLINE IndexValueoperator= (IndexValue &&)=default
 
RAJA_HOST_DEVICE constexpr RAJA_INLINE IndexValue (value_type v)
 Explicit constructor. More...
 
RAJA_HOST_DEVICE RAJA_INLINE value_typeoperator* ()
 Dereference provides cast-to-integer. More...
 
RAJA_HOST_DEVICE RAJA_INLINE const value_typeoperator* () const
 Dereference provides cast-to-integer. More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE operator++ (int)
 postincrement – returns a copy More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE & operator++ ()
 preincrement stored index More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE operator-- (int)
 postdecrement – returns a copy More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE & operator-- ()
 preincrement stored index More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE operator+ (value_type a) const
 addition to underlying index from an Index_type More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE operator+ (TYPE a) const
 addition to underlying index from another strong type More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE operator- (value_type a) const
 subtraction to underlying index from an Index_type More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE operator- (TYPE a) const
 subtraction to underlying index from another strong type More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE operator* (value_type a) const
 multiplication to underlying index from an Index_type More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE operator* (TYPE a) const
 multiplication to underlying index from another strong type More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE operator/ (value_type a) const
 division to underlying index from an Index_type More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE operator/ (TYPE a) const
 division to underlying index from another strong type More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE operator% (value_type a) const
 modulus to underlying index from an Index_type More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE operator% (TYPE a) const
 modulus to underlying index from another strong type More...
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE & operator+= (value_type x)
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE & operator+= (TYPE x)
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE & operator-= (value_type x)
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE & operator-= (TYPE x)
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE & operator*= (value_type x)
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE & operator*= (TYPE x)
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE & operator/= (value_type x)
 
RAJA_HOST_DEVICE RAJA_INLINE TYPE & operator/= (TYPE x)
 
RAJA_HOST_DEVICE RAJA_INLINE bool operator< (value_type x) const
 
RAJA_HOST_DEVICE RAJA_INLINE bool operator< (TYPE x) const
 
RAJA_HOST_DEVICE RAJA_INLINE bool operator<= (value_type x) const
 
RAJA_HOST_DEVICE RAJA_INLINE bool operator<= (TYPE x) const
 
RAJA_HOST_DEVICE RAJA_INLINE bool operator> (value_type x) const
 
RAJA_HOST_DEVICE RAJA_INLINE bool operator> (TYPE x) const
 
RAJA_HOST_DEVICE RAJA_INLINE bool operator>= (value_type x) const
 
RAJA_HOST_DEVICE RAJA_INLINE bool operator>= (TYPE x) const
 
RAJA_HOST_DEVICE RAJA_INLINE bool operator== (value_type x) const
 
RAJA_HOST_DEVICE RAJA_INLINE bool operator== (TYPE x) const
 
RAJA_HOST_DEVICE RAJA_INLINE bool operator!= (value_type x) const
 
RAJA_HOST_DEVICE RAJA_INLINE bool operator!= (TYPE x) const
 

Static Public Member Functions

static std::string getName ()
 

Protected Attributes

value_type value = 0
 

Detailed Description

template<typename TYPE, typename VALUE = RAJA::Index_type>
struct RAJA::IndexValue< TYPE, VALUE >

Strongly typed "integer" class.

Allows integers to be associated with a type, and disallows automatic conversion.

Useful for maintaining correctness in multidimensional loops and arrays.

Use the RAJA_INDEX_VALUE(NAME) macro to define new indices.

Yes, this uses the curiously-recurring template pattern.

Member Typedef Documentation

◆ value_type

template<typename TYPE , typename VALUE = RAJA::Index_type>
using RAJA::IndexValue< TYPE, VALUE >::value_type = VALUE

Constructor & Destructor Documentation

◆ IndexValue() [1/4]

template<typename TYPE , typename VALUE = RAJA::Index_type>
constexpr RAJA_INLINE RAJA::IndexValue< TYPE, VALUE >::IndexValue ( )
constexprdefault

Default constructor initializes value to 0.

◆ IndexValue() [2/4]

template<typename TYPE , typename VALUE = RAJA::Index_type>
constexpr RAJA_INLINE RAJA::IndexValue< TYPE, VALUE >::IndexValue ( IndexValue< TYPE, VALUE > const &  )
constexprdefault

◆ IndexValue() [3/4]

template<typename TYPE , typename VALUE = RAJA::Index_type>
constexpr RAJA_INLINE RAJA::IndexValue< TYPE, VALUE >::IndexValue ( IndexValue< TYPE, VALUE > &&  )
constexprdefault

◆ IndexValue() [4/4]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE constexpr RAJA_INLINE RAJA::IndexValue< TYPE, VALUE >::IndexValue ( value_type  v)
inlineexplicitconstexpr

Explicit constructor.

Parameters
vInitial value

Member Function Documentation

◆ operator=() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_INLINE IndexValue& RAJA::IndexValue< TYPE, VALUE >::operator= ( IndexValue< TYPE, VALUE > const &  )
default

◆ operator=() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_INLINE IndexValue& RAJA::IndexValue< TYPE, VALUE >::operator= ( IndexValue< TYPE, VALUE > &&  )
default

◆ operator*() [1/4]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE value_type& RAJA::IndexValue< TYPE, VALUE >::operator* ( )
inline

Dereference provides cast-to-integer.

◆ operator*() [2/4]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE const value_type& RAJA::IndexValue< TYPE, VALUE >::operator* ( ) const
inline

Dereference provides cast-to-integer.

◆ operator++() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE RAJA::IndexValue< TYPE, VALUE >::operator++ ( int  )
inline

postincrement – returns a copy

◆ operator++() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE& RAJA::IndexValue< TYPE, VALUE >::operator++ ( )
inline

preincrement stored index

◆ operator--() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE RAJA::IndexValue< TYPE, VALUE >::operator-- ( int  )
inline

postdecrement – returns a copy

◆ operator--() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE& RAJA::IndexValue< TYPE, VALUE >::operator-- ( )
inline

preincrement stored index

◆ operator+() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE RAJA::IndexValue< TYPE, VALUE >::operator+ ( value_type  a) const
inline

addition to underlying index from an Index_type

◆ operator+() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE RAJA::IndexValue< TYPE, VALUE >::operator+ ( TYPE  a) const
inline

addition to underlying index from another strong type

◆ operator-() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE RAJA::IndexValue< TYPE, VALUE >::operator- ( value_type  a) const
inline

subtraction to underlying index from an Index_type

◆ operator-() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE RAJA::IndexValue< TYPE, VALUE >::operator- ( TYPE  a) const
inline

subtraction to underlying index from another strong type

◆ operator*() [3/4]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE RAJA::IndexValue< TYPE, VALUE >::operator* ( value_type  a) const
inline

multiplication to underlying index from an Index_type

◆ operator*() [4/4]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE RAJA::IndexValue< TYPE, VALUE >::operator* ( TYPE  a) const
inline

multiplication to underlying index from another strong type

◆ operator/() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE RAJA::IndexValue< TYPE, VALUE >::operator/ ( value_type  a) const
inline

division to underlying index from an Index_type

◆ operator/() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE RAJA::IndexValue< TYPE, VALUE >::operator/ ( TYPE  a) const
inline

division to underlying index from another strong type

◆ operator%() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE RAJA::IndexValue< TYPE, VALUE >::operator% ( value_type  a) const
inline

modulus to underlying index from an Index_type

◆ operator%() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE RAJA::IndexValue< TYPE, VALUE >::operator% ( TYPE  a) const
inline

modulus to underlying index from another strong type

◆ operator+=() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE& RAJA::IndexValue< TYPE, VALUE >::operator+= ( value_type  x)
inline

◆ operator+=() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE& RAJA::IndexValue< TYPE, VALUE >::operator+= ( TYPE  x)
inline

◆ operator-=() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE& RAJA::IndexValue< TYPE, VALUE >::operator-= ( value_type  x)
inline

◆ operator-=() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE& RAJA::IndexValue< TYPE, VALUE >::operator-= ( TYPE  x)
inline

◆ operator*=() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE& RAJA::IndexValue< TYPE, VALUE >::operator*= ( value_type  x)
inline

◆ operator*=() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE& RAJA::IndexValue< TYPE, VALUE >::operator*= ( TYPE  x)
inline

◆ operator/=() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE& RAJA::IndexValue< TYPE, VALUE >::operator/= ( value_type  x)
inline

◆ operator/=() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE TYPE& RAJA::IndexValue< TYPE, VALUE >::operator/= ( TYPE  x)
inline

◆ operator<() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE bool RAJA::IndexValue< TYPE, VALUE >::operator< ( value_type  x) const
inline

◆ operator<() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE bool RAJA::IndexValue< TYPE, VALUE >::operator< ( TYPE  x) const
inline

◆ operator<=() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE bool RAJA::IndexValue< TYPE, VALUE >::operator<= ( value_type  x) const
inline

◆ operator<=() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE bool RAJA::IndexValue< TYPE, VALUE >::operator<= ( TYPE  x) const
inline

◆ operator>() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE bool RAJA::IndexValue< TYPE, VALUE >::operator> ( value_type  x) const
inline

◆ operator>() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE bool RAJA::IndexValue< TYPE, VALUE >::operator> ( TYPE  x) const
inline

◆ operator>=() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE bool RAJA::IndexValue< TYPE, VALUE >::operator>= ( value_type  x) const
inline

◆ operator>=() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE bool RAJA::IndexValue< TYPE, VALUE >::operator>= ( TYPE  x) const
inline

◆ operator==() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE bool RAJA::IndexValue< TYPE, VALUE >::operator== ( value_type  x) const
inline

◆ operator==() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE bool RAJA::IndexValue< TYPE, VALUE >::operator== ( TYPE  x) const
inline

◆ operator!=() [1/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE bool RAJA::IndexValue< TYPE, VALUE >::operator!= ( value_type  x) const
inline

◆ operator!=() [2/2]

template<typename TYPE , typename VALUE = RAJA::Index_type>
RAJA_HOST_DEVICE RAJA_INLINE bool RAJA::IndexValue< TYPE, VALUE >::operator!= ( TYPE  x) const
inline

◆ getName()

template<typename TYPE , typename VALUE = RAJA::Index_type>
static std::string RAJA::IndexValue< TYPE, VALUE >::getName ( )
static

Member Data Documentation

◆ value

template<typename TYPE , typename VALUE = RAJA::Index_type>
value_type RAJA::IndexValue< TYPE, VALUE >::value = 0
protected

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