HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MatrixParam< T, S > Class Template Reference

#include <vecparam.h>

Public Member Functions

template<typename M , OIIO_ENABLE_IF(has_double_subscript_RC< M, T, Size, Size >::value) >
OIIO_HOSTDEVICE constexpr MatrixParam (const M &m) noexcept
 
const Tdata () const noexcept
 Return a pointer to the contiguous values comprising the matrix. More...
 

Static Public Attributes

static constexpr int Size = S
 

Detailed Description

template<typename T, int S>
class MatrixParam< T, S >

MatrixParam is a helper template that lets us create an interface that takes a proxy for a T[S][S] analogue for use as a public API function parameter type to pass a square matrix, in order to not expose the underlying matrix types. The common cases are given handy aliases: M33fParam and M33fParam for 3x3 and 4x4 float matrices, respectively (MatrixParam<float,3> and MatrixParam<float,4> are the long names).

For example, suppose we have a public function like this:

void foo(M33fParam v);

Then any of the following calls will work:

float array[3][3];
foo(array);

foo(Imath::M33f(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1));

Definition at line 320 of file vecparam.h.

Constructor & Destructor Documentation

template<typename T , int S>
template<typename M , OIIO_ENABLE_IF(has_double_subscript_RC< M, T, Size, Size >::value) >
OIIO_HOSTDEVICE constexpr MatrixParam< T, S >::MatrixParam ( const M &  m)
inlinenoexcept

We can construct a MatrixParam out of anything that has the size of a T[S][S] and presents a [][] subscript operator.

Definition at line 328 of file vecparam.h.

Member Function Documentation

template<typename T , int S>
const T* MatrixParam< T, S >::data ( ) const
inlinenoexcept

Return a pointer to the contiguous values comprising the matrix.

Definition at line 376 of file vecparam.h.

Member Data Documentation

template<typename T , int S>
constexpr int MatrixParam< T, S >::Size = S
static

Definition at line 322 of file vecparam.h.


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