27 static T parse(
const mxArray* cell);
28 static mxArray*
wrap(
T&& var);
29 static void destroy(
const mxArray* cell);
31 template <
typename T,
typename =
void>
struct mx_wrapper;
36 using signed_t = std::integral_constant<mxClassID, mxINT64_CLASS>;
37 using unsigned_t = std::integral_constant<mxClassID, mxUINT64_CLASS>;
48 using value = std::integral_constant<mxClassID, mxUINT64_CLASS>;
55 using value = std::integral_constant<mxClassID, mxLOGICAL_CLASS>;
59 template <
typename T>
struct mx_wrapper<
T, typename
std::enable_if<std::is_floating_point<T>::value>
::type>
62 using value = std::integral_constant<mxClassID, mxDOUBLE_CLASS>;
69 using signed_t = std::integral_constant<mxClassID, mxINT64_CLASS>;
70 using unsigned_t = std::integral_constant<mxClassID, mxUINT64_CLASS>;
80 using value = std::integral_constant<mxClassID, mxUINT8_CLASS>;
84 using value = std::integral_constant<mxClassID, mxUINT16_CLASS>;
88 using value = std::integral_constant<mxClassID, mxUINT32_CLASS>;
92 using value = std::integral_constant<mxClassID, mxUINT64_CLASS>;
96 using value = std::integral_constant<mxClassID, mxINT8_CLASS>;
100 using value = std::integral_constant<mxClassID, mxINT16_CLASS>;
104 using value = std::integral_constant<mxClassID, mxINT32_CLASS>;
108 using value = std::integral_constant<mxClassID, mxINT64_CLASS>;
128 template <
typename U>
static ao2& check_to(...);
130 template <
typename U>
static ao2& check_from(...);
132 template <
typename U>
static ao2& check_cells(...);
137 enum { has_to =
sizeof(check_to<derived>(0)) == 2 };
138 enum { has_from =
sizeof(check_from<derived>(0)) == 2 };
140 enum {
use_cells =
sizeof(check_cells<derived>(0)) == 2 };
145 template <
typename T>
static typename std::enable_if<detector<T>::has_to,
internal_t<T>*>
::type 148 template <
typename T>
static typename std::enable_if<!detector<T>::has_to,
internal_t<T>*>
::type 152 template <
typename T>
static typename std::enable_if<detector<T>::has_from,
T>
::type 155 template <
typename T>
static typename std::enable_if<!detector<T>::has_from,
T>
::type 157 template <
typename T>
using use_cells = std::integral_constant<bool, detector<T>::use_cells>;
196 auto *outp =
static_cast<typename
wrapper::type*
>(mxGetData(cell));
241 return MatlabParamParser::parse_array<typename is_array_type<T>::inner_t>(cell);
252 return mxCreateString(
str);
257 auto str = mxArrayToString(cell);
271 auto ptr =
static_cast<double*
>(mxGetData(cell));
276 auto cell = mxCreateNumericMatrix(1, 1, mxDOUBLE_CLASS, mxREAL);
277 auto ptr =
static_cast<double*
>(mxGetData(cell));
278 *ptr = dur.count() / 1.e6;
289 auto length = mxGetNumberOfElements(cells);
293 ret.push_back(traits_trampoline::from_internal<T>(reinterpret_cast<internal_t*>(ptr[
i])));
302 auto length = mxGetNumberOfElements(cells);
306 ret.push_back(ptr[
i]);
324 auto cells = mxCreateCellMatrix(1, length);
326 mxSetCell(cells,
x,
wrap(
T(var[
x])));
typename type_traits< T >::rs2_internal_t internal_t
typename std::conditional< bool(std::is_signed< typename std::underlying_type< T >::type >::value), signed_t, unsigned_t >::type value_t
std::integral_constant< mxClassID, mxINT64_CLASS > signed_t
static T parse(const mxArray *cell)
std::integral_constant< mxClassID, mxINT64_CLASS > signed_t
typedef void(APIENTRY *GLDEBUGPROC)(GLenum source
static mxArray * wrap(T &&var)
std::integral_constant< mxClassID, mxUINT16_CLASS > value
static void destroy(const mxArray *cell)
integral_constant< bool, false > false_type
std::integral_constant< mxClassID, mxUINT8_CLASS > value
static std::enable_if< is_basic_type< T >::value, std::vector< T > >::type parse_array(const mxArray *cells)
static mxArray * wrap(T &&var)
std::integral_constant< bool, detector< T >::use_cells > use_cells
std::integral_constant< mxClassID, mxUINT64_CLASS > value
std::integral_constant< mxClassID, mxINT8_CLASS > value
GLsizei const GLchar *const * string
std::integral_constant< mxClassID, mxINT16_CLASS > value
typename std::conditional< std::is_same< value_t, signed_t >::value, int64_t, uint64_t >::type type
static mxArray * wrap(T &&var)
static std::enable_if< detector< T >::has_to, internal_t< T > * >::type to_internal(T &&val)
static std::enable_if< is_basic_type< T >::value, mxArray * >::type wrap_array(const T *var, size_t length)
static T parse(const mxArray *cell)
static void destroy(const mxArray *cell)
static T parse(const mxArray *cell)
integral_constant< bool, B > bool_constant
std::bool_constant< std::is_arithmetic< T >::value||std::is_pointer< T >::value||std::is_enum< T >::value > is_basic_type
static std::chrono::nanoseconds parse(const mxArray *cell)
unsigned __int64 uint64_t
static mxArray * wrap(T &&var)
typename std::conditional< std::is_same< value_t, signed_t >::value, int64_t, uint64_t >::type type
std::integral_constant< mxClassID, mxUINT64_CLASS > unsigned_t
typename std::conditional< std::is_integral< T >::value, typename std::conditional< std::is_signed< T >::value, int64_t, uint64_t >::type, T >::type type
std::integral_constant< mxClassID, mxUINT64_CLASS > value
std::chrono::duration< uint64_t, std::nano > nanoseconds
static std::enable_if<!detector< T >::has_to, internal_t< T > * >::type to_internal(T &&val)
std::integral_constant< mxClassID, mxINT64_CLASS > value
static mxArray * wrap(std::chrono::nanoseconds &&dur)
static std::enable_if<!is_basic_type< T >::value, std::vector< T > >::type parse_array(const mxArray *cells)
std::integral_constant< mxClassID, mxINT32_CLASS > value
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
std::integral_constant< mxClassID, mxUINT32_CLASS > value
static void destroy(const mxArray *cell)
std::integral_constant< mxClassID, mxUINT64_CLASS > unsigned_t
typename std::conditional< std::is_signed< T >::value, signed_t, unsigned_t >::type value_t
GLenum GLuint GLenum GLsizei length
static std::enable_if< detector< T >::has_from, T >::type from_internal(internal_t< T > *ptr)
static T parse(const mxArray *cell)
static std::enable_if<!detector< T >::has_from, T >::type from_internal(internal_t< T > *ptr)
static mxArray * wrap(T &&var)
std::integral_constant< mxClassID, mxDOUBLE_CLASS > value
static T parse(const mxArray *cell)
integral_constant< bool, true > true_type
static std::enable_if<!is_basic_type< T >::value &&!traits_trampoline::use_cells< T >::value, mxArray * >::type wrap_array(const T *var, size_t length)
std::integral_constant< mxClassID, mxLOGICAL_CLASS > value