Hermes
index.h File Reference

Set of multi-dimensional integer iterators. More...

Go to the source code of this file.

Classes

struct  hermes::Index2< T >
 Holds 2-dimensional integer index coordinates. More...
 
class  hermes::Index2Iterator< T >
 
class  hermes::Index2Range< T >
 Represents a closed-open range of indices [lower, upper) More...
 
struct  hermes::Index3< T >
 Holds 3-dimensional index coordinates. More...
 
class  hermes::Index3Iterator< T >
 
class  hermes::Index3Range< T >
 Represents a closed-open range of indices [lower, upper),. More...
 

Macros

#define ARITHMETIC_OP(OP)
 asd More...
 
#define MATH_OP(NAME, OP)
 
#define ARITHMETIC_OP(OP)
 asd More...
 
#define RELATIONAL_OP(OP, CO)
 
#define ARITHMETIC_OP(OP)
 asd More...
 
#define ARITHMETIC_OP(OP)
 asd More...
 
#define RELATIONAL_OP(OP, CO)
 

Typedefs

using hermes::range2 = Index2Range< i32 >
 i32
 
using hermes::range2_64 = Index2Range< i64 >
 i64
 
using hermes::range3 = Index3Range< i32 >
 i32
 
using hermes::index2 = Index2< i32 >
 i32
 
using hermes::index2_8 = Index2< i8 >
 i8
 
using hermes::index2_16 = Index2< i16 >
 i16
 
using hermes::index2_32 = Index2< i32 >
 i32
 
using hermes::index2_64 = Index2< i64 >
 i64
 
using hermes::index3 = Index3< i32 >
 i32
 
using hermes::index3_8 = Index3< i8 >
 i8
 
using hermes::index3_16 = Index3< i16 >
 i16
 
using hermes::index3_32 = Index3< i32 >
 i32
 
using hermes::index3_64 = Index3< i64 >
 i64
 

Functions

template<typename T >
std::ostream & hermes::operator<< (std::ostream &o, const Index2< T > &ij)
 
template<typename T >
std::ostream & hermes::operator<< (std::ostream &o, const Index3< T > &ijk)
 

Detailed Description

Set of multi-dimensional integer iterators.

Copyright (c) 2020, FilipeCN.

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Author
FilipeCN (filip.nosp@m.edec.nosp@m.n@gma.nosp@m.il.c.nosp@m.om)
Date
2020-01-28

Macro Definition Documentation

◆ ARITHMETIC_OP [1/4]

#define ARITHMETIC_OP (   OP)
Value:
template<typename U> \
HERMES_DEVICE_CALLABLE friend Index2<T> operator OP (const Size2<U> &b, const Index2<T> &a) { \
return Index2<T>(b.width OP a.i, b.height OP a.j); } \
HERMES_DEVICE_CALLABLE friend Index2<T> operator OP (const Index2<T> &b, const T &a) { \
return Index2<T>(b.i OP a, b.j OP a); }

asd

Parameters
OP

◆ ARITHMETIC_OP [2/4]

#define ARITHMETIC_OP (   OP)
Value:
HERMES_DEVICE_CALLABLE Index2<T>& operator OP##= (const Index2<T> &b) { \
i OP##= b.i; j OP##= b.j; return *this; } \
HERMES_DEVICE_CALLABLE Index2<T> operator OP (const Index2<T>& b) const { \
return {i OP b.i, j OP b.j}; } \
template<typename U> \
HERMES_DEVICE_CALLABLE Index2<T>& operator OP##= (const Size2<U> &b) { \
i OP##= static_cast<T>(b.width); j OP##= static_cast<T>(b.height); return *this; } \
template<typename U> \
HERMES_DEVICE_CALLABLE Index2<T> operator OP (const Size2<U>& b) const { \
return {i OP static_cast<T>(b.width), j OP static_cast<T>(b.height)}; }
#define HERMES_DEVICE_CALLABLE
Specifies that the function can be called from both host and device sides.
Definition: defs.h:45

asd

Parameters
OP

◆ ARITHMETIC_OP [3/4]

#define ARITHMETIC_OP (   OP)
Value:
template<typename U> \
HERMES_DEVICE_CALLABLE friend Index3<T> operator OP (const Size3<U> &b, const Index3<T> &a) { \
return Index3<T>(b.width OP a.i, b.height OP a.j, b.depth OP a.k); }

asd

Parameters
OP

◆ ARITHMETIC_OP [4/4]

#define ARITHMETIC_OP (   OP)
Value:
HERMES_DEVICE_CALLABLE Index3<T>& operator OP##= (const Index3<T> &b) { \
i OP##= b.i; j OP##= b.j; k OP##= b.k; return *this; } \
HERMES_DEVICE_CALLABLE Index3<T> operator OP (const Index3<T>& b) const { \
return {i OP b.i, j OP b.j, k OP b.k}; } \
template<typename U> \
HERMES_DEVICE_CALLABLE Index3<T>& operator OP##= (const Size3<U> &b) { \
i OP##= b.width; j OP##= b.height; k OP##= b.depth; return *this; } \
template<typename U> \
HERMES_DEVICE_CALLABLE Index3<T> operator OP (const Size3<U>& b) const { \
return {i OP static_cast<T>(b.width), j OP static_cast<T>(b.height), \
k OP static_cast<T>(b.depth)}; }

asd

Parameters
OP

◆ MATH_OP

#define MATH_OP (   NAME,
  OP 
)
Value:
HERMES_DEVICE_CALLABLE friend Index2<T> NAME(const Index2<T>& a, const Index2<T>& b) { \
return Index2<T>(OP(a.i, b.i), OP(a.j, b.j)); }

◆ RELATIONAL_OP [1/2]

#define RELATIONAL_OP (   OP,
  CO 
)
Value:
HERMES_DEVICE_CALLABLE bool operator OP (const Index2<T> &b) const { \
return i OP b.i CO j OP b.j; } \
template<typename U> \
HERMES_DEVICE_CALLABLE bool operator OP (const Size2<U>& b) const { \
return i OP static_cast<T>(b.width) CO j OP static_cast<T>(b.height); }

◆ RELATIONAL_OP [2/2]

#define RELATIONAL_OP (   OP,
  CO 
)
Value:
HERMES_DEVICE_CALLABLE bool operator OP (const Index3<T> &b) const { \
return i OP b.i CO j OP b.j CO k OP b.k; } \
template<typename U> \
HERMES_DEVICE_CALLABLE bool operator OP (const Size3<U>& b) const { \
return i OP static_cast<T>(b.width) CO \
j OP static_cast<T>(b.height) CO k OP static_cast<T>(b.depth); }

Function Documentation

◆ operator<<() [1/2]

template<typename T >
std::ostream& hermes::operator<< ( std::ostream &  o,
const Index2< T > &  ij 
)
Template Parameters
T
Parameters
o
ij
Returns

◆ operator<<() [2/2]

template<typename T >
std::ostream& hermes::operator<< ( std::ostream &  o,
const Index3< T > &  ijk 
)
Template Parameters
T
Parameters
o
ijk
Returns