24 #if !HBOOST_PP_IS_ITERATING
26 #ifndef PXR_BASE_VT_FUNCTIONS_H
27 #define PXR_BASE_VT_FUNCTIONS_H
33 #include "pxr/base/vt/array.h"
34 #include <hboost/preprocessor/enum_params.hpp>
35 #include <hboost/preprocessor/iterate.hpp>
36 #include <hboost/preprocessor/repeat.hpp>
41 #define VT_FUNCTIONS_MAX_ARGS 6
47 #define HBOOST_PP_ITERATION_PARAMS_1 (4, \
48 (0, VT_FUNCTIONS_MAX_ARGS, "pxr/base/vt/functions.h", 0))
49 #include HBOOST_PP_ITERATE()
200 for (
size_t i = 0; i != a.size(); ++i) {
201 if (a[i] != VtZero<T>())
226 for (
size_t i = 0; i != a.size(); ++i) {
227 if (a[i] == VtZero<T>())
244 #define VTFUNCTION_BOOL(funcname,op) \
245 template<typename T> \
247 funcname(T const &scalar, VtArray<T> const &vec) { \
248 VtArray<bool> ret(vec.size()); \
249 for (size_t i = 0, n = vec.size(); i != n; ++i) { \
250 ret[i] = (scalar op vec[i]); \
254 template<typename T> \
256 funcname(VtArray<T> const &vec, T const &scalar) { \
257 VtArray<bool> ret(vec.size()); \
258 for (size_t i = 0, n = vec.size(); i != n; ++i) { \
259 ret[i] = (vec[i] op scalar); \
263 template<typename T> \
265 funcname(VtArray<T> const &a, VtArray<T> const &b) \
267 if (a.empty() || b.empty()) { \
268 return VtArray<bool>(); \
271 if (a.size() == 1) { \
272 return funcname(a[0], b); \
273 } else if (b.size() == 1) { \
274 return funcname(a, b[0]); \
275 } else if (a.size() == b.size()) { \
276 VtArray<bool> ret(a.size()); \
277 for (size_t i = 0, n = a.size(); i != n; ++i) { \
278 ret[i] = (a[i] op b[i]); \
282 TF_CODING_ERROR("Non-conforming inputs."); \
283 return VtArray<bool>(); \
296 #endif // PXR_BASE_VT_FUNCTIONS_H
298 #else // HBOOST_PP_IS_ITERATING
306 #define N HBOOST_PP_ITERATION()
308 #if HBOOST_PP_ITERATION_FLAGS() == 0 // VtCat
310 #define VtCat_SIZE(dummy, n, dummy2) newSize += s##n.size();
311 #define VtCat_COPY(dummy, n, dummy2) \
312 for (size_t i = 0; i < s##n.size(); ++i) \
313 ret[offset+i] = s##n[i]; \
314 offset += s##n.size();
323 HBOOST_PP_REPEAT(
N, VtCat_SIZE, ignored )
334 HBOOST_PP_REPEAT(
N, VtCat_COPY, ignored )
343 #endif // HBOOST_PP_ITERATION_FLAGS
347 #endif // HBOOST_PP_IS_ITERATING
bool VtAnyTrue(VtArray< T > const &a)
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b
#define VTFUNCTION_BOOL(funcname, op)
bool VtAllTrue(VtArray< T > const &a)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
GA_API const UT_StringHolder N