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

#include <vecparam.h>

Public Member Functions

OIIO_HOSTDEVICE constexpr Vec3Param (T x, T y, T z) noexcept
 Construct directly from 3 floats. More...
 
template<typename V , OIIO_ENABLE_IF(has_xyz< V, T >::value) >
OIIO_HOSTDEVICE constexpr Vec3Param (const V &v) noexcept
 
template<typename V , OIIO_ENABLE_IF(has_subscript_N< V, T, 3 >::value &&!has_xyz< V, T >::value) >
OIIO_HOSTDEVICE constexpr Vec3Param (const V &v) noexcept
 
template<typename V , OIIO_ENABLE_IF(sizeof(V)==3 *sizeof(T)) >
constexpr const V & cast () const noexcept
 
template<typename V , OIIO_ENABLE_IF(has_subscript_N< V, T, 3 >::value||has_xyz< V, T >::value) >
OIIO_HOSTDEVICE constexpr operator const V & () const noexcept
 

Public Attributes

T x
 
T y
 
T z
 

Detailed Description

template<typename T>
class Vec3Param< T >

Vec3Param<T> is a helper class that lets us create an interface that takes a proxy for a T[3] analogue for use as a public API function parameter type, in order to not expose the underlying vector type.

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

void foo(Vec3Param<float> v);

Then any of the following calls will work:

float array[3];
foo(array);

foo(Imath::V3f(1,2,3));

Definition at line 226 of file vecparam.h.

Constructor & Destructor Documentation

template<typename T >
OIIO_HOSTDEVICE constexpr Vec3Param< T >::Vec3Param ( T  x,
T  y,
T  z 
)
inlinenoexcept

Construct directly from 3 floats.

Definition at line 229 of file vecparam.h.

template<typename T >
template<typename V , OIIO_ENABLE_IF(has_xyz< V, T >::value) >
OIIO_HOSTDEVICE constexpr Vec3Param< T >::Vec3Param ( const V &  v)
inlinenoexcept

Construct from anything that looks like a 3-vector, having .x, .y, and .z members of type T (and has exactly the size of a T[3]). This will implicitly convert from an Imath::Vector3<T>, among other things.

Definition at line 240 of file vecparam.h.

template<typename T >
template<typename V , OIIO_ENABLE_IF(has_subscript_N< V, T, 3 >::value &&!has_xyz< V, T >::value) >
OIIO_HOSTDEVICE constexpr Vec3Param< T >::Vec3Param ( const V &  v)
inlinenoexcept

Construct from anything that looks like a 3-vector, having [] component access returning a T, and has exactly the size of a T[3].

Definition at line 252 of file vecparam.h.

Member Function Documentation

template<typename T >
template<typename V , OIIO_ENABLE_IF(sizeof(V)==3 *sizeof(T)) >
constexpr const V& Vec3Param< T >::cast ( ) const
inlinenoexcept

Definition at line 277 of file vecparam.h.

template<typename T >
template<typename V , OIIO_ENABLE_IF(has_subscript_N< V, T, 3 >::value||has_xyz< V, T >::value) >
OIIO_HOSTDEVICE constexpr Vec3Param< T >::operator const V & ( ) const
inlinenoexcept

Implicitly convert a Vec3Param<T> to a const V& for a V that looks like a 3-vector.

Definition at line 287 of file vecparam.h.

Member Data Documentation

template<typename T >
T Vec3Param< T >::x

Definition at line 293 of file vecparam.h.

template<typename T >
T Vec3Param< T >::y

Definition at line 293 of file vecparam.h.

template<typename T >
T Vec3Param< T >::z

Definition at line 293 of file vecparam.h.


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