Hermes
hermes::Size2< T > Class Template Reference

Holds 2-dimensional size. More...

Public Member Functions

HERMES_DEVICE_CALLABLE Size2 ()
 Default constructor.
 
HERMES_DEVICE_CALLABLE Size2 (T size)
 Single value constructor. More...
 
HERMES_DEVICE_CALLABLE Size2 (T width, T height)
 Constructor. More...
 
HERMES_DEVICE_CALLABLEoperator[] (int i) const
 Dimension size const access. More...
 
HERMES_DEVICE_CALLABLE T & operator[] (int i)
 Dimension size access. More...
 
HERMES_DEVICE_CALLABLE Size2< T > operator+ (const Size2< T > &b) const
 Addition. More...
 
HERMES_DEVICE_CALLABLE Size2< T > operator/ (T n) const
 
HERMES_DEVICE_CALLABLE Size2< T > operator* (T s) const
 Scalar multiplication. More...
 
HERMES_DEVICE_CALLABLE bool operator== (const Size2< T > &b) const
 Comparison. More...
 
HERMES_DEVICE_CALLABLE bool operator!= (const Size2< T > &b) const
 Comparison. More...
 
HERMES_DEVICE_CALLABLEtotal () const
 Computes total size area. More...
 
HERMES_DEVICE_CALLABLE bool contains (int i, int j) const
 Checks if coordinate is inside half-open range [0, size) More...
 

Public Attributes

width {0}
 0-th dimension size
 
height {0}
 1-th dimension size
 

Detailed Description

template<typename T>
class hermes::Size2< T >

Holds 2-dimensional size.

Precondition
T must be an unsigned integer type
Template Parameters
T

Constructor & Destructor Documentation

◆ Size2() [1/2]

template<typename T >
HERMES_DEVICE_CALLABLE hermes::Size2< T >::Size2 ( size)
inlineexplicit

Single value constructor.

Parameters
size

◆ Size2() [2/2]

template<typename T >
HERMES_DEVICE_CALLABLE hermes::Size2< T >::Size2 ( width,
height 
)
inline

Constructor.

Parameters
width
height

Member Function Documentation

◆ contains()

template<typename T >
HERMES_DEVICE_CALLABLE bool hermes::Size2< T >::contains ( int  i,
int  j 
) const
inline

Checks if coordinate is inside half-open range [0, size)

Parameters
i
j
Returns

◆ operator!=()

template<typename T >
HERMES_DEVICE_CALLABLE bool hermes::Size2< T >::operator!= ( const Size2< T > &  b) const
inline

Comparison.

Parameters
b
Returns

◆ operator*()

template<typename T >
HERMES_DEVICE_CALLABLE Size2<T> hermes::Size2< T >::operator* ( s) const
inline

Scalar multiplication.

Parameters
s
Returns

◆ operator+()

template<typename T >
HERMES_DEVICE_CALLABLE Size2<T> hermes::Size2< T >::operator+ ( const Size2< T > &  b) const
inline

Addition.

Parameters
b
Returns

◆ operator/()

template<typename T >
HERMES_DEVICE_CALLABLE Size2<T> hermes::Size2< T >::operator/ ( n) const
inline
Parameters
n
Returns

◆ operator==()

template<typename T >
HERMES_DEVICE_CALLABLE bool hermes::Size2< T >::operator== ( const Size2< T > &  b) const
inline

Comparison.

Parameters
b
Returns

◆ operator[]() [1/2]

template<typename T >
HERMES_DEVICE_CALLABLE T& hermes::Size2< T >::operator[] ( int  i)
inline

Dimension size access.

Precondition
i must be inside interval [0,1]
Warning
This method does not check input value
Parameters
i
Returns

◆ operator[]() [2/2]

template<typename T >
HERMES_DEVICE_CALLABLE T hermes::Size2< T >::operator[] ( int  i) const
inline

Dimension size const access.

Precondition
i must be inside interval [0,1]
Warning
This method does not check input value
Parameters
i
Returns

◆ total()

template<typename T >
HERMES_DEVICE_CALLABLE T hermes::Size2< T >::total ( ) const
inline

Computes total size area.

Returns
width * height

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