RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
Classes | Namespaces | Macros | Typedefs | Functions
IndexValue.hpp File Reference

RAJA header file for strongly-typed integer class. More...

#include "RAJA/config.hpp"
#include <string>
#include "RAJA/util/macros.hpp"
#include "RAJA/util/types.hpp"

Go to the source code of this file.

Classes

struct  RAJA::IndexValueBase
 
struct  RAJA::IndexValue< TYPE, VALUE >
 Strongly typed "integer" class. More...
 
struct  RAJA::internal::StripIndexTypeT< FROM, Enable >
 
struct  RAJA::internal::StripIndexTypeT< FROM, typename std::enable_if< std::is_base_of< IndexValueBase, FROM >::value >::type >
 

Namespaces

 RAJA
 
 RAJA::internal
 

Macros

#define RAJA_INDEX_VALUE(TYPE, NAME)
 Helper Macro to create new Index types. More...
 
#define RAJA_INDEX_VALUE_T(TYPE, IDXT, NAME)
 Helper Macro to create new Index types. More...
 

Typedefs

template<typename FROM >
using RAJA::strip_index_type_t = typename internal::StripIndexTypeT< FROM >::type
 Strips a strongly typed index to its underlying type In the case of a non-strongly typed index, the original type is returned. More...
 
template<typename FROM >
using RAJA::make_signed_t = typename std::conditional< std::is_floating_point< FROM >::value, std::common_type< FROM >, std::make_signed< FROM > >::type::type
 Converts a type into a signed type. Also handles floating point types as std::make_signed only supports integral types. More...
 

Functions

template<typename TO , typename FROM >
constexpr RAJA_HOST_DEVICE RAJA_INLINE TO RAJA::internal::convertIndex_helper (FROM const val)
 
template<typename TO , typename FROM >
constexpr RAJA_HOST_DEVICE RAJA_INLINE TO RAJA::internal::convertIndex_helper (typename FROM::IndexValueType const val)
 
template<typename TO , typename FROM >
constexpr RAJA_HOST_DEVICE RAJA_INLINE TO RAJA::convertIndex (FROM const val)
 Function provides a way to take either an int or any Index<> type, and convert it to another type, possibly another Index or an int. More...
 
template<typename FROM >
constexpr RAJA_HOST_DEVICE RAJA_INLINE std::enable_if< std::is_base_of< IndexValueBase, FROM >::value, typename FROM::value_type >::type RAJA::stripIndexType (FROM const val)
 Function that strips the strongly typed Index<> and returns its underlying value_type value. More...
 
template<typename FROM >
constexpr RAJA_HOST_DEVICE RAJA_INLINE std::enable_if<!std::is_base_of< IndexValueBase, FROM >::value, FROM >::type RAJA::stripIndexType (FROM const val)
 

Detailed Description

RAJA header file for strongly-typed integer class.

Macro Definition Documentation

◆ RAJA_INDEX_VALUE

#define RAJA_INDEX_VALUE (   TYPE,
  NAME 
)
Value:
class TYPE : public ::RAJA::IndexValue<TYPE> \
{ \
using parent = ::RAJA::IndexValue<TYPE>; \
\
public: \
using IndexValueType = TYPE; \
RAJA_HOST_DEVICE RAJA_INLINE TYPE() : parent::IndexValue() {} \
RAJA_HOST_DEVICE RAJA_INLINE explicit TYPE(::RAJA::Index_type v) \
: parent::IndexValue(v) \
{} \
static inline std::string getName() { return NAME; } \
};
std::ptrdiff_t Index_type
Definition: types.hpp:226
Strongly typed "integer" class.
Definition: IndexValue.hpp:50
static std::string getName()

Helper Macro to create new Index types.

Parameters
TYPEthe name of the type
NAMEa string literal to identify this index type

◆ RAJA_INDEX_VALUE_T

#define RAJA_INDEX_VALUE_T (   TYPE,
  IDXT,
  NAME 
)
Value:
class TYPE : public ::RAJA::IndexValue<TYPE, IDXT> \
{ \
public: \
RAJA_HOST_DEVICE RAJA_INLINE TYPE() \
{} \
RAJA_HOST_DEVICE RAJA_INLINE explicit TYPE(IDXT v) \
{} \
static inline std::string getName() { return NAME; } \
};
constexpr RAJA_INLINE IndexValue()=default
Default constructor initializes value to 0.

Helper Macro to create new Index types.

Parameters
TYPEthe name of the type
IDXTthe index types value type
NAMEa string literal to identify this index type