#pragma once
#ifndef __OPENCV_CUDEV_UTIL_TUPLE_DETAIL_HPP__
#define __OPENCV_CUDEV_UTIL_TUPLE_DETAIL_HPP__
#include <thrust/tuple.h>
namespace cv { namespace cudev {
namespace tuple_detail
{
using thrust::tuple;
using thrust::tuple_size;
using thrust::get;
using thrust::tuple_element;
using thrust::make_tuple;
using thrust::tie;
template <class Tuple, int SIZE, template <typename T> class CvtOp> struct ConvertTuple;
template <class Tuple, template <typename T> class CvtOp> struct ConvertTuple<Tuple, 2, CvtOp>
{
typedef tuple<
typename CvtOp<typename tuple_element<0, Tuple>::type>::type,
typename CvtOp<typename tuple_element<1, Tuple>::type>::type
> type;
};
template <class Tuple, template <typename T> class CvtOp> struct ConvertTuple<Tuple, 3, CvtOp>
{
typedef tuple<
typename CvtOp<typename tuple_element<0, Tuple>::type>::type,
typename CvtOp<typename tuple_element<1, Tuple>::type>::type,
typename CvtOp<typename tuple_element<2, Tuple>::type>::type
> type;
};
template <class Tuple, template <typename T> class CvtOp> struct ConvertTuple<Tuple, 4, CvtOp>
{
typedef tuple<
typename CvtOp<typename tuple_element<0, Tuple>::type>::type,
typename CvtOp<typename tuple_element<1, Tuple>::type>::type,
typename CvtOp<typename tuple_element<2, Tuple>::type>::type,
typename CvtOp<typename tuple_element<3, Tuple>::type>::type
> type;
};
template <class Tuple, template <typename T> class CvtOp> struct ConvertTuple<Tuple, 5, CvtOp>
{
typedef tuple<
typename CvtOp<typename tuple_element<0, Tuple>::type>::type,
typename CvtOp<typename tuple_element<1, Tuple>::type>::type,
typename CvtOp<typename tuple_element<2, Tuple>::type>::type,
typename CvtOp<typename tuple_element<3, Tuple>::type>::type,
typename CvtOp<typename tuple_element<4, Tuple>::type>::type
> type;
};
template <class Tuple, template <typename T> class CvtOp> struct ConvertTuple<Tuple, 6, CvtOp>
{
typedef tuple<
typename CvtOp<typename tuple_element<0, Tuple>::type>::type,
typename CvtOp<typename tuple_element<1, Tuple>::type>::type,
typename CvtOp<typename tuple_element<2, Tuple>::type>::type,
typename CvtOp<typename tuple_element<3, Tuple>::type>::type,
typename CvtOp<typename tuple_element<4, Tuple>::type>::type,
typename CvtOp<typename tuple_element<5, Tuple>::type>::type
> type;
};
template <class Tuple, template <typename T> class CvtOp> struct ConvertTuple<Tuple, 7, CvtOp>
{
typedef tuple<
typename CvtOp<typename tuple_element<0, Tuple>::type>::type,
typename CvtOp<typename tuple_element<1, Tuple>::type>::type,
typename CvtOp<typename tuple_element<2, Tuple>::type>::type,
typename CvtOp<typename tuple_element<3, Tuple>::type>::type,
typename CvtOp<typename tuple_element<4, Tuple>::type>::type,
typename CvtOp<typename tuple_element<5, Tuple>::type>::type,
typename CvtOp<typename tuple_element<6, Tuple>::type>::type
> type;
};
template <class Tuple, template <typename T> class CvtOp> struct ConvertTuple<Tuple, 8, CvtOp>
{
typedef tuple<
typename CvtOp<typename tuple_element<0, Tuple>::type>::type,
typename CvtOp<typename tuple_element<1, Tuple>::type>::type,
typename CvtOp<typename tuple_element<2, Tuple>::type>::type,
typename CvtOp<typename tuple_element<3, Tuple>::type>::type,
typename CvtOp<typename tuple_element<4, Tuple>::type>::type,
typename CvtOp<typename tuple_element<5, Tuple>::type>::type,
typename CvtOp<typename tuple_element<6, Tuple>::type>::type,
typename CvtOp<typename tuple_element<7, Tuple>::type>::type
> type;
};
template <class Tuple, template <typename T> class CvtOp> struct ConvertTuple<Tuple, 9, CvtOp>
{
typedef tuple<
typename CvtOp<typename tuple_element<0, Tuple>::type>::type,
typename CvtOp<typename tuple_element<1, Tuple>::type>::type,
typename CvtOp<typename tuple_element<2, Tuple>::type>::type,
typename CvtOp<typename tuple_element<3, Tuple>::type>::type,
typename CvtOp<typename tuple_element<4, Tuple>::type>::type,
typename CvtOp<typename tuple_element<5, Tuple>::type>::type,
typename CvtOp<typename tuple_element<6, Tuple>::type>::type,
typename CvtOp<typename tuple_element<7, Tuple>::type>::type,
typename CvtOp<typename tuple_element<8, Tuple>::type>::type
> type;
};
template <class Tuple, template <typename T> class CvtOp> struct ConvertTuple<Tuple, 10, CvtOp>
{
typedef tuple<
typename CvtOp<typename tuple_element<0, Tuple>::type>::type,
typename CvtOp<typename tuple_element<1, Tuple>::type>::type,
typename CvtOp<typename tuple_element<2, Tuple>::type>::type,
typename CvtOp<typename tuple_element<3, Tuple>::type>::type,
typename CvtOp<typename tuple_element<4, Tuple>::type>::type,
typename CvtOp<typename tuple_element<5, Tuple>::type>::type,
typename CvtOp<typename tuple_element<6, Tuple>::type>::type,
typename CvtOp<typename tuple_element<7, Tuple>::type>::type,
typename CvtOp<typename tuple_element<8, Tuple>::type>::type,
typename CvtOp<typename tuple_element<9, Tuple>::type>::type
> type;
};
}
}}
#endif