Template Class HostMacroProperty

Class Documentation

template<typename T, unsigned int I = 1, unsigned int J = 1, unsigned int K = 1, unsigned int W = 1>
class HostMacroProperty

This template class is used for conveniently converting a multi-dimensional pointer to an array Theoretically the compiler should be able to optimise away most of it at compile time

Public Functions

explicit HostMacroProperty(const std::shared_ptr<HostMacroProperty_MetaData> &_metadata)

Root Constructor

Parameters:

_metadata – Metadata struct

HostMacroProperty(const std::shared_ptr<HostMacroProperty_MetaData> &_metadata, const ptrdiff_t &_offset)

Sub Constructor

Parameters:
  • _metadata – Preallocated metadata struct, shared with other current instances of same host macro property

  • _offset – Pointer to buffer in device memory

HostMacroProperty<T, J, K, W, 1> operator[](unsigned int i) const

Access the next dimension of the array

Throws:
  • exception::OutOfBoundsException – If i >= I.

  • exception::InvalidOperation – If template arguments I, J, K , W are all 1. Which denotes the macro property has no dimensions remaining to be indexed.

operator T()

Read/Write access to the current element

Throws:

exception::InvalidOperation – If template arguments I, J, K , W are not all 1. Which denotes the macro property has more dimensions remaining to be indexed.

operator T() const

Read-only access to the current element

Throws:

exception::InvalidOperation – If template arguments I, J, K , W are not all 1. Which denotes the macro property has more dimensions remaining to be indexed.

HostMacroProperty<T, I, J, K, W> &operator=(T val)

Assign value

Parameters:

val – New value of the element

Throws:

exception::InvalidOperation – If template arguments I, J, K , W are not all 1. Which denotes the macro property has more dimensions remaining to be indexed.

void zero()

Zero’s the selected area of the array

HostMacroProperty<T, I, J, K, W> &operator++()

Increment operators

T operator++(int)
HostMacroProperty<T, I, J, K, W> &operator--()
T operator--(int)
template<typename T2>
auto operator+(T2 b) const

Arithmetic operators

template<typename T2>
auto operator-(T2 b) const
template<typename T2>
auto operator*(T2 b) const
template<typename T2>
auto operator/(T2 b) const
template<typename T2>
auto operator%(T2 b) const
template<typename T2>
HostMacroProperty<T, I, J, K, W> &operator+=(T2 b)

Assignment operators

template<typename T2>
HostMacroProperty<T, I, J, K, W> &operator-=(T2 b)
template<typename T2>
HostMacroProperty<T, I, J, K, W> &operator*=(T2 b)
template<typename T2>
HostMacroProperty<T, I, J, K, W> &operator/=(T2 b)
template<typename T2>
HostMacroProperty<T, I, J, K, W> &operator%=(T2 b)