HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
operators.h File Reference
#include "pxr/pxr.h"
#include "pxr/base/vt/api.h"
#include <hboost/utility/enable_if.hpp>
#include <hboost/type_traits/is_same.hpp>
+ Include dependency graph for operators.h:

Go to the source code of this file.

Macros

#define VTOPERATOR_CPPARRAY(op)
 
#define VTOPERATOR_CPPARRAY_UNARY(op)
 
#define VTOPERATOR_CPPSCALAR_TYPE(op, arraytype, scalartype, rettype)
 
#define VTOPERATOR_CPPSCALAR(op)   VTOPERATOR_CPPSCALAR_TYPE(op,ElemType,ElemType,ElemType)
 
#define VTOPERATOR_CPPSCALAR_DOUBLE(op)
 

Macro Definition Documentation

#define VTOPERATOR_CPPARRAY (   op)
Value:
VtArray operator op (VtArray const &other) const { \
/* accept empty vecs */ \
if ((size()!=0 && other.size()!=0) && \
(size() != other.size())) { \
TF_CODING_ERROR("Non-conforming inputs for operator %s",#op); \
return VtArray(); \
} \
/* promote empty vecs to vecs of zeros */ \
const bool thisEmpty = size() == 0, \
otherEmpty = other.size() == 0; \
VtArray ret(thisEmpty ? other.size() : size()); \
ElementType zero = VtZero<ElementType>(); \
for (size_t i = 0, n = ret.size(); i != n; ++i) { \
ret[i] = (thisEmpty ? zero : (*this)[i]) op \
(otherEmpty ? zero : other[i]); \
} \
return ret; \
}
GLsizeiptr size
Definition: glew.h:1681
#define TF_CODING_ERROR
GLsizei n
Definition: glew.h:4040
Definition: types.h:166
if(rank==1) return rank
#define const
Definition: zconf.h:214
ImageBuf OIIO_API zero(ROI roi, int nthreads=0)
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))

Definition at line 78 of file operators.h.

#define VTOPERATOR_CPPARRAY_UNARY (   op)
Value:
VtArray operator op () const { \
VtArray ret(size()); \
for (size_t i = 0, sz = ret.size(); i != sz; ++i) { \
ret[i] = op (*this)[i]; \
} \
return ret; \
}
GLsizeiptr size
Definition: glew.h:1681
Definition: types.h:166
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))

Definition at line 98 of file operators.h.

#define VTOPERATOR_CPPSCALAR (   op)    VTOPERATOR_CPPSCALAR_TYPE(op,ElemType,ElemType,ElemType)

Definition at line 131 of file operators.h.

#define VTOPERATOR_CPPSCALAR_DOUBLE (   op)
Value:
template<typename ElemType> \
typename hboost::disable_if<hboost::is_same<ElemType, double>, \
VtArray<ElemType> >::type \
operator op (double const &scalar, \
VtArray<ElemType> const &vec) { \
VtArray<ElemType> ret(vec.size()); \
for (size_t i = 0; i<vec.size(); ++i) { \
ret[i] = scalar op vec[i]; \
} \
return ret; \
} \
template<typename ElemType> \
typename hboost::disable_if<hboost::is_same<ElemType, double>, \
VtArray<ElemType> >::type \
operator op (VtArray<ElemType> const &vec, \
double const &scalar) { \
VtArray<ElemType> ret(vec.size()); \
for (size_t i = 0; i<vec.size(); ++i) { \
ret[i] = vec[i] op scalar; \
} \
return ret; \
}
Definition: types.h:166
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))

Definition at line 137 of file operators.h.

#define VTOPERATOR_CPPSCALAR_TYPE (   op,
  arraytype,
  scalartype,
  rettype 
)
Value:
template<typename arraytype> \
VtArray<ElemType> \
operator op (scalartype const &scalar, \
VtArray<arraytype> const &vec) { \
VtArray<rettype> ret(vec.size()); \
for (size_t i = 0; i<vec.size(); ++i) { \
ret[i] = scalar op vec[i]; \
} \
return ret; \
} \
template<typename arraytype> \
VtArray<ElemType> \
operator op (VtArray<arraytype> const &vec, \
scalartype const &scalar) { \
VtArray<rettype> ret(vec.size()); \
for (size_t i = 0; i<vec.size(); ++i) { \
ret[i] = vec[i] op scalar; \
} \
return ret; \
}
Definition: types.h:166
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))

Definition at line 109 of file operators.h.