Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
cae72aee
Commit
cae72aee
authored
Mar 08, 2016
by
Davis King
Browse files
Upgraded mex wrapper to support 20 argument functions instead of just 10.
parent
deaf8f94
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2826 additions
and
316 deletions
+2826
-316
dlib/any/any_function.h
dlib/any/any_function.h
+505
-0
dlib/matlab/mex_wrapper.cpp
dlib/matlab/mex_wrapper.cpp
+2321
-316
No files found.
dlib/any/any_function.h
View file @
cae72aee
...
...
@@ -32,6 +32,16 @@ namespace dlib
typedef
void
arg8_type
;
typedef
void
arg9_type
;
typedef
void
arg10_type
;
typedef
void
arg11_type
;
typedef
void
arg12_type
;
typedef
void
arg13_type
;
typedef
void
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
0
;
};
...
...
@@ -53,6 +63,16 @@ namespace dlib
typedef
void
arg8_type
;
typedef
void
arg9_type
;
typedef
void
arg10_type
;
typedef
void
arg11_type
;
typedef
void
arg12_type
;
typedef
void
arg13_type
;
typedef
void
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
1
;
};
...
...
@@ -74,6 +94,16 @@ namespace dlib
typedef
void
arg8_type
;
typedef
void
arg9_type
;
typedef
void
arg10_type
;
typedef
void
arg11_type
;
typedef
void
arg12_type
;
typedef
void
arg13_type
;
typedef
void
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
2
;
};
...
...
@@ -95,6 +125,16 @@ namespace dlib
typedef
void
arg8_type
;
typedef
void
arg9_type
;
typedef
void
arg10_type
;
typedef
void
arg11_type
;
typedef
void
arg12_type
;
typedef
void
arg13_type
;
typedef
void
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
3
;
};
...
...
@@ -117,6 +157,16 @@ namespace dlib
typedef
void
arg8_type
;
typedef
void
arg9_type
;
typedef
void
arg10_type
;
typedef
void
arg11_type
;
typedef
void
arg12_type
;
typedef
void
arg13_type
;
typedef
void
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
4
;
};
...
...
@@ -139,6 +189,16 @@ namespace dlib
typedef
void
arg8_type
;
typedef
void
arg9_type
;
typedef
void
arg10_type
;
typedef
void
arg11_type
;
typedef
void
arg12_type
;
typedef
void
arg13_type
;
typedef
void
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
5
;
};
...
...
@@ -161,6 +221,16 @@ namespace dlib
typedef
void
arg8_type
;
typedef
void
arg9_type
;
typedef
void
arg10_type
;
typedef
void
arg11_type
;
typedef
void
arg12_type
;
typedef
void
arg13_type
;
typedef
void
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
6
;
};
...
...
@@ -184,6 +254,16 @@ namespace dlib
typedef
void
arg8_type
;
typedef
void
arg9_type
;
typedef
void
arg10_type
;
typedef
void
arg11_type
;
typedef
void
arg12_type
;
typedef
void
arg13_type
;
typedef
void
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
7
;
};
...
...
@@ -207,6 +287,16 @@ namespace dlib
typedef
A8
arg8_type
;
typedef
void
arg9_type
;
typedef
void
arg10_type
;
typedef
void
arg11_type
;
typedef
void
arg12_type
;
typedef
void
arg13_type
;
typedef
void
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
8
;
};
...
...
@@ -230,6 +320,16 @@ namespace dlib
typedef
A8
arg8_type
;
typedef
A9
arg9_type
;
typedef
void
arg10_type
;
typedef
void
arg11_type
;
typedef
void
arg12_type
;
typedef
void
arg13_type
;
typedef
void
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
9
;
};
...
...
@@ -254,10 +354,415 @@ namespace dlib
typedef
A8
arg8_type
;
typedef
A9
arg9_type
;
typedef
A10
arg10_type
;
typedef
void
arg11_type
;
typedef
void
arg12_type
;
typedef
void
arg13_type
;
typedef
void
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
10
;
};
template
<
typename
T
,
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
,
typename
A10
,
typename
A11
>
struct
sig_traits
<
T
(
A1
,
A2
,
A3
,
A4
,
A5
,
A6
,
A7
,
A8
,
A9
,
A10
,
A11
)
>
{
typedef
T
result_type
;
typedef
A1
arg1_type
;
typedef
A2
arg2_type
;
typedef
A3
arg3_type
;
typedef
A4
arg4_type
;
typedef
A5
arg5_type
;
typedef
A6
arg6_type
;
typedef
A7
arg7_type
;
typedef
A8
arg8_type
;
typedef
A9
arg9_type
;
typedef
A10
arg10_type
;
typedef
A11
arg11_type
;
typedef
void
arg12_type
;
typedef
void
arg13_type
;
typedef
void
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
11
;
};
template
<
typename
T
,
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
,
typename
A10
,
typename
A11
,
typename
A12
>
struct
sig_traits
<
T
(
A1
,
A2
,
A3
,
A4
,
A5
,
A6
,
A7
,
A8
,
A9
,
A10
,
A11
,
A12
)
>
{
typedef
T
result_type
;
typedef
A1
arg1_type
;
typedef
A2
arg2_type
;
typedef
A3
arg3_type
;
typedef
A4
arg4_type
;
typedef
A5
arg5_type
;
typedef
A6
arg6_type
;
typedef
A7
arg7_type
;
typedef
A8
arg8_type
;
typedef
A9
arg9_type
;
typedef
A10
arg10_type
;
typedef
A11
arg11_type
;
typedef
A12
arg12_type
;
typedef
void
arg13_type
;
typedef
void
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
12
;
};
template
<
typename
T
,
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
,
typename
A10
,
typename
A11
,
typename
A12
,
typename
A13
>
struct
sig_traits
<
T
(
A1
,
A2
,
A3
,
A4
,
A5
,
A6
,
A7
,
A8
,
A9
,
A10
,
A11
,
A12
,
A13
)
>
{
typedef
T
result_type
;
typedef
A1
arg1_type
;
typedef
A2
arg2_type
;
typedef
A3
arg3_type
;
typedef
A4
arg4_type
;
typedef
A5
arg5_type
;
typedef
A6
arg6_type
;
typedef
A7
arg7_type
;
typedef
A8
arg8_type
;
typedef
A9
arg9_type
;
typedef
A10
arg10_type
;
typedef
A11
arg11_type
;
typedef
A12
arg12_type
;
typedef
A13
arg13_type
;
typedef
void
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
13
;
};
template
<
typename
T
,
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
,
typename
A10
,
typename
A11
,
typename
A12
,
typename
A13
,
typename
A14
>
struct
sig_traits
<
T
(
A1
,
A2
,
A3
,
A4
,
A5
,
A6
,
A7
,
A8
,
A9
,
A10
,
A11
,
A12
,
A13
,
A14
)
>
{
typedef
T
result_type
;
typedef
A1
arg1_type
;
typedef
A2
arg2_type
;
typedef
A3
arg3_type
;
typedef
A4
arg4_type
;
typedef
A5
arg5_type
;
typedef
A6
arg6_type
;
typedef
A7
arg7_type
;
typedef
A8
arg8_type
;
typedef
A9
arg9_type
;
typedef
A10
arg10_type
;
typedef
A11
arg11_type
;
typedef
A12
arg12_type
;
typedef
A13
arg13_type
;
typedef
A14
arg14_type
;
typedef
void
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
14
;
};
template
<
typename
T
,
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
,
typename
A10
,
typename
A11
,
typename
A12
,
typename
A13
,
typename
A14
,
typename
A15
>
struct
sig_traits
<
T
(
A1
,
A2
,
A3
,
A4
,
A5
,
A6
,
A7
,
A8
,
A9
,
A10
,
A11
,
A12
,
A13
,
A14
,
A15
)
>
{
typedef
T
result_type
;
typedef
A1
arg1_type
;
typedef
A2
arg2_type
;
typedef
A3
arg3_type
;
typedef
A4
arg4_type
;
typedef
A5
arg5_type
;
typedef
A6
arg6_type
;
typedef
A7
arg7_type
;
typedef
A8
arg8_type
;
typedef
A9
arg9_type
;
typedef
A10
arg10_type
;
typedef
A11
arg11_type
;
typedef
A12
arg12_type
;
typedef
A13
arg13_type
;
typedef
A14
arg14_type
;
typedef
A15
arg15_type
;
typedef
void
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
15
;
};
template
<
typename
T
,
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
,
typename
A10
,
typename
A11
,
typename
A12
,
typename
A13
,
typename
A14
,
typename
A15
,
typename
A16
>
struct
sig_traits
<
T
(
A1
,
A2
,
A3
,
A4
,
A5
,
A6
,
A7
,
A8
,
A9
,
A10
,
A11
,
A12
,
A13
,
A14
,
A15
,
A16
)
>
{
typedef
T
result_type
;
typedef
A1
arg1_type
;
typedef
A2
arg2_type
;
typedef
A3
arg3_type
;
typedef
A4
arg4_type
;
typedef
A5
arg5_type
;
typedef
A6
arg6_type
;
typedef
A7
arg7_type
;
typedef
A8
arg8_type
;
typedef
A9
arg9_type
;
typedef
A10
arg10_type
;
typedef
A11
arg11_type
;
typedef
A12
arg12_type
;
typedef
A13
arg13_type
;
typedef
A14
arg14_type
;
typedef
A15
arg15_type
;
typedef
A16
arg16_type
;
typedef
void
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
16
;
};
template
<
typename
T
,
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
,
typename
A10
,
typename
A11
,
typename
A12
,
typename
A13
,
typename
A14
,
typename
A15
,
typename
A16
,
typename
A17
>
struct
sig_traits
<
T
(
A1
,
A2
,
A3
,
A4
,
A5
,
A6
,
A7
,
A8
,
A9
,
A10
,
A11
,
A12
,
A13
,
A14
,
A15
,
A16
,
A17
)
>
{
typedef
T
result_type
;
typedef
A1
arg1_type
;
typedef
A2
arg2_type
;
typedef
A3
arg3_type
;
typedef
A4
arg4_type
;
typedef
A5
arg5_type
;
typedef
A6
arg6_type
;
typedef
A7
arg7_type
;
typedef
A8
arg8_type
;
typedef
A9
arg9_type
;
typedef
A10
arg10_type
;
typedef
A11
arg11_type
;
typedef
A12
arg12_type
;
typedef
A13
arg13_type
;
typedef
A14
arg14_type
;
typedef
A15
arg15_type
;
typedef
A16
arg16_type
;
typedef
A17
arg17_type
;
typedef
void
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
17
;
};
template
<
typename
T
,
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
,
typename
A10
,
typename
A11
,
typename
A12
,
typename
A13
,
typename
A14
,
typename
A15
,
typename
A16
,
typename
A17
,
typename
A18
>
struct
sig_traits
<
T
(
A1
,
A2
,
A3
,
A4
,
A5
,
A6
,
A7
,
A8
,
A9
,
A10
,
A11
,
A12
,
A13
,
A14
,
A15
,
A16
,
A17
,
A18
)
>
{
typedef
T
result_type
;
typedef
A1
arg1_type
;
typedef
A2
arg2_type
;
typedef
A3
arg3_type
;
typedef
A4
arg4_type
;
typedef
A5
arg5_type
;
typedef
A6
arg6_type
;
typedef
A7
arg7_type
;
typedef
A8
arg8_type
;
typedef
A9
arg9_type
;
typedef
A10
arg10_type
;
typedef
A11
arg11_type
;
typedef
A12
arg12_type
;
typedef
A13
arg13_type
;
typedef
A14
arg14_type
;
typedef
A15
arg15_type
;
typedef
A16
arg16_type
;
typedef
A17
arg17_type
;
typedef
A18
arg18_type
;
typedef
void
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
18
;
};
template
<
typename
T
,
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
,
typename
A10
,
typename
A11
,
typename
A12
,
typename
A13
,
typename
A14
,
typename
A15
,
typename
A16
,
typename
A17
,
typename
A18
,
typename
A19
>
struct
sig_traits
<
T
(
A1
,
A2
,
A3
,
A4
,
A5
,
A6
,
A7
,
A8
,
A9
,
A10
,
A11
,
A12
,
A13
,
A14
,
A15
,
A16
,
A17
,
A18
,
A19
)
>
{
typedef
T
result_type
;
typedef
A1
arg1_type
;
typedef
A2
arg2_type
;
typedef
A3
arg3_type
;
typedef
A4
arg4_type
;
typedef
A5
arg5_type
;
typedef
A6
arg6_type
;
typedef
A7
arg7_type
;
typedef
A8
arg8_type
;
typedef
A9
arg9_type
;
typedef
A10
arg10_type
;
typedef
A11
arg11_type
;
typedef
A12
arg12_type
;
typedef
A13
arg13_type
;
typedef
A14
arg14_type
;
typedef
A15
arg15_type
;
typedef
A16
arg16_type
;
typedef
A17
arg17_type
;
typedef
A18
arg18_type
;
typedef
A19
arg19_type
;
typedef
void
arg20_type
;
const
static
unsigned
long
num_args
=
19
;
};
template
<
typename
T
,
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
,
typename
A10
,
typename
A11
,
typename
A12
,
typename
A13
,
typename
A14
,
typename
A15
,
typename
A16
,
typename
A17
,
typename
A18
,
typename
A19
,
typename
A20
>
struct
sig_traits
<
T
(
A1
,
A2
,
A3
,
A4
,
A5
,
A6
,
A7
,
A8
,
A9
,
A10
,
A11
,
A12
,
A13
,
A14
,
A15
,
A16
,
A17
,
A18
,
A19
,
A20
)
>
{
typedef
T
result_type
;
typedef
A1
arg1_type
;
typedef
A2
arg2_type
;
typedef
A3
arg3_type
;
typedef
A4
arg4_type
;
typedef
A5
arg5_type
;
typedef
A6
arg6_type
;
typedef
A7
arg7_type
;
typedef
A8
arg8_type
;
typedef
A9
arg9_type
;
typedef
A10
arg10_type
;
typedef
A11
arg11_type
;
typedef
A12
arg12_type
;
typedef
A13
arg13_type
;
typedef
A14
arg14_type
;
typedef
A15
arg15_type
;
typedef
A16
arg16_type
;
typedef
A17
arg17_type
;
typedef
A18
arg18_type
;
typedef
A19
arg19_type
;
typedef
A20
arg20_type
;
const
static
unsigned
long
num_args
=
20
;
};
// ----------------------------------------------------------------------------------------
template
<
...
...
dlib/matlab/mex_wrapper.cpp
View file @
cae72aee
...
...
@@ -173,6 +173,66 @@
#define ELSE_ASSIGN_ARG_10
#endif
#ifdef ARG_11_DEFAULT
#define ELSE_ASSIGN_ARG_11 else A11 = ARG_11_DEFAULT;
#else
#define ELSE_ASSIGN_ARG_11
#endif
#ifdef ARG_12_DEFAULT
#define ELSE_ASSIGN_ARG_12 else A12 = ARG_12_DEFAULT;
#else
#define ELSE_ASSIGN_ARG_12
#endif
#ifdef ARG_13_DEFAULT
#define ELSE_ASSIGN_ARG_13 else A13 = ARG_13_DEFAULT;
#else
#define ELSE_ASSIGN_ARG_13
#endif
#ifdef ARG_14_DEFAULT
#define ELSE_ASSIGN_ARG_14 else A14 = ARG_14_DEFAULT;
#else
#define ELSE_ASSIGN_ARG_14
#endif
#ifdef ARG_15_DEFAULT
#define ELSE_ASSIGN_ARG_15 else A15 = ARG_15_DEFAULT;
#else
#define ELSE_ASSIGN_ARG_15
#endif
#ifdef ARG_16_DEFAULT
#define ELSE_ASSIGN_ARG_16 else A16 = ARG_16_DEFAULT;
#else
#define ELSE_ASSIGN_ARG_16
#endif
#ifdef ARG_17_DEFAULT
#define ELSE_ASSIGN_ARG_17 else A17 = ARG_17_DEFAULT;
#else
#define ELSE_ASSIGN_ARG_17
#endif
#ifdef ARG_18_DEFAULT
#define ELSE_ASSIGN_ARG_18 else A18 = ARG_18_DEFAULT;
#else
#define ELSE_ASSIGN_ARG_18
#endif
#ifdef ARG_19_DEFAULT
#define ELSE_ASSIGN_ARG_19 else A19 = ARG_19_DEFAULT;
#else
#define ELSE_ASSIGN_ARG_19
#endif
#ifdef ARG_20_DEFAULT
#define ELSE_ASSIGN_ARG_20 else A20 = ARG_20_DEFAULT;
#else
#define ELSE_ASSIGN_ARG_20
#endif
// ----------------------------------------------------------------------------------------
namespace mex_binding
...
...
@@ -203,7 +263,17 @@ namespace mex_binding
is_input_type<typename sig_traits<funct>::arg7_type>::value +
is_input_type<typename sig_traits<funct>::arg8_type>::value +
is_input_type<typename sig_traits<funct>::arg9_type>::value +
is_input_type
<
typename
sig_traits
<
funct
>::
arg10_type
>::
value
;
is_input_type<typename sig_traits<funct>::arg10_type>::value +
is_input_type<typename sig_traits<funct>::arg11_type>::value +
is_input_type<typename sig_traits<funct>::arg12_type>::value +
is_input_type<typename sig_traits<funct>::arg13_type>::value +
is_input_type<typename sig_traits<funct>::arg14_type>::value +
is_input_type<typename sig_traits<funct>::arg15_type>::value +
is_input_type<typename sig_traits<funct>::arg16_type>::value +
is_input_type<typename sig_traits<funct>::arg17_type>::value +
is_input_type<typename sig_traits<funct>::arg18_type>::value +
is_input_type<typename sig_traits<funct>::arg19_type>::value +
is_input_type<typename sig_traits<funct>::arg20_type>::value;
const static unsigned long num_outputs= is_output_type<typename sig_traits<funct>::arg1_type>::value +
is_output_type<typename sig_traits<funct>::arg2_type>::value +
...
...
@@ -214,7 +284,17 @@ namespace mex_binding
is_output_type<typename sig_traits<funct>::arg7_type>::value +
is_output_type<typename sig_traits<funct>::arg8_type>::value +
is_output_type<typename sig_traits<funct>::arg9_type>::value +
is_output_type
<
typename
sig_traits
<
funct
>::
arg10_type
>::
value
;
is_output_type<typename sig_traits<funct>::arg10_type>::value +
is_output_type<typename sig_traits<funct>::arg11_type>::value +
is_output_type<typename sig_traits<funct>::arg12_type>::value +
is_output_type<typename sig_traits<funct>::arg13_type>::value +
is_output_type<typename sig_traits<funct>::arg14_type>::value +
is_output_type<typename sig_traits<funct>::arg15_type>::value +
is_output_type<typename sig_traits<funct>::arg16_type>::value +
is_output_type<typename sig_traits<funct>::arg17_type>::value +
is_output_type<typename sig_traits<funct>::arg18_type>::value +
is_output_type<typename sig_traits<funct>::arg19_type>::value +
is_output_type<typename sig_traits<funct>::arg20_type>::value;
};
// ----------------------------------------------------------------------------------------
...
...
@@ -1550,375 +1630,1978 @@ namespace mex_binding
}
};
// ----------------------------------------------------------------------------------------
template
<
typename
funct
>
void
call_mex_function
(
const
funct
&
f
,
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
template <>
struct call_mex_function_helper<11>
{
const
long
expected_nrhs
=
funct_traits
<
funct
>::
num_inputs
;
const
long
expected_nlhs
=
funct_traits
<
funct
>::
num_outputs
;
const
long
expected_args
=
expected_nrhs
+
expected_nlhs
;
template <typename funct>
void callit(
const funct& ,
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]
) const
{
typedef typename sig_traits<funct>::arg1_type arg1_type;
typedef typename sig_traits<funct>::arg2_type arg2_type;
typedef typename sig_traits<funct>::arg3_type arg3_type;
typedef typename sig_traits<funct>::arg4_type arg4_type;
typedef typename sig_traits<funct>::arg5_type arg5_type;
typedef typename sig_traits<funct>::arg6_type arg6_type;
typedef typename sig_traits<funct>::arg7_type arg7_type;
typedef typename sig_traits<funct>::arg8_type arg8_type;
typedef typename sig_traits<funct>::arg9_type arg9_type;
typedef typename sig_traits<funct>::arg10_type arg10_type;
typedef typename sig_traits<funct>::arg11_type arg11_type;
long
defaulted_args
=
0
;
typename basic_type<arg1_type>::type A1;
typename basic_type<arg2_type>::type A2;
typename basic_type<arg3_type>::type A3;
typename basic_type<arg4_type>::type A4;
typename basic_type<arg5_type>::type A5;
typename basic_type<arg6_type>::type A6;
typename basic_type<arg7_type>::type A7;
typename basic_type<arg8_type>::type A8;
typename basic_type<arg9_type>::type A9;
typename basic_type<arg10_type>::type A10;
typename basic_type<arg11_type>::type A11;
#ifdef ARG_1_DEFAULT
++
defaulted_args
;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT
(
is_input_type
<
typename
sig_traits
<
funct
>::
arg1_type
>::
value
);
#ifndef ARG_2_DEFAULT
// You can't define a default for argument 1 if you don't define one for argument 2 also.
COMPILE_TIME_ASSERT
(
expected_args
<
2
);
#endif
COMPILE_TIME_ASSERT
(
1
<=
expected_args
);
// You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_2_DEFAULT
++
defaulted_args
;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT
(
is_input_type
<
typename
sig_traits
<
funct
>::
arg2_type
>::
value
);
#ifndef ARG_3_DEFAULT
// You can't define a default for argument 2 if you don't define one for argument 3 also.
COMPILE_TIME_ASSERT
(
expected_args
<
3
);
#endif
COMPILE_TIME_ASSERT
(
2
<=
expected_args
);
// You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_3_DEFAULT
++
defaulted_args
;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT
(
is_input_type
<
typename
sig_traits
<
funct
>::
arg3_type
>::
value
);
#ifndef ARG_4_DEFAULT
// You can't define a default for argument 3 if you don't define one for argument 4 also.
COMPILE_TIME_ASSERT
(
expected_args
<
4
);
#endif
COMPILE_TIME_ASSERT
(
3
<=
expected_args
);
// You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_4_DEFAULT
++
defaulted_args
;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT
(
is_input_type
<
typename
sig_traits
<
funct
>::
arg4_type
>::
value
);
#ifndef ARG_5_DEFAULT
// You can't define a default for argument 4 if you don't define one for argument 5 also.
COMPILE_TIME_ASSERT
(
expected_args
<
5
);
#endif
COMPILE_TIME_ASSERT
(
4
<=
expected_args
);
// You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_5_DEFAULT
++
defaulted_args
;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT
(
is_input_type
<
typename
sig_traits
<
funct
>::
arg5_type
>::
value
);
#ifndef ARG_6_DEFAULT
// You can't define a default for argument 5 if you don't define one for argument 6 also.
COMPILE_TIME_ASSERT
(
expected_args
<
6
);
#endif
COMPILE_TIME_ASSERT
(
5
<=
expected_args
);
// You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_6_DEFAULT
++
defaulted_args
;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT
(
is_input_type
<
typename
sig_traits
<
funct
>::
arg6_type
>::
value
);
#ifndef ARG_7_DEFAULT
// You can't define a default for argument 6 if you don't define one for argument 7 also.
COMPILE_TIME_ASSERT
(
expected_args
<
7
);
#endif
COMPILE_TIME_ASSERT
(
6
<=
expected_args
);
// You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_7_DEFAULT
++
defaulted_args
;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT
(
is_input_type
<
typename
sig_traits
<
funct
>::
arg7_type
>::
value
);
#ifndef ARG_8_DEFAULT
// You can't define a default for argument 7 if you don't define one for argument 8 also.
COMPILE_TIME_ASSERT
(
expected_args
<
8
);
#endif
COMPILE_TIME_ASSERT
(
7
<=
expected_args
);
// You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_8_DEFAULT
++
defaulted_args
;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT
(
is_input_type
<
typename
sig_traits
<
funct
>::
arg8_type
>::
value
);
#ifndef ARG_9_DEFAULT
// You can't define a default for argument 8 if you don't define one for argument 9 also.
COMPILE_TIME_ASSERT
(
expected_args
<
9
);
#endif
COMPILE_TIME_ASSERT
(
8
<=
expected_args
);
// You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_9_DEFAULT
++
defaulted_args
;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT
(
is_input_type
<
typename
sig_traits
<
funct
>::
arg9_type
>::
value
);
#ifndef ARG_10_DEFAULT
// You can't define a default for argument 9 if you don't define one for argument 10 also.
COMPILE_TIME_ASSERT
(
expected_args
<
10
);
#endif
COMPILE_TIME_ASSERT
(
9
<=
expected_args
);
// You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_10_DEFAULT
++
defaulted_args
;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT
(
is_input_type
<
typename
sig_traits
<
funct
>::
arg10_type
>::
value
);
COMPILE_TIME_ASSERT
(
10
<=
expected_args
);
// You can't define a default for an argument that doesn't exist.
#endif
mark_non_persistent(A1);
mark_non_persistent(A2);
mark_non_persistent(A3);
mark_non_persistent(A4);
mark_non_persistent(A5);
mark_non_persistent(A6);
mark_non_persistent(A7);
mark_non_persistent(A8);
mark_non_persistent(A9);
mark_non_persistent(A10);
mark_non_persistent(A11);
int i = 0;
if (i < nrhs && is_input_type<arg1_type>::value) {validate_and_populate_arg(i,prhs[i],A1); ++i;} ELSE_ASSIGN_ARG_1;
if (i < nrhs && is_input_type<arg2_type>::value) {validate_and_populate_arg(i,prhs[i],A2); ++i;} ELSE_ASSIGN_ARG_2;
if (i < nrhs && is_input_type<arg3_type>::value) {validate_and_populate_arg(i,prhs[i],A3); ++i;} ELSE_ASSIGN_ARG_3;
if (i < nrhs && is_input_type<arg4_type>::value) {validate_and_populate_arg(i,prhs[i],A4); ++i;} ELSE_ASSIGN_ARG_4;
if (i < nrhs && is_input_type<arg5_type>::value) {validate_and_populate_arg(i,prhs[i],A5); ++i;} ELSE_ASSIGN_ARG_5;
if (i < nrhs && is_input_type<arg6_type>::value) {validate_and_populate_arg(i,prhs[i],A6); ++i;} ELSE_ASSIGN_ARG_6;
if (i < nrhs && is_input_type<arg7_type>::value) {validate_and_populate_arg(i,prhs[i],A7); ++i;} ELSE_ASSIGN_ARG_7;
if (i < nrhs && is_input_type<arg8_type>::value) {validate_and_populate_arg(i,prhs[i],A8); ++i;} ELSE_ASSIGN_ARG_8;
if (i < nrhs && is_input_type<arg9_type>::value) {validate_and_populate_arg(i,prhs[i],A9); ++i;} ELSE_ASSIGN_ARG_9;
if (i < nrhs && is_input_type<arg10_type>::value) {validate_and_populate_arg(i,prhs[i],A10); ++i;} ELSE_ASSIGN_ARG_10;
if (i < nrhs && is_input_type<arg11_type>::value) {validate_and_populate_arg(i,prhs[i],A11); ++i;} ELSE_ASSIGN_ARG_11;
mex_function(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11);
/* check for proper number of arguments */
if
(
nrhs
>
expected_nrhs
||
nrhs
<
expected_nrhs
-
defaulted_args
)
{
std
::
ostringstream
sout
;
sout
<<
"Expected between "
<<
expected_nrhs
-
defaulted_args
<<
" and "
<<
expected_nrhs
<<
" input arguments, got "
<<
nrhs
<<
"."
;
mexErrMsgIdAndTxt
(
"mex_function:nrhs"
,
sout
.
str
().
c_str
());
i = 0;
if (is_output_type<arg1_type>::value) {assign_to_matlab(plhs[i],A1); ++i;}
if (is_output_type<arg2_type>::value) {assign_to_matlab(plhs[i],A2); ++i;}
if (is_output_type<arg3_type>::value) {assign_to_matlab(plhs[i],A3); ++i;}
if (is_output_type<arg4_type>::value) {assign_to_matlab(plhs[i],A4); ++i;}
if (is_output_type<arg5_type>::value) {assign_to_matlab(plhs[i],A5); ++i;}
if (is_output_type<arg6_type>::value) {assign_to_matlab(plhs[i],A6); ++i;}
if (is_output_type<arg7_type>::value) {assign_to_matlab(plhs[i],A7); ++i;}
if (is_output_type<arg8_type>::value) {assign_to_matlab(plhs[i],A8); ++i;}
if (is_output_type<arg9_type>::value) {assign_to_matlab(plhs[i],A9); ++i;}
if (is_output_type<arg10_type>::value) {assign_to_matlab(plhs[i],A10); ++i;}
if (is_output_type<arg11_type>::value) {assign_to_matlab(plhs[i],A11); ++i;}
}
};
if
(
nlhs
>
expected_nlhs
)
template <>
struct call_mex_function_helper<12>
{
template <typename funct>
void callit(
const funct& ,
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]
) const
{
std
::
ostringstream
sout
;
sout
<<
"Expected at most "
<<
expected_nlhs
<<
" output arguments, got "
<<
nlhs
<<
"."
;
typedef typename sig_traits<funct>::arg1_type arg1_type;
typedef typename sig_traits<funct>::arg2_type arg2_type;
typedef typename sig_traits<funct>::arg3_type arg3_type;
typedef typename sig_traits<funct>::arg4_type arg4_type;
typedef typename sig_traits<funct>::arg5_type arg5_type;
typedef typename sig_traits<funct>::arg6_type arg6_type;
typedef typename sig_traits<funct>::arg7_type arg7_type;
typedef typename sig_traits<funct>::arg8_type arg8_type;
typedef typename sig_traits<funct>::arg9_type arg9_type;
typedef typename sig_traits<funct>::arg10_type arg10_type;
typedef typename sig_traits<funct>::arg11_type arg11_type;
typedef typename sig_traits<funct>::arg12_type arg12_type;
mexErrMsgIdAndTxt
(
"mex_function:nlhs"
,
sout
.
str
().
c_str
());
}
typename basic_type<arg1_type>::type A1;
typename basic_type<arg2_type>::type A2;
typename basic_type<arg3_type>::type A3;
typename basic_type<arg4_type>::type A4;
typename basic_type<arg5_type>::type A5;
typename basic_type<arg6_type>::type A6;
typename basic_type<arg7_type>::type A7;
typename basic_type<arg8_type>::type A8;
typename basic_type<arg9_type>::type A9;
typename basic_type<arg10_type>::type A10;
typename basic_type<arg11_type>::type A11;
typename basic_type<arg12_type>::type A12;
try
{
call_mex_function_helper
<
sig_traits
<
funct
>::
num_args
>
helper
;
helper
.
callit
(
f
,
nlhs
,
plhs
,
nrhs
,
prhs
);
}
catch
(
invalid_args_exception
&
e
)
{
mexErrMsgIdAndTxt
(
"mex_function:validate_and_populate_arg"
,
(
"Input"
+
e
.
msg
).
c_str
());
}
catch
(
user_hit_ctrl_c
&
)
{
// do nothing, just return to matlab
mark_non_persistent(A1);
mark_non_persistent(A2);
mark_non_persistent(A3);
mark_non_persistent(A4);
mark_non_persistent(A5);
mark_non_persistent(A6);
mark_non_persistent(A7);
mark_non_persistent(A8);
mark_non_persistent(A9);
mark_non_persistent(A10);
mark_non_persistent(A11);
mark_non_persistent(A12);
int i = 0;
if (i < nrhs && is_input_type<arg1_type>::value) {validate_and_populate_arg(i,prhs[i],A1); ++i;} ELSE_ASSIGN_ARG_1;
if (i < nrhs && is_input_type<arg2_type>::value) {validate_and_populate_arg(i,prhs[i],A2); ++i;} ELSE_ASSIGN_ARG_2;
if (i < nrhs && is_input_type<arg3_type>::value) {validate_and_populate_arg(i,prhs[i],A3); ++i;} ELSE_ASSIGN_ARG_3;
if (i < nrhs && is_input_type<arg4_type>::value) {validate_and_populate_arg(i,prhs[i],A4); ++i;} ELSE_ASSIGN_ARG_4;
if (i < nrhs && is_input_type<arg5_type>::value) {validate_and_populate_arg(i,prhs[i],A5); ++i;} ELSE_ASSIGN_ARG_5;
if (i < nrhs && is_input_type<arg6_type>::value) {validate_and_populate_arg(i,prhs[i],A6); ++i;} ELSE_ASSIGN_ARG_6;
if (i < nrhs && is_input_type<arg7_type>::value) {validate_and_populate_arg(i,prhs[i],A7); ++i;} ELSE_ASSIGN_ARG_7;
if (i < nrhs && is_input_type<arg8_type>::value) {validate_and_populate_arg(i,prhs[i],A8); ++i;} ELSE_ASSIGN_ARG_8;
if (i < nrhs && is_input_type<arg9_type>::value) {validate_and_populate_arg(i,prhs[i],A9); ++i;} ELSE_ASSIGN_ARG_9;
if (i < nrhs && is_input_type<arg10_type>::value) {validate_and_populate_arg(i,prhs[i],A10); ++i;} ELSE_ASSIGN_ARG_10;
if (i < nrhs && is_input_type<arg11_type>::value) {validate_and_populate_arg(i,prhs[i],A11); ++i;} ELSE_ASSIGN_ARG_11;
if (i < nrhs && is_input_type<arg12_type>::value) {validate_and_populate_arg(i,prhs[i],A12); ++i;} ELSE_ASSIGN_ARG_12;
mex_function(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12);
i = 0;
if (is_output_type<arg1_type>::value) {assign_to_matlab(plhs[i],A1); ++i;}
if (is_output_type<arg2_type>::value) {assign_to_matlab(plhs[i],A2); ++i;}
if (is_output_type<arg3_type>::value) {assign_to_matlab(plhs[i],A3); ++i;}
if (is_output_type<arg4_type>::value) {assign_to_matlab(plhs[i],A4); ++i;}
if (is_output_type<arg5_type>::value) {assign_to_matlab(plhs[i],A5); ++i;}
if (is_output_type<arg6_type>::value) {assign_to_matlab(plhs[i],A6); ++i;}
if (is_output_type<arg7_type>::value) {assign_to_matlab(plhs[i],A7); ++i;}
if (is_output_type<arg8_type>::value) {assign_to_matlab(plhs[i],A8); ++i;}
if (is_output_type<arg9_type>::value) {assign_to_matlab(plhs[i],A9); ++i;}
if (is_output_type<arg10_type>::value) {assign_to_matlab(plhs[i],A10); ++i;}
if (is_output_type<arg11_type>::value) {assign_to_matlab(plhs[i],A11); ++i;}
if (is_output_type<arg12_type>::value) {assign_to_matlab(plhs[i],A12); ++i;}
}
catch
(
dlib
::
error
&
e
)
};
template <>
struct call_mex_function_helper<13>
{
template <typename funct>
void callit(
const funct& ,
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]
) const
{
mexErrMsgIdAndTxt
(
"mex_function:error"
,
e
.
what
());
}
typedef typename sig_traits<funct>::arg1_type arg1_type;
typedef typename sig_traits<funct>::arg2_type arg2_type;
typedef typename sig_traits<funct>::arg3_type arg3_type;
typedef typename sig_traits<funct>::arg4_type arg4_type;
typedef typename sig_traits<funct>::arg5_type arg5_type;
typedef typename sig_traits<funct>::arg6_type arg6_type;
typedef typename sig_traits<funct>::arg7_type arg7_type;
typedef typename sig_traits<funct>::arg8_type arg8_type;
typedef typename sig_traits<funct>::arg9_type arg9_type;
typedef typename sig_traits<funct>::arg10_type arg10_type;
typedef typename sig_traits<funct>::arg11_type arg11_type;
typedef typename sig_traits<funct>::arg12_type arg12_type;
typedef typename sig_traits<funct>::arg13_type arg13_type;
}
typename basic_type<arg1_type>::type A1;
typename basic_type<arg2_type>::type A2;
typename basic_type<arg3_type>::type A3;
typename basic_type<arg4_type>::type A4;
typename basic_type<arg5_type>::type A5;
typename basic_type<arg6_type>::type A6;
typename basic_type<arg7_type>::type A7;
typename basic_type<arg8_type>::type A8;
typename basic_type<arg9_type>::type A9;
typename basic_type<arg10_type>::type A10;
typename basic_type<arg11_type>::type A11;
typename basic_type<arg12_type>::type A12;
typename basic_type<arg13_type>::type A13;
// ----------------------------------------------------------------------------------------
mark_non_persistent(A1);
mark_non_persistent(A2);
mark_non_persistent(A3);
mark_non_persistent(A4);
mark_non_persistent(A5);
mark_non_persistent(A6);
mark_non_persistent(A7);
mark_non_persistent(A8);
mark_non_persistent(A9);
mark_non_persistent(A10);
mark_non_persistent(A11);
mark_non_persistent(A12);
mark_non_persistent(A13);
class
mex_streambuf
:
public
std
::
streambuf
int i = 0;
if (i < nrhs && is_input_type<arg1_type>::value) {validate_and_populate_arg(i,prhs[i],A1); ++i;} ELSE_ASSIGN_ARG_1;
if (i < nrhs && is_input_type<arg2_type>::value) {validate_and_populate_arg(i,prhs[i],A2); ++i;} ELSE_ASSIGN_ARG_2;
if (i < nrhs && is_input_type<arg3_type>::value) {validate_and_populate_arg(i,prhs[i],A3); ++i;} ELSE_ASSIGN_ARG_3;
if (i < nrhs && is_input_type<arg4_type>::value) {validate_and_populate_arg(i,prhs[i],A4); ++i;} ELSE_ASSIGN_ARG_4;
if (i < nrhs && is_input_type<arg5_type>::value) {validate_and_populate_arg(i,prhs[i],A5); ++i;} ELSE_ASSIGN_ARG_5;
if (i < nrhs && is_input_type<arg6_type>::value) {validate_and_populate_arg(i,prhs[i],A6); ++i;} ELSE_ASSIGN_ARG_6;
if (i < nrhs && is_input_type<arg7_type>::value) {validate_and_populate_arg(i,prhs[i],A7); ++i;} ELSE_ASSIGN_ARG_7;
if (i < nrhs && is_input_type<arg8_type>::value) {validate_and_populate_arg(i,prhs[i],A8); ++i;} ELSE_ASSIGN_ARG_8;
if (i < nrhs && is_input_type<arg9_type>::value) {validate_and_populate_arg(i,prhs[i],A9); ++i;} ELSE_ASSIGN_ARG_9;
if (i < nrhs && is_input_type<arg10_type>::value) {validate_and_populate_arg(i,prhs[i],A10); ++i;} ELSE_ASSIGN_ARG_10;
if (i < nrhs && is_input_type<arg11_type>::value) {validate_and_populate_arg(i,prhs[i],A11); ++i;} ELSE_ASSIGN_ARG_11;
if (i < nrhs && is_input_type<arg12_type>::value) {validate_and_populate_arg(i,prhs[i],A12); ++i;} ELSE_ASSIGN_ARG_12;
if (i < nrhs && is_input_type<arg13_type>::value) {validate_and_populate_arg(i,prhs[i],A13); ++i;} ELSE_ASSIGN_ARG_13;
mex_function(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13);
i = 0;
if (is_output_type<arg1_type>::value) {assign_to_matlab(plhs[i],A1); ++i;}
if (is_output_type<arg2_type>::value) {assign_to_matlab(plhs[i],A2); ++i;}
if (is_output_type<arg3_type>::value) {assign_to_matlab(plhs[i],A3); ++i;}
if (is_output_type<arg4_type>::value) {assign_to_matlab(plhs[i],A4); ++i;}
if (is_output_type<arg5_type>::value) {assign_to_matlab(plhs[i],A5); ++i;}
if (is_output_type<arg6_type>::value) {assign_to_matlab(plhs[i],A6); ++i;}
if (is_output_type<arg7_type>::value) {assign_to_matlab(plhs[i],A7); ++i;}
if (is_output_type<arg8_type>::value) {assign_to_matlab(plhs[i],A8); ++i;}
if (is_output_type<arg9_type>::value) {assign_to_matlab(plhs[i],A9); ++i;}
if (is_output_type<arg10_type>::value) {assign_to_matlab(plhs[i],A10); ++i;}
if (is_output_type<arg11_type>::value) {assign_to_matlab(plhs[i],A11); ++i;}
if (is_output_type<arg12_type>::value) {assign_to_matlab(plhs[i],A12); ++i;}
if (is_output_type<arg13_type>::value) {assign_to_matlab(plhs[i],A13); ++i;}
}
};
template <>
struct call_mex_function_helper<14>
{
template <typename funct>
void callit(
const funct& ,
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]
) const
{
typedef typename sig_traits<funct>::arg1_type arg1_type;
typedef typename sig_traits<funct>::arg2_type arg2_type;
typedef typename sig_traits<funct>::arg3_type arg3_type;
typedef typename sig_traits<funct>::arg4_type arg4_type;
typedef typename sig_traits<funct>::arg5_type arg5_type;
typedef typename sig_traits<funct>::arg6_type arg6_type;
typedef typename sig_traits<funct>::arg7_type arg7_type;
typedef typename sig_traits<funct>::arg8_type arg8_type;
typedef typename sig_traits<funct>::arg9_type arg9_type;
typedef typename sig_traits<funct>::arg10_type arg10_type;
typedef typename sig_traits<funct>::arg11_type arg11_type;
typedef typename sig_traits<funct>::arg12_type arg12_type;
typedef typename sig_traits<funct>::arg13_type arg13_type;
typedef typename sig_traits<funct>::arg14_type arg14_type;
public:
mex_streambuf
(
)
typename basic_type<arg1_type>::type A1;
typename basic_type<arg2_type>::type A2;
typename basic_type<arg3_type>::type A3;
typename basic_type<arg4_type>::type A4;
typename basic_type<arg5_type>::type A5;
typename basic_type<arg6_type>::type A6;
typename basic_type<arg7_type>::type A7;
typename basic_type<arg8_type>::type A8;
typename basic_type<arg9_type>::type A9;
typename basic_type<arg10_type>::type A10;
typename basic_type<arg11_type>::type A11;
typename basic_type<arg12_type>::type A12;
typename basic_type<arg13_type>::type A13;
typename basic_type<arg14_type>::type A14;
mark_non_persistent(A1);
mark_non_persistent(A2);
mark_non_persistent(A3);
mark_non_persistent(A4);
mark_non_persistent(A5);
mark_non_persistent(A6);
mark_non_persistent(A7);
mark_non_persistent(A8);
mark_non_persistent(A9);
mark_non_persistent(A10);
mark_non_persistent(A11);
mark_non_persistent(A12);
mark_non_persistent(A13);
mark_non_persistent(A14);
int i = 0;
if (i < nrhs && is_input_type<arg1_type>::value) {validate_and_populate_arg(i,prhs[i],A1); ++i;} ELSE_ASSIGN_ARG_1;
if (i < nrhs && is_input_type<arg2_type>::value) {validate_and_populate_arg(i,prhs[i],A2); ++i;} ELSE_ASSIGN_ARG_2;
if (i < nrhs && is_input_type<arg3_type>::value) {validate_and_populate_arg(i,prhs[i],A3); ++i;} ELSE_ASSIGN_ARG_3;
if (i < nrhs && is_input_type<arg4_type>::value) {validate_and_populate_arg(i,prhs[i],A4); ++i;} ELSE_ASSIGN_ARG_4;
if (i < nrhs && is_input_type<arg5_type>::value) {validate_and_populate_arg(i,prhs[i],A5); ++i;} ELSE_ASSIGN_ARG_5;
if (i < nrhs && is_input_type<arg6_type>::value) {validate_and_populate_arg(i,prhs[i],A6); ++i;} ELSE_ASSIGN_ARG_6;
if (i < nrhs && is_input_type<arg7_type>::value) {validate_and_populate_arg(i,prhs[i],A7); ++i;} ELSE_ASSIGN_ARG_7;
if (i < nrhs && is_input_type<arg8_type>::value) {validate_and_populate_arg(i,prhs[i],A8); ++i;} ELSE_ASSIGN_ARG_8;
if (i < nrhs && is_input_type<arg9_type>::value) {validate_and_populate_arg(i,prhs[i],A9); ++i;} ELSE_ASSIGN_ARG_9;
if (i < nrhs && is_input_type<arg10_type>::value) {validate_and_populate_arg(i,prhs[i],A10); ++i;} ELSE_ASSIGN_ARG_10;
if (i < nrhs && is_input_type<arg11_type>::value) {validate_and_populate_arg(i,prhs[i],A11); ++i;} ELSE_ASSIGN_ARG_11;
if (i < nrhs && is_input_type<arg12_type>::value) {validate_and_populate_arg(i,prhs[i],A12); ++i;} ELSE_ASSIGN_ARG_12;
if (i < nrhs && is_input_type<arg13_type>::value) {validate_and_populate_arg(i,prhs[i],A13); ++i;} ELSE_ASSIGN_ARG_13;
if (i < nrhs && is_input_type<arg14_type>::value) {validate_and_populate_arg(i,prhs[i],A14); ++i;} ELSE_ASSIGN_ARG_14;
mex_function(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14);
i = 0;
if (is_output_type<arg1_type>::value) {assign_to_matlab(plhs[i],A1); ++i;}
if (is_output_type<arg2_type>::value) {assign_to_matlab(plhs[i],A2); ++i;}
if (is_output_type<arg3_type>::value) {assign_to_matlab(plhs[i],A3); ++i;}
if (is_output_type<arg4_type>::value) {assign_to_matlab(plhs[i],A4); ++i;}
if (is_output_type<arg5_type>::value) {assign_to_matlab(plhs[i],A5); ++i;}
if (is_output_type<arg6_type>::value) {assign_to_matlab(plhs[i],A6); ++i;}
if (is_output_type<arg7_type>::value) {assign_to_matlab(plhs[i],A7); ++i;}
if (is_output_type<arg8_type>::value) {assign_to_matlab(plhs[i],A8); ++i;}
if (is_output_type<arg9_type>::value) {assign_to_matlab(plhs[i],A9); ++i;}
if (is_output_type<arg10_type>::value) {assign_to_matlab(plhs[i],A10); ++i;}
if (is_output_type<arg11_type>::value) {assign_to_matlab(plhs[i],A11); ++i;}
if (is_output_type<arg12_type>::value) {assign_to_matlab(plhs[i],A12); ++i;}
if (is_output_type<arg13_type>::value) {assign_to_matlab(plhs[i],A13); ++i;}
if (is_output_type<arg14_type>::value) {assign_to_matlab(plhs[i],A14); ++i;}
}
};
template <>
struct call_mex_function_helper<15>
{
template <typename funct>
void callit(
const funct& ,
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]
) const
{
buf
.
resize
(
1000
);
setp
(
&
buf
[
0
],
&
buf
[
0
]
+
buf
.
size
()
-
2
);
typedef typename sig_traits<funct>::arg1_type arg1_type;
typedef typename sig_traits<funct>::arg2_type arg2_type;
typedef typename sig_traits<funct>::arg3_type arg3_type;
typedef typename sig_traits<funct>::arg4_type arg4_type;
typedef typename sig_traits<funct>::arg5_type arg5_type;
typedef typename sig_traits<funct>::arg6_type arg6_type;
typedef typename sig_traits<funct>::arg7_type arg7_type;
typedef typename sig_traits<funct>::arg8_type arg8_type;
typedef typename sig_traits<funct>::arg9_type arg9_type;
typedef typename sig_traits<funct>::arg10_type arg10_type;
typedef typename sig_traits<funct>::arg11_type arg11_type;
typedef typename sig_traits<funct>::arg12_type arg12_type;
typedef typename sig_traits<funct>::arg13_type arg13_type;
typedef typename sig_traits<funct>::arg14_type arg14_type;
typedef typename sig_traits<funct>::arg15_type arg15_type;
// make cout send data to mex_streambuf
std
::
cout
.
rdbuf
(
this
);
typename basic_type<arg1_type>::type A1;
typename basic_type<arg2_type>::type A2;
typename basic_type<arg3_type>::type A3;
typename basic_type<arg4_type>::type A4;
typename basic_type<arg5_type>::type A5;
typename basic_type<arg6_type>::type A6;
typename basic_type<arg7_type>::type A7;
typename basic_type<arg8_type>::type A8;
typename basic_type<arg9_type>::type A9;
typename basic_type<arg10_type>::type A10;
typename basic_type<arg11_type>::type A11;
typename basic_type<arg12_type>::type A12;
typename basic_type<arg13_type>::type A13;
typename basic_type<arg14_type>::type A14;
typename basic_type<arg15_type>::type A15;
mark_non_persistent(A1);
mark_non_persistent(A2);
mark_non_persistent(A3);
mark_non_persistent(A4);
mark_non_persistent(A5);
mark_non_persistent(A6);
mark_non_persistent(A7);
mark_non_persistent(A8);
mark_non_persistent(A9);
mark_non_persistent(A10);
mark_non_persistent(A11);
mark_non_persistent(A12);
mark_non_persistent(A13);
mark_non_persistent(A14);
mark_non_persistent(A15);
int i = 0;
if (i < nrhs && is_input_type<arg1_type>::value) {validate_and_populate_arg(i,prhs[i],A1); ++i;} ELSE_ASSIGN_ARG_1;
if (i < nrhs && is_input_type<arg2_type>::value) {validate_and_populate_arg(i,prhs[i],A2); ++i;} ELSE_ASSIGN_ARG_2;
if (i < nrhs && is_input_type<arg3_type>::value) {validate_and_populate_arg(i,prhs[i],A3); ++i;} ELSE_ASSIGN_ARG_3;
if (i < nrhs && is_input_type<arg4_type>::value) {validate_and_populate_arg(i,prhs[i],A4); ++i;} ELSE_ASSIGN_ARG_4;
if (i < nrhs && is_input_type<arg5_type>::value) {validate_and_populate_arg(i,prhs[i],A5); ++i;} ELSE_ASSIGN_ARG_5;
if (i < nrhs && is_input_type<arg6_type>::value) {validate_and_populate_arg(i,prhs[i],A6); ++i;} ELSE_ASSIGN_ARG_6;
if (i < nrhs && is_input_type<arg7_type>::value) {validate_and_populate_arg(i,prhs[i],A7); ++i;} ELSE_ASSIGN_ARG_7;
if (i < nrhs && is_input_type<arg8_type>::value) {validate_and_populate_arg(i,prhs[i],A8); ++i;} ELSE_ASSIGN_ARG_8;
if (i < nrhs && is_input_type<arg9_type>::value) {validate_and_populate_arg(i,prhs[i],A9); ++i;} ELSE_ASSIGN_ARG_9;
if (i < nrhs && is_input_type<arg10_type>::value) {validate_and_populate_arg(i,prhs[i],A10); ++i;} ELSE_ASSIGN_ARG_10;
if (i < nrhs && is_input_type<arg11_type>::value) {validate_and_populate_arg(i,prhs[i],A11); ++i;} ELSE_ASSIGN_ARG_11;
if (i < nrhs && is_input_type<arg12_type>::value) {validate_and_populate_arg(i,prhs[i],A12); ++i;} ELSE_ASSIGN_ARG_12;
if (i < nrhs && is_input_type<arg13_type>::value) {validate_and_populate_arg(i,prhs[i],A13); ++i;} ELSE_ASSIGN_ARG_13;
if (i < nrhs && is_input_type<arg14_type>::value) {validate_and_populate_arg(i,prhs[i],A14); ++i;} ELSE_ASSIGN_ARG_14;
if (i < nrhs && is_input_type<arg15_type>::value) {validate_and_populate_arg(i,prhs[i],A15); ++i;} ELSE_ASSIGN_ARG_15;
mex_function(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15);
i = 0;
if (is_output_type<arg1_type>::value) {assign_to_matlab(plhs[i],A1); ++i;}
if (is_output_type<arg2_type>::value) {assign_to_matlab(plhs[i],A2); ++i;}
if (is_output_type<arg3_type>::value) {assign_to_matlab(plhs[i],A3); ++i;}
if (is_output_type<arg4_type>::value) {assign_to_matlab(plhs[i],A4); ++i;}
if (is_output_type<arg5_type>::value) {assign_to_matlab(plhs[i],A5); ++i;}
if (is_output_type<arg6_type>::value) {assign_to_matlab(plhs[i],A6); ++i;}
if (is_output_type<arg7_type>::value) {assign_to_matlab(plhs[i],A7); ++i;}
if (is_output_type<arg8_type>::value) {assign_to_matlab(plhs[i],A8); ++i;}
if (is_output_type<arg9_type>::value) {assign_to_matlab(plhs[i],A9); ++i;}
if (is_output_type<arg10_type>::value) {assign_to_matlab(plhs[i],A10); ++i;}
if (is_output_type<arg11_type>::value) {assign_to_matlab(plhs[i],A11); ++i;}
if (is_output_type<arg12_type>::value) {assign_to_matlab(plhs[i],A12); ++i;}
if (is_output_type<arg13_type>::value) {assign_to_matlab(plhs[i],A13); ++i;}
if (is_output_type<arg14_type>::value) {assign_to_matlab(plhs[i],A14); ++i;}
if (is_output_type<arg15_type>::value) {assign_to_matlab(plhs[i],A15); ++i;}
}
};
template <>
struct call_mex_function_helper<16>
{
template <typename funct>
void callit(
const funct& ,
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]
) const
{
typedef typename sig_traits<funct>::arg1_type arg1_type;
typedef typename sig_traits<funct>::arg2_type arg2_type;
typedef typename sig_traits<funct>::arg3_type arg3_type;
typedef typename sig_traits<funct>::arg4_type arg4_type;
typedef typename sig_traits<funct>::arg5_type arg5_type;
typedef typename sig_traits<funct>::arg6_type arg6_type;
typedef typename sig_traits<funct>::arg7_type arg7_type;
typedef typename sig_traits<funct>::arg8_type arg8_type;
typedef typename sig_traits<funct>::arg9_type arg9_type;
typedef typename sig_traits<funct>::arg10_type arg10_type;
typedef typename sig_traits<funct>::arg11_type arg11_type;
typedef typename sig_traits<funct>::arg12_type arg12_type;
typedef typename sig_traits<funct>::arg13_type arg13_type;
typedef typename sig_traits<funct>::arg14_type arg14_type;
typedef typename sig_traits<funct>::arg15_type arg15_type;
typedef typename sig_traits<funct>::arg16_type arg16_type;
typename basic_type<arg1_type>::type A1;
typename basic_type<arg2_type>::type A2;
typename basic_type<arg3_type>::type A3;
typename basic_type<arg4_type>::type A4;
typename basic_type<arg5_type>::type A5;
typename basic_type<arg6_type>::type A6;
typename basic_type<arg7_type>::type A7;
typename basic_type<arg8_type>::type A8;
typename basic_type<arg9_type>::type A9;
typename basic_type<arg10_type>::type A10;
typename basic_type<arg11_type>::type A11;
typename basic_type<arg12_type>::type A12;
typename basic_type<arg13_type>::type A13;
typename basic_type<arg14_type>::type A14;
typename basic_type<arg15_type>::type A15;
typename basic_type<arg16_type>::type A16;
mark_non_persistent(A1);
mark_non_persistent(A2);
mark_non_persistent(A3);
mark_non_persistent(A4);
mark_non_persistent(A5);
mark_non_persistent(A6);
mark_non_persistent(A7);
mark_non_persistent(A8);
mark_non_persistent(A9);
mark_non_persistent(A10);
mark_non_persistent(A11);
mark_non_persistent(A12);
mark_non_persistent(A13);
mark_non_persistent(A14);
mark_non_persistent(A15);
mark_non_persistent(A16);
int i = 0;
if (i < nrhs && is_input_type<arg1_type>::value) {validate_and_populate_arg(i,prhs[i],A1); ++i;} ELSE_ASSIGN_ARG_1;
if (i < nrhs && is_input_type<arg2_type>::value) {validate_and_populate_arg(i,prhs[i],A2); ++i;} ELSE_ASSIGN_ARG_2;
if (i < nrhs && is_input_type<arg3_type>::value) {validate_and_populate_arg(i,prhs[i],A3); ++i;} ELSE_ASSIGN_ARG_3;
if (i < nrhs && is_input_type<arg4_type>::value) {validate_and_populate_arg(i,prhs[i],A4); ++i;} ELSE_ASSIGN_ARG_4;
if (i < nrhs && is_input_type<arg5_type>::value) {validate_and_populate_arg(i,prhs[i],A5); ++i;} ELSE_ASSIGN_ARG_5;
if (i < nrhs && is_input_type<arg6_type>::value) {validate_and_populate_arg(i,prhs[i],A6); ++i;} ELSE_ASSIGN_ARG_6;
if (i < nrhs && is_input_type<arg7_type>::value) {validate_and_populate_arg(i,prhs[i],A7); ++i;} ELSE_ASSIGN_ARG_7;
if (i < nrhs && is_input_type<arg8_type>::value) {validate_and_populate_arg(i,prhs[i],A8); ++i;} ELSE_ASSIGN_ARG_8;
if (i < nrhs && is_input_type<arg9_type>::value) {validate_and_populate_arg(i,prhs[i],A9); ++i;} ELSE_ASSIGN_ARG_9;
if (i < nrhs && is_input_type<arg10_type>::value) {validate_and_populate_arg(i,prhs[i],A10); ++i;} ELSE_ASSIGN_ARG_10;
if (i < nrhs && is_input_type<arg11_type>::value) {validate_and_populate_arg(i,prhs[i],A11); ++i;} ELSE_ASSIGN_ARG_11;
if (i < nrhs && is_input_type<arg12_type>::value) {validate_and_populate_arg(i,prhs[i],A12); ++i;} ELSE_ASSIGN_ARG_12;
if (i < nrhs && is_input_type<arg13_type>::value) {validate_and_populate_arg(i,prhs[i],A13); ++i;} ELSE_ASSIGN_ARG_13;
if (i < nrhs && is_input_type<arg14_type>::value) {validate_and_populate_arg(i,prhs[i],A14); ++i;} ELSE_ASSIGN_ARG_14;
if (i < nrhs && is_input_type<arg15_type>::value) {validate_and_populate_arg(i,prhs[i],A15); ++i;} ELSE_ASSIGN_ARG_15;
if (i < nrhs && is_input_type<arg16_type>::value) {validate_and_populate_arg(i,prhs[i],A16); ++i;} ELSE_ASSIGN_ARG_16;
mex_function(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16);
i = 0;
if (is_output_type<arg1_type>::value) {assign_to_matlab(plhs[i],A1); ++i;}
if (is_output_type<arg2_type>::value) {assign_to_matlab(plhs[i],A2); ++i;}
if (is_output_type<arg3_type>::value) {assign_to_matlab(plhs[i],A3); ++i;}
if (is_output_type<arg4_type>::value) {assign_to_matlab(plhs[i],A4); ++i;}
if (is_output_type<arg5_type>::value) {assign_to_matlab(plhs[i],A5); ++i;}
if (is_output_type<arg6_type>::value) {assign_to_matlab(plhs[i],A6); ++i;}
if (is_output_type<arg7_type>::value) {assign_to_matlab(plhs[i],A7); ++i;}
if (is_output_type<arg8_type>::value) {assign_to_matlab(plhs[i],A8); ++i;}
if (is_output_type<arg9_type>::value) {assign_to_matlab(plhs[i],A9); ++i;}
if (is_output_type<arg10_type>::value) {assign_to_matlab(plhs[i],A10); ++i;}
if (is_output_type<arg11_type>::value) {assign_to_matlab(plhs[i],A11); ++i;}
if (is_output_type<arg12_type>::value) {assign_to_matlab(plhs[i],A12); ++i;}
if (is_output_type<arg13_type>::value) {assign_to_matlab(plhs[i],A13); ++i;}
if (is_output_type<arg14_type>::value) {assign_to_matlab(plhs[i],A14); ++i;}
if (is_output_type<arg15_type>::value) {assign_to_matlab(plhs[i],A15); ++i;}
if (is_output_type<arg16_type>::value) {assign_to_matlab(plhs[i],A16); ++i;}
}
};
template <>
struct call_mex_function_helper<17>
{
template <typename funct>
void callit(
const funct& ,
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]
) const
{
typedef typename sig_traits<funct>::arg1_type arg1_type;
typedef typename sig_traits<funct>::arg2_type arg2_type;
typedef typename sig_traits<funct>::arg3_type arg3_type;
typedef typename sig_traits<funct>::arg4_type arg4_type;
typedef typename sig_traits<funct>::arg5_type arg5_type;
typedef typename sig_traits<funct>::arg6_type arg6_type;
typedef typename sig_traits<funct>::arg7_type arg7_type;
typedef typename sig_traits<funct>::arg8_type arg8_type;
typedef typename sig_traits<funct>::arg9_type arg9_type;
typedef typename sig_traits<funct>::arg10_type arg10_type;
typedef typename sig_traits<funct>::arg11_type arg11_type;
typedef typename sig_traits<funct>::arg12_type arg12_type;
typedef typename sig_traits<funct>::arg13_type arg13_type;
typedef typename sig_traits<funct>::arg14_type arg14_type;
typedef typename sig_traits<funct>::arg15_type arg15_type;
typedef typename sig_traits<funct>::arg16_type arg16_type;
typedef typename sig_traits<funct>::arg17_type arg17_type;
typename basic_type<arg1_type>::type A1;
typename basic_type<arg2_type>::type A2;
typename basic_type<arg3_type>::type A3;
typename basic_type<arg4_type>::type A4;
typename basic_type<arg5_type>::type A5;
typename basic_type<arg6_type>::type A6;
typename basic_type<arg7_type>::type A7;
typename basic_type<arg8_type>::type A8;
typename basic_type<arg9_type>::type A9;
typename basic_type<arg10_type>::type A10;
typename basic_type<arg11_type>::type A11;
typename basic_type<arg12_type>::type A12;
typename basic_type<arg13_type>::type A13;
typename basic_type<arg14_type>::type A14;
typename basic_type<arg15_type>::type A15;
typename basic_type<arg16_type>::type A16;
typename basic_type<arg17_type>::type A17;
mark_non_persistent(A1);
mark_non_persistent(A2);
mark_non_persistent(A3);
mark_non_persistent(A4);
mark_non_persistent(A5);
mark_non_persistent(A6);
mark_non_persistent(A7);
mark_non_persistent(A8);
mark_non_persistent(A9);
mark_non_persistent(A10);
mark_non_persistent(A11);
mark_non_persistent(A12);
mark_non_persistent(A13);
mark_non_persistent(A14);
mark_non_persistent(A15);
mark_non_persistent(A16);
mark_non_persistent(A17);
int i = 0;
if (i < nrhs && is_input_type<arg1_type>::value) {validate_and_populate_arg(i,prhs[i],A1); ++i;} ELSE_ASSIGN_ARG_1;
if (i < nrhs && is_input_type<arg2_type>::value) {validate_and_populate_arg(i,prhs[i],A2); ++i;} ELSE_ASSIGN_ARG_2;
if (i < nrhs && is_input_type<arg3_type>::value) {validate_and_populate_arg(i,prhs[i],A3); ++i;} ELSE_ASSIGN_ARG_3;
if (i < nrhs && is_input_type<arg4_type>::value) {validate_and_populate_arg(i,prhs[i],A4); ++i;} ELSE_ASSIGN_ARG_4;
if (i < nrhs && is_input_type<arg5_type>::value) {validate_and_populate_arg(i,prhs[i],A5); ++i;} ELSE_ASSIGN_ARG_5;
if (i < nrhs && is_input_type<arg6_type>::value) {validate_and_populate_arg(i,prhs[i],A6); ++i;} ELSE_ASSIGN_ARG_6;
if (i < nrhs && is_input_type<arg7_type>::value) {validate_and_populate_arg(i,prhs[i],A7); ++i;} ELSE_ASSIGN_ARG_7;
if (i < nrhs && is_input_type<arg8_type>::value) {validate_and_populate_arg(i,prhs[i],A8); ++i;} ELSE_ASSIGN_ARG_8;
if (i < nrhs && is_input_type<arg9_type>::value) {validate_and_populate_arg(i,prhs[i],A9); ++i;} ELSE_ASSIGN_ARG_9;
if (i < nrhs && is_input_type<arg10_type>::value) {validate_and_populate_arg(i,prhs[i],A10); ++i;} ELSE_ASSIGN_ARG_10;
if (i < nrhs && is_input_type<arg11_type>::value) {validate_and_populate_arg(i,prhs[i],A11); ++i;} ELSE_ASSIGN_ARG_11;
if (i < nrhs && is_input_type<arg12_type>::value) {validate_and_populate_arg(i,prhs[i],A12); ++i;} ELSE_ASSIGN_ARG_12;
if (i < nrhs && is_input_type<arg13_type>::value) {validate_and_populate_arg(i,prhs[i],A13); ++i;} ELSE_ASSIGN_ARG_13;
if (i < nrhs && is_input_type<arg14_type>::value) {validate_and_populate_arg(i,prhs[i],A14); ++i;} ELSE_ASSIGN_ARG_14;
if (i < nrhs && is_input_type<arg15_type>::value) {validate_and_populate_arg(i,prhs[i],A15); ++i;} ELSE_ASSIGN_ARG_15;
if (i < nrhs && is_input_type<arg16_type>::value) {validate_and_populate_arg(i,prhs[i],A16); ++i;} ELSE_ASSIGN_ARG_16;
if (i < nrhs && is_input_type<arg17_type>::value) {validate_and_populate_arg(i,prhs[i],A17); ++i;} ELSE_ASSIGN_ARG_17;
mex_function(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17);
i = 0;
if (is_output_type<arg1_type>::value) {assign_to_matlab(plhs[i],A1); ++i;}
if (is_output_type<arg2_type>::value) {assign_to_matlab(plhs[i],A2); ++i;}
if (is_output_type<arg3_type>::value) {assign_to_matlab(plhs[i],A3); ++i;}
if (is_output_type<arg4_type>::value) {assign_to_matlab(plhs[i],A4); ++i;}
if (is_output_type<arg5_type>::value) {assign_to_matlab(plhs[i],A5); ++i;}
if (is_output_type<arg6_type>::value) {assign_to_matlab(plhs[i],A6); ++i;}
if (is_output_type<arg7_type>::value) {assign_to_matlab(plhs[i],A7); ++i;}
if (is_output_type<arg8_type>::value) {assign_to_matlab(plhs[i],A8); ++i;}
if (is_output_type<arg9_type>::value) {assign_to_matlab(plhs[i],A9); ++i;}
if (is_output_type<arg10_type>::value) {assign_to_matlab(plhs[i],A10); ++i;}
if (is_output_type<arg11_type>::value) {assign_to_matlab(plhs[i],A11); ++i;}
if (is_output_type<arg12_type>::value) {assign_to_matlab(plhs[i],A12); ++i;}
if (is_output_type<arg13_type>::value) {assign_to_matlab(plhs[i],A13); ++i;}
if (is_output_type<arg14_type>::value) {assign_to_matlab(plhs[i],A14); ++i;}
if (is_output_type<arg15_type>::value) {assign_to_matlab(plhs[i],A15); ++i;}
if (is_output_type<arg16_type>::value) {assign_to_matlab(plhs[i],A16); ++i;}
if (is_output_type<arg17_type>::value) {assign_to_matlab(plhs[i],A17); ++i;}
}
};
template <>
struct call_mex_function_helper<18>
{
template <typename funct>
void callit(
const funct& ,
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]
) const
{
typedef typename sig_traits<funct>::arg1_type arg1_type;
typedef typename sig_traits<funct>::arg2_type arg2_type;
typedef typename sig_traits<funct>::arg3_type arg3_type;
typedef typename sig_traits<funct>::arg4_type arg4_type;
typedef typename sig_traits<funct>::arg5_type arg5_type;
typedef typename sig_traits<funct>::arg6_type arg6_type;
typedef typename sig_traits<funct>::arg7_type arg7_type;
typedef typename sig_traits<funct>::arg8_type arg8_type;
typedef typename sig_traits<funct>::arg9_type arg9_type;
typedef typename sig_traits<funct>::arg10_type arg10_type;
typedef typename sig_traits<funct>::arg11_type arg11_type;
typedef typename sig_traits<funct>::arg12_type arg12_type;
typedef typename sig_traits<funct>::arg13_type arg13_type;
typedef typename sig_traits<funct>::arg14_type arg14_type;
typedef typename sig_traits<funct>::arg15_type arg15_type;
typedef typename sig_traits<funct>::arg16_type arg16_type;
typedef typename sig_traits<funct>::arg17_type arg17_type;
typedef typename sig_traits<funct>::arg18_type arg18_type;
typename basic_type<arg1_type>::type A1;
typename basic_type<arg2_type>::type A2;
typename basic_type<arg3_type>::type A3;
typename basic_type<arg4_type>::type A4;
typename basic_type<arg5_type>::type A5;
typename basic_type<arg6_type>::type A6;
typename basic_type<arg7_type>::type A7;
typename basic_type<arg8_type>::type A8;
typename basic_type<arg9_type>::type A9;
typename basic_type<arg10_type>::type A10;
typename basic_type<arg11_type>::type A11;
typename basic_type<arg12_type>::type A12;
typename basic_type<arg13_type>::type A13;
typename basic_type<arg14_type>::type A14;
typename basic_type<arg15_type>::type A15;
typename basic_type<arg16_type>::type A16;
typename basic_type<arg17_type>::type A17;
typename basic_type<arg18_type>::type A18;
mark_non_persistent(A1);
mark_non_persistent(A2);
mark_non_persistent(A3);
mark_non_persistent(A4);
mark_non_persistent(A5);
mark_non_persistent(A6);
mark_non_persistent(A7);
mark_non_persistent(A8);
mark_non_persistent(A9);
mark_non_persistent(A10);
mark_non_persistent(A11);
mark_non_persistent(A12);
mark_non_persistent(A13);
mark_non_persistent(A14);
mark_non_persistent(A15);
mark_non_persistent(A16);
mark_non_persistent(A17);
mark_non_persistent(A18);
int i = 0;
if (i < nrhs && is_input_type<arg1_type>::value) {validate_and_populate_arg(i,prhs[i],A1); ++i;} ELSE_ASSIGN_ARG_1;
if (i < nrhs && is_input_type<arg2_type>::value) {validate_and_populate_arg(i,prhs[i],A2); ++i;} ELSE_ASSIGN_ARG_2;
if (i < nrhs && is_input_type<arg3_type>::value) {validate_and_populate_arg(i,prhs[i],A3); ++i;} ELSE_ASSIGN_ARG_3;
if (i < nrhs && is_input_type<arg4_type>::value) {validate_and_populate_arg(i,prhs[i],A4); ++i;} ELSE_ASSIGN_ARG_4;
if (i < nrhs && is_input_type<arg5_type>::value) {validate_and_populate_arg(i,prhs[i],A5); ++i;} ELSE_ASSIGN_ARG_5;
if (i < nrhs && is_input_type<arg6_type>::value) {validate_and_populate_arg(i,prhs[i],A6); ++i;} ELSE_ASSIGN_ARG_6;
if (i < nrhs && is_input_type<arg7_type>::value) {validate_and_populate_arg(i,prhs[i],A7); ++i;} ELSE_ASSIGN_ARG_7;
if (i < nrhs && is_input_type<arg8_type>::value) {validate_and_populate_arg(i,prhs[i],A8); ++i;} ELSE_ASSIGN_ARG_8;
if (i < nrhs && is_input_type<arg9_type>::value) {validate_and_populate_arg(i,prhs[i],A9); ++i;} ELSE_ASSIGN_ARG_9;
if (i < nrhs && is_input_type<arg10_type>::value) {validate_and_populate_arg(i,prhs[i],A10); ++i;} ELSE_ASSIGN_ARG_10;
if (i < nrhs && is_input_type<arg11_type>::value) {validate_and_populate_arg(i,prhs[i],A11); ++i;} ELSE_ASSIGN_ARG_11;
if (i < nrhs && is_input_type<arg12_type>::value) {validate_and_populate_arg(i,prhs[i],A12); ++i;} ELSE_ASSIGN_ARG_12;
if (i < nrhs && is_input_type<arg13_type>::value) {validate_and_populate_arg(i,prhs[i],A13); ++i;} ELSE_ASSIGN_ARG_13;
if (i < nrhs && is_input_type<arg14_type>::value) {validate_and_populate_arg(i,prhs[i],A14); ++i;} ELSE_ASSIGN_ARG_14;
if (i < nrhs && is_input_type<arg15_type>::value) {validate_and_populate_arg(i,prhs[i],A15); ++i;} ELSE_ASSIGN_ARG_15;
if (i < nrhs && is_input_type<arg16_type>::value) {validate_and_populate_arg(i,prhs[i],A16); ++i;} ELSE_ASSIGN_ARG_16;
if (i < nrhs && is_input_type<arg17_type>::value) {validate_and_populate_arg(i,prhs[i],A17); ++i;} ELSE_ASSIGN_ARG_17;
if (i < nrhs && is_input_type<arg18_type>::value) {validate_and_populate_arg(i,prhs[i],A18); ++i;} ELSE_ASSIGN_ARG_18;
mex_function(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18);
i = 0;
if (is_output_type<arg1_type>::value) {assign_to_matlab(plhs[i],A1); ++i;}
if (is_output_type<arg2_type>::value) {assign_to_matlab(plhs[i],A2); ++i;}
if (is_output_type<arg3_type>::value) {assign_to_matlab(plhs[i],A3); ++i;}
if (is_output_type<arg4_type>::value) {assign_to_matlab(plhs[i],A4); ++i;}
if (is_output_type<arg5_type>::value) {assign_to_matlab(plhs[i],A5); ++i;}
if (is_output_type<arg6_type>::value) {assign_to_matlab(plhs[i],A6); ++i;}
if (is_output_type<arg7_type>::value) {assign_to_matlab(plhs[i],A7); ++i;}
if (is_output_type<arg8_type>::value) {assign_to_matlab(plhs[i],A8); ++i;}
if (is_output_type<arg9_type>::value) {assign_to_matlab(plhs[i],A9); ++i;}
if (is_output_type<arg10_type>::value) {assign_to_matlab(plhs[i],A10); ++i;}
if (is_output_type<arg11_type>::value) {assign_to_matlab(plhs[i],A11); ++i;}
if (is_output_type<arg12_type>::value) {assign_to_matlab(plhs[i],A12); ++i;}
if (is_output_type<arg13_type>::value) {assign_to_matlab(plhs[i],A13); ++i;}
if (is_output_type<arg14_type>::value) {assign_to_matlab(plhs[i],A14); ++i;}
if (is_output_type<arg15_type>::value) {assign_to_matlab(plhs[i],A15); ++i;}
if (is_output_type<arg16_type>::value) {assign_to_matlab(plhs[i],A16); ++i;}
if (is_output_type<arg17_type>::value) {assign_to_matlab(plhs[i],A17); ++i;}
if (is_output_type<arg18_type>::value) {assign_to_matlab(plhs[i],A18); ++i;}
}
};
template <>
struct call_mex_function_helper<19>
{
template <typename funct>
void callit(
const funct& ,
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]
) const
{
typedef typename sig_traits<funct>::arg1_type arg1_type;
typedef typename sig_traits<funct>::arg2_type arg2_type;
typedef typename sig_traits<funct>::arg3_type arg3_type;
typedef typename sig_traits<funct>::arg4_type arg4_type;
typedef typename sig_traits<funct>::arg5_type arg5_type;
typedef typename sig_traits<funct>::arg6_type arg6_type;
typedef typename sig_traits<funct>::arg7_type arg7_type;
typedef typename sig_traits<funct>::arg8_type arg8_type;
typedef typename sig_traits<funct>::arg9_type arg9_type;
typedef typename sig_traits<funct>::arg10_type arg10_type;
typedef typename sig_traits<funct>::arg11_type arg11_type;
typedef typename sig_traits<funct>::arg12_type arg12_type;
typedef typename sig_traits<funct>::arg13_type arg13_type;
typedef typename sig_traits<funct>::arg14_type arg14_type;
typedef typename sig_traits<funct>::arg15_type arg15_type;
typedef typename sig_traits<funct>::arg16_type arg16_type;
typedef typename sig_traits<funct>::arg17_type arg17_type;
typedef typename sig_traits<funct>::arg18_type arg18_type;
typedef typename sig_traits<funct>::arg19_type arg19_type;
typename basic_type<arg1_type>::type A1;
typename basic_type<arg2_type>::type A2;
typename basic_type<arg3_type>::type A3;
typename basic_type<arg4_type>::type A4;
typename basic_type<arg5_type>::type A5;
typename basic_type<arg6_type>::type A6;
typename basic_type<arg7_type>::type A7;
typename basic_type<arg8_type>::type A8;
typename basic_type<arg9_type>::type A9;
typename basic_type<arg10_type>::type A10;
typename basic_type<arg11_type>::type A11;
typename basic_type<arg12_type>::type A12;
typename basic_type<arg13_type>::type A13;
typename basic_type<arg14_type>::type A14;
typename basic_type<arg15_type>::type A15;
typename basic_type<arg16_type>::type A16;
typename basic_type<arg17_type>::type A17;
typename basic_type<arg18_type>::type A18;
typename basic_type<arg19_type>::type A19;
mark_non_persistent(A1);
mark_non_persistent(A2);
mark_non_persistent(A3);
mark_non_persistent(A4);
mark_non_persistent(A5);
mark_non_persistent(A6);
mark_non_persistent(A7);
mark_non_persistent(A8);
mark_non_persistent(A9);
mark_non_persistent(A10);
mark_non_persistent(A11);
mark_non_persistent(A12);
mark_non_persistent(A13);
mark_non_persistent(A14);
mark_non_persistent(A15);
mark_non_persistent(A16);
mark_non_persistent(A17);
mark_non_persistent(A18);
mark_non_persistent(A19);
int i = 0;
if (i < nrhs && is_input_type<arg1_type>::value) {validate_and_populate_arg(i,prhs[i],A1); ++i;} ELSE_ASSIGN_ARG_1;
if (i < nrhs && is_input_type<arg2_type>::value) {validate_and_populate_arg(i,prhs[i],A2); ++i;} ELSE_ASSIGN_ARG_2;
if (i < nrhs && is_input_type<arg3_type>::value) {validate_and_populate_arg(i,prhs[i],A3); ++i;} ELSE_ASSIGN_ARG_3;
if (i < nrhs && is_input_type<arg4_type>::value) {validate_and_populate_arg(i,prhs[i],A4); ++i;} ELSE_ASSIGN_ARG_4;
if (i < nrhs && is_input_type<arg5_type>::value) {validate_and_populate_arg(i,prhs[i],A5); ++i;} ELSE_ASSIGN_ARG_5;
if (i < nrhs && is_input_type<arg6_type>::value) {validate_and_populate_arg(i,prhs[i],A6); ++i;} ELSE_ASSIGN_ARG_6;
if (i < nrhs && is_input_type<arg7_type>::value) {validate_and_populate_arg(i,prhs[i],A7); ++i;} ELSE_ASSIGN_ARG_7;
if (i < nrhs && is_input_type<arg8_type>::value) {validate_and_populate_arg(i,prhs[i],A8); ++i;} ELSE_ASSIGN_ARG_8;
if (i < nrhs && is_input_type<arg9_type>::value) {validate_and_populate_arg(i,prhs[i],A9); ++i;} ELSE_ASSIGN_ARG_9;
if (i < nrhs && is_input_type<arg10_type>::value) {validate_and_populate_arg(i,prhs[i],A10); ++i;} ELSE_ASSIGN_ARG_10;
if (i < nrhs && is_input_type<arg11_type>::value) {validate_and_populate_arg(i,prhs[i],A11); ++i;} ELSE_ASSIGN_ARG_11;
if (i < nrhs && is_input_type<arg12_type>::value) {validate_and_populate_arg(i,prhs[i],A12); ++i;} ELSE_ASSIGN_ARG_12;
if (i < nrhs && is_input_type<arg13_type>::value) {validate_and_populate_arg(i,prhs[i],A13); ++i;} ELSE_ASSIGN_ARG_13;
if (i < nrhs && is_input_type<arg14_type>::value) {validate_and_populate_arg(i,prhs[i],A14); ++i;} ELSE_ASSIGN_ARG_14;
if (i < nrhs && is_input_type<arg15_type>::value) {validate_and_populate_arg(i,prhs[i],A15); ++i;} ELSE_ASSIGN_ARG_15;
if (i < nrhs && is_input_type<arg16_type>::value) {validate_and_populate_arg(i,prhs[i],A16); ++i;} ELSE_ASSIGN_ARG_16;
if (i < nrhs && is_input_type<arg17_type>::value) {validate_and_populate_arg(i,prhs[i],A17); ++i;} ELSE_ASSIGN_ARG_17;
if (i < nrhs && is_input_type<arg18_type>::value) {validate_and_populate_arg(i,prhs[i],A18); ++i;} ELSE_ASSIGN_ARG_18;
if (i < nrhs && is_input_type<arg19_type>::value) {validate_and_populate_arg(i,prhs[i],A19); ++i;} ELSE_ASSIGN_ARG_19;
mex_function(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19);
i = 0;
if (is_output_type<arg1_type>::value) {assign_to_matlab(plhs[i],A1); ++i;}
if (is_output_type<arg2_type>::value) {assign_to_matlab(plhs[i],A2); ++i;}
if (is_output_type<arg3_type>::value) {assign_to_matlab(plhs[i],A3); ++i;}
if (is_output_type<arg4_type>::value) {assign_to_matlab(plhs[i],A4); ++i;}
if (is_output_type<arg5_type>::value) {assign_to_matlab(plhs[i],A5); ++i;}
if (is_output_type<arg6_type>::value) {assign_to_matlab(plhs[i],A6); ++i;}
if (is_output_type<arg7_type>::value) {assign_to_matlab(plhs[i],A7); ++i;}
if (is_output_type<arg8_type>::value) {assign_to_matlab(plhs[i],A8); ++i;}
if (is_output_type<arg9_type>::value) {assign_to_matlab(plhs[i],A9); ++i;}
if (is_output_type<arg10_type>::value) {assign_to_matlab(plhs[i],A10); ++i;}
if (is_output_type<arg11_type>::value) {assign_to_matlab(plhs[i],A11); ++i;}
if (is_output_type<arg12_type>::value) {assign_to_matlab(plhs[i],A12); ++i;}
if (is_output_type<arg13_type>::value) {assign_to_matlab(plhs[i],A13); ++i;}
if (is_output_type<arg14_type>::value) {assign_to_matlab(plhs[i],A14); ++i;}
if (is_output_type<arg15_type>::value) {assign_to_matlab(plhs[i],A15); ++i;}
if (is_output_type<arg16_type>::value) {assign_to_matlab(plhs[i],A16); ++i;}
if (is_output_type<arg17_type>::value) {assign_to_matlab(plhs[i],A17); ++i;}
if (is_output_type<arg18_type>::value) {assign_to_matlab(plhs[i],A18); ++i;}
if (is_output_type<arg19_type>::value) {assign_to_matlab(plhs[i],A19); ++i;}
}
};
template <>
struct call_mex_function_helper<20>
{
template <typename funct>
void callit(
const funct& ,
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]
) const
{
typedef typename sig_traits<funct>::arg1_type arg1_type;
typedef typename sig_traits<funct>::arg2_type arg2_type;
typedef typename sig_traits<funct>::arg3_type arg3_type;
typedef typename sig_traits<funct>::arg4_type arg4_type;
typedef typename sig_traits<funct>::arg5_type arg5_type;
typedef typename sig_traits<funct>::arg6_type arg6_type;
typedef typename sig_traits<funct>::arg7_type arg7_type;
typedef typename sig_traits<funct>::arg8_type arg8_type;
typedef typename sig_traits<funct>::arg9_type arg9_type;
typedef typename sig_traits<funct>::arg10_type arg10_type;
typedef typename sig_traits<funct>::arg11_type arg11_type;
typedef typename sig_traits<funct>::arg12_type arg12_type;
typedef typename sig_traits<funct>::arg13_type arg13_type;
typedef typename sig_traits<funct>::arg14_type arg14_type;
typedef typename sig_traits<funct>::arg15_type arg15_type;
typedef typename sig_traits<funct>::arg16_type arg16_type;
typedef typename sig_traits<funct>::arg17_type arg17_type;
typedef typename sig_traits<funct>::arg18_type arg18_type;
typedef typename sig_traits<funct>::arg19_type arg19_type;
typedef typename sig_traits<funct>::arg20_type arg20_type;
typename basic_type<arg1_type>::type A1;
typename basic_type<arg2_type>::type A2;
typename basic_type<arg3_type>::type A3;
typename basic_type<arg4_type>::type A4;
typename basic_type<arg5_type>::type A5;
typename basic_type<arg6_type>::type A6;
typename basic_type<arg7_type>::type A7;
typename basic_type<arg8_type>::type A8;
typename basic_type<arg9_type>::type A9;
typename basic_type<arg10_type>::type A10;
typename basic_type<arg11_type>::type A11;
typename basic_type<arg12_type>::type A12;
typename basic_type<arg13_type>::type A13;
typename basic_type<arg14_type>::type A14;
typename basic_type<arg15_type>::type A15;
typename basic_type<arg16_type>::type A16;
typename basic_type<arg17_type>::type A17;
typename basic_type<arg18_type>::type A18;
typename basic_type<arg19_type>::type A19;
typename basic_type<arg20_type>::type A20;
mark_non_persistent(A1);
mark_non_persistent(A2);
mark_non_persistent(A3);
mark_non_persistent(A4);
mark_non_persistent(A5);
mark_non_persistent(A6);
mark_non_persistent(A7);
mark_non_persistent(A8);
mark_non_persistent(A9);
mark_non_persistent(A10);
mark_non_persistent(A11);
mark_non_persistent(A12);
mark_non_persistent(A13);
mark_non_persistent(A14);
mark_non_persistent(A15);
mark_non_persistent(A16);
mark_non_persistent(A17);
mark_non_persistent(A18);
mark_non_persistent(A19);
mark_non_persistent(A20);
int i = 0;
if (i < nrhs && is_input_type<arg1_type>::value) {validate_and_populate_arg(i,prhs[i],A1); ++i;} ELSE_ASSIGN_ARG_1;
if (i < nrhs && is_input_type<arg2_type>::value) {validate_and_populate_arg(i,prhs[i],A2); ++i;} ELSE_ASSIGN_ARG_2;
if (i < nrhs && is_input_type<arg3_type>::value) {validate_and_populate_arg(i,prhs[i],A3); ++i;} ELSE_ASSIGN_ARG_3;
if (i < nrhs && is_input_type<arg4_type>::value) {validate_and_populate_arg(i,prhs[i],A4); ++i;} ELSE_ASSIGN_ARG_4;
if (i < nrhs && is_input_type<arg5_type>::value) {validate_and_populate_arg(i,prhs[i],A5); ++i;} ELSE_ASSIGN_ARG_5;
if (i < nrhs && is_input_type<arg6_type>::value) {validate_and_populate_arg(i,prhs[i],A6); ++i;} ELSE_ASSIGN_ARG_6;
if (i < nrhs && is_input_type<arg7_type>::value) {validate_and_populate_arg(i,prhs[i],A7); ++i;} ELSE_ASSIGN_ARG_7;
if (i < nrhs && is_input_type<arg8_type>::value) {validate_and_populate_arg(i,prhs[i],A8); ++i;} ELSE_ASSIGN_ARG_8;
if (i < nrhs && is_input_type<arg9_type>::value) {validate_and_populate_arg(i,prhs[i],A9); ++i;} ELSE_ASSIGN_ARG_9;
if (i < nrhs && is_input_type<arg10_type>::value) {validate_and_populate_arg(i,prhs[i],A10); ++i;} ELSE_ASSIGN_ARG_10;
if (i < nrhs && is_input_type<arg11_type>::value) {validate_and_populate_arg(i,prhs[i],A11); ++i;} ELSE_ASSIGN_ARG_11;
if (i < nrhs && is_input_type<arg12_type>::value) {validate_and_populate_arg(i,prhs[i],A12); ++i;} ELSE_ASSIGN_ARG_12;
if (i < nrhs && is_input_type<arg13_type>::value) {validate_and_populate_arg(i,prhs[i],A13); ++i;} ELSE_ASSIGN_ARG_13;
if (i < nrhs && is_input_type<arg14_type>::value) {validate_and_populate_arg(i,prhs[i],A14); ++i;} ELSE_ASSIGN_ARG_14;
if (i < nrhs && is_input_type<arg15_type>::value) {validate_and_populate_arg(i,prhs[i],A15); ++i;} ELSE_ASSIGN_ARG_15;
if (i < nrhs && is_input_type<arg16_type>::value) {validate_and_populate_arg(i,prhs[i],A16); ++i;} ELSE_ASSIGN_ARG_16;
if (i < nrhs && is_input_type<arg17_type>::value) {validate_and_populate_arg(i,prhs[i],A17); ++i;} ELSE_ASSIGN_ARG_17;
if (i < nrhs && is_input_type<arg18_type>::value) {validate_and_populate_arg(i,prhs[i],A18); ++i;} ELSE_ASSIGN_ARG_18;
if (i < nrhs && is_input_type<arg19_type>::value) {validate_and_populate_arg(i,prhs[i],A19); ++i;} ELSE_ASSIGN_ARG_19;
if (i < nrhs && is_input_type<arg20_type>::value) {validate_and_populate_arg(i,prhs[i],A20); ++i;} ELSE_ASSIGN_ARG_20;
mex_function(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20);
i = 0;
if (is_output_type<arg1_type>::value) {assign_to_matlab(plhs[i],A1); ++i;}
if (is_output_type<arg2_type>::value) {assign_to_matlab(plhs[i],A2); ++i;}
if (is_output_type<arg3_type>::value) {assign_to_matlab(plhs[i],A3); ++i;}
if (is_output_type<arg4_type>::value) {assign_to_matlab(plhs[i],A4); ++i;}
if (is_output_type<arg5_type>::value) {assign_to_matlab(plhs[i],A5); ++i;}
if (is_output_type<arg6_type>::value) {assign_to_matlab(plhs[i],A6); ++i;}
if (is_output_type<arg7_type>::value) {assign_to_matlab(plhs[i],A7); ++i;}
if (is_output_type<arg8_type>::value) {assign_to_matlab(plhs[i],A8); ++i;}
if (is_output_type<arg9_type>::value) {assign_to_matlab(plhs[i],A9); ++i;}
if (is_output_type<arg10_type>::value) {assign_to_matlab(plhs[i],A10); ++i;}
if (is_output_type<arg11_type>::value) {assign_to_matlab(plhs[i],A11); ++i;}
if (is_output_type<arg12_type>::value) {assign_to_matlab(plhs[i],A12); ++i;}
if (is_output_type<arg13_type>::value) {assign_to_matlab(plhs[i],A13); ++i;}
if (is_output_type<arg14_type>::value) {assign_to_matlab(plhs[i],A14); ++i;}
if (is_output_type<arg15_type>::value) {assign_to_matlab(plhs[i],A15); ++i;}
if (is_output_type<arg16_type>::value) {assign_to_matlab(plhs[i],A16); ++i;}
if (is_output_type<arg17_type>::value) {assign_to_matlab(plhs[i],A17); ++i;}
if (is_output_type<arg18_type>::value) {assign_to_matlab(plhs[i],A18); ++i;}
if (is_output_type<arg19_type>::value) {assign_to_matlab(plhs[i],A19); ++i;}
if (is_output_type<arg20_type>::value) {assign_to_matlab(plhs[i],A20); ++i;}
}
};
// ----------------------------------------------------------------------------------------
template <
typename funct
>
void call_mex_function (
const funct& f,
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]
)
{
const long expected_nrhs = funct_traits<funct>::num_inputs;
const long expected_nlhs = funct_traits<funct>::num_outputs;
const long expected_args = expected_nrhs + expected_nlhs;
long defaulted_args = 0;
#ifdef ARG_1_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg1_type>::value);
#ifndef ARG_2_DEFAULT
// You can't define a default for argument 1 if you don't define one for argument 2 also.
COMPILE_TIME_ASSERT(expected_args < 2);
#endif
COMPILE_TIME_ASSERT(1 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_2_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg2_type>::value);
#ifndef ARG_3_DEFAULT
// You can't define a default for argument 2 if you don't define one for argument 3 also.
COMPILE_TIME_ASSERT(expected_args < 3);
#endif
COMPILE_TIME_ASSERT(2 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_3_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg3_type>::value);
#ifndef ARG_4_DEFAULT
// You can't define a default for argument 3 if you don't define one for argument 4 also.
COMPILE_TIME_ASSERT(expected_args < 4);
#endif
COMPILE_TIME_ASSERT(3 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_4_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg4_type>::value);
#ifndef ARG_5_DEFAULT
// You can't define a default for argument 4 if you don't define one for argument 5 also.
COMPILE_TIME_ASSERT(expected_args < 5);
#endif
COMPILE_TIME_ASSERT(4 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_5_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg5_type>::value);
#ifndef ARG_6_DEFAULT
// You can't define a default for argument 5 if you don't define one for argument 6 also.
COMPILE_TIME_ASSERT(expected_args < 6);
#endif
COMPILE_TIME_ASSERT(5 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_6_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg6_type>::value);
#ifndef ARG_7_DEFAULT
// You can't define a default for argument 6 if you don't define one for argument 7 also.
COMPILE_TIME_ASSERT(expected_args < 7);
#endif
COMPILE_TIME_ASSERT(6 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_7_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg7_type>::value);
#ifndef ARG_8_DEFAULT
// You can't define a default for argument 7 if you don't define one for argument 8 also.
COMPILE_TIME_ASSERT(expected_args < 8);
#endif
COMPILE_TIME_ASSERT(7 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_8_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg8_type>::value);
#ifndef ARG_9_DEFAULT
// You can't define a default for argument 8 if you don't define one for argument 9 also.
COMPILE_TIME_ASSERT(expected_args < 9);
#endif
COMPILE_TIME_ASSERT(8 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_9_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg9_type>::value);
#ifndef ARG_10_DEFAULT
// You can't define a default for argument 9 if you don't define one for argument 10 also.
COMPILE_TIME_ASSERT(expected_args < 10);
#endif
COMPILE_TIME_ASSERT(9 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_10_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg10_type>::value);
#ifndef ARG_11_DEFAULT
// You can't define a default for argument 10 if you don't define one for argument 11 also.
COMPILE_TIME_ASSERT(expected_args < 11);
#endif
COMPILE_TIME_ASSERT(10 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_11_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg11_type>::value);
#ifndef ARG_12_DEFAULT
// You can't define a default for argument 11 if you don't define one for argument 12 also.
COMPILE_TIME_ASSERT(expected_args < 12);
#endif
COMPILE_TIME_ASSERT(11 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_12_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg12_type>::value);
#ifndef ARG_13_DEFAULT
// You can't define a default for argument 12 if you don't define one for argument 13 also.
COMPILE_TIME_ASSERT(expected_args < 13);
#endif
COMPILE_TIME_ASSERT(12 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_13_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg13_type>::value);
#ifndef ARG_14_DEFAULT
// You can't define a default for argument 13 if you don't define one for argument 14 also.
COMPILE_TIME_ASSERT(expected_args < 14);
#endif
COMPILE_TIME_ASSERT(13 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_14_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg14_type>::value);
#ifndef ARG_15_DEFAULT
// You can't define a default for argument 14 if you don't define one for argument 15 also.
COMPILE_TIME_ASSERT(expected_args < 15);
#endif
COMPILE_TIME_ASSERT(14 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_15_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg15_type>::value);
#ifndef ARG_16_DEFAULT
// You can't define a default for argument 15 if you don't define one for argument 16 also.
COMPILE_TIME_ASSERT(expected_args < 16);
#endif
COMPILE_TIME_ASSERT(15 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_16_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg16_type>::value);
#ifndef ARG_17_DEFAULT
// You can't define a default for argument 16 if you don't define one for argument 17 also.
COMPILE_TIME_ASSERT(expected_args < 17);
#endif
COMPILE_TIME_ASSERT(16 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_17_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg17_type>::value);
#ifndef ARG_18_DEFAULT
// You can't define a default for argument 17 if you don't define one for argument 18 also.
COMPILE_TIME_ASSERT(expected_args < 18);
#endif
COMPILE_TIME_ASSERT(17 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_18_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg18_type>::value);
#ifndef ARG_19_DEFAULT
// You can't define a default for argument 18 if you don't define one for argument 19 also.
COMPILE_TIME_ASSERT(expected_args < 19);
#endif
COMPILE_TIME_ASSERT(18 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_19_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg19_type>::value);
#ifndef ARG_20_DEFAULT
// You can't define a default for argument 19 if you don't define one for argument 20 also.
COMPILE_TIME_ASSERT(expected_args < 20);
#endif
COMPILE_TIME_ASSERT(19 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
#ifdef ARG_20_DEFAULT
++defaulted_args;
// You can only set an argument's default value if it is an input argument.
COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg20_type>::value);
COMPILE_TIME_ASSERT(20 <= expected_args); // You can't define a default for an argument that doesn't exist.
#endif
/* check for proper number of arguments */
if(nrhs > expected_nrhs || nrhs < expected_nrhs - defaulted_args)
{
std::ostringstream sout;
sout << "Expected between " << expected_nrhs-defaulted_args
<< " and " << expected_nrhs << " input arguments, got " << nrhs << ".";
mexErrMsgIdAndTxt("mex_function:nrhs",
sout.str().c_str());
}
if (nlhs > expected_nlhs)
{
std::ostringstream sout;
sout << "Expected at most " << expected_nlhs << " output arguments, got " << nlhs << ".";
mexErrMsgIdAndTxt("mex_function:nlhs",
sout.str().c_str());
}
try
{
call_mex_function_helper<sig_traits<funct>::num_args> helper;
helper.callit(f, nlhs, plhs, nrhs, prhs);
}
catch (invalid_args_exception& e)
{
mexErrMsgIdAndTxt("mex_function:validate_and_populate_arg",
("Input" + e.msg).c_str());
}
catch (user_hit_ctrl_c& )
{
// do nothing, just return to matlab
}
catch (dlib::error& e)
{
mexErrMsgIdAndTxt("mex_function:error",
e.what());
}
}
// ----------------------------------------------------------------------------------------
class mex_streambuf : public std::streambuf
{
public:
mex_streambuf (
)
{
buf.resize(1000);
setp(&buf[0], &buf[0] + buf.size()-2);
// make cout send data to mex_streambuf
std::cout.rdbuf(this);
}
protected:
int sync (
)
{
int num = static_cast<int>(pptr()-pbase());
if (num != 0)
{
buf[num] = 0; // null terminate the string
mexPrintf("%s",&buf[0]);
mexEvalString("drawnow"); // flush print to screen
pbump(-num);
}
return 0;
}
int_type overflow (
int_type c
)
{
if (c != EOF)
{
*pptr() = c;
pbump(1);
}
sync();
return c;
}
private:
std::vector<char> buf;
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template <typename T>
void setup_input_args (
mxArray*& array,
const T& item,
int& nrhs
)
{
assign_to_matlab(array, item);
++nrhs;
}
void setup_input_args (
mxArray*& array,
const function_handle& item,
int& nrhs
)
{
array = static_cast<mxArray*>(item.h);
++nrhs;
}
template <typename T>
void setup_input_args (
mxArray*& array,
const output_decorator<T>& item,
int& nrhs
)
{
}
template <typename T>
void setup_output_args (
const std::string& function_name,
mxArray* array,
const T& item,
int& nrhs
)
{
}
template <typename T>
void setup_output_args (
const std::string& function_name,
mxArray* array,
const output_decorator<T>& item,
int& i
)
{
try
{
validate_and_populate_arg(i,array,const_cast<T&>(item.item));
++i;
}
catch (invalid_args_exception& e)
{
throw dlib::error("Error occurred calling MATLAB function '" + function_name + "' from mex file. \n"
"The MATLAB function didn't return what we expected it to. \nIn particular, return" + e.msg);
}
}
void call_matlab_for_real (
int nlhs,
mxArray* plhs[],
int nrhs,
mxArray* prhs[],
const std::string& function_name
)
{
int status = mexCallMATLAB(nlhs, plhs, nrhs, prhs, function_name.c_str());
if (status)
{
throw dlib::error("Error, an exception was thrown when we tried to call the MATLAB function '" + function_name + "'.");
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
void call_matlab (
const std::string& function_name
)
{
using namespace mex_binding;
call_matlab_for_real(0,NULL,0,NULL, function_name);
}
template <typename T1>
void free_callback_resources (
int nlhs,
mxArray* plhs[],
int nrhs,
mxArray* prhs[]
)
{
// free resources
for (int i = 0; i < nlhs; ++i)
mxDestroyArray(plhs[i]);
for (int i = 0; i < nrhs; ++i)
{
// don't call mxDestroyArray() on function handles (which should only ever be in prhs[0])
if (i == 0 && dlib::is_same_type<T1,function_handle>::value)
continue;
mxDestroyArray(prhs[i]);
}
}
template <
typename T1
>
void call_matlab (
const std::string& function_name,
const T1& A1
)
{
using namespace mex_binding;
const int num_args = 1;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
int nrhs = 0;
setup_input_args(prhs[nrhs], A1, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
int i = 0;
setup_output_args(function_name, plhs[i], A1, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename T1,
typename T2
>
void call_matlab (
const std::string& function_name,
const T1& A1,
const T2& A2
)
{
using namespace mex_binding;
const int num_args = 2;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
int nrhs = 0;
setup_input_args(prhs[nrhs], A1, nrhs);
setup_input_args(prhs[nrhs], A2, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
int i = 0;
setup_output_args(function_name, plhs[i], A1, i);
setup_output_args(function_name, plhs[i], A2, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename T1,
typename T2,
typename T3
>
void call_matlab (
const std::string& function_name,
const T1& A1,
const T2& A2,
const T3& A3
)
{
using namespace mex_binding;
const int num_args = 3;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
int nrhs = 0;
setup_input_args(prhs[nrhs], A1, nrhs);
setup_input_args(prhs[nrhs], A2, nrhs);
setup_input_args(prhs[nrhs], A3, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
int i = 0;
setup_output_args(function_name, plhs[i], A1, i);
setup_output_args(function_name, plhs[i], A2, i);
setup_output_args(function_name, plhs[i], A3, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename T1,
typename T2,
typename T3,
typename T4
>
void call_matlab (
const std::string& function_name,
const T1& A1,
const T2& A2,
const T3& A3,
const T4& A4
)
{
using namespace mex_binding;
const int num_args = 4;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
int nrhs = 0;
setup_input_args(prhs[nrhs], A1, nrhs);
setup_input_args(prhs[nrhs], A2, nrhs);
setup_input_args(prhs[nrhs], A3, nrhs);
setup_input_args(prhs[nrhs], A4, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
int i = 0;
setup_output_args(function_name, plhs[i], A1, i);
setup_output_args(function_name, plhs[i], A2, i);
setup_output_args(function_name, plhs[i], A3, i);
setup_output_args(function_name, plhs[i], A4, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5
>
void call_matlab (
const std::string& function_name,
const T1& A1,
const T2& A2,
const T3& A3,
const T4& A4,
const T5& A5
)
{
using namespace mex_binding;
const int num_args = 5;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
int nrhs = 0;
setup_input_args(prhs[nrhs], A1, nrhs);
setup_input_args(prhs[nrhs], A2, nrhs);
setup_input_args(prhs[nrhs], A3, nrhs);
setup_input_args(prhs[nrhs], A4, nrhs);
setup_input_args(prhs[nrhs], A5, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
int i = 0;
setup_output_args(function_name, plhs[i], A1, i);
setup_output_args(function_name, plhs[i], A2, i);
setup_output_args(function_name, plhs[i], A3, i);
setup_output_args(function_name, plhs[i], A4, i);
setup_output_args(function_name, plhs[i], A5, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6
>
void call_matlab (
const std::string& function_name,
const T1& A1,
const T2& A2,
const T3& A3,
const T4& A4,
const T5& A5,
const T6& A6
)
{
using namespace mex_binding;
const int num_args = 6;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
int nrhs = 0;
setup_input_args(prhs[nrhs], A1, nrhs);
setup_input_args(prhs[nrhs], A2, nrhs);
setup_input_args(prhs[nrhs], A3, nrhs);
setup_input_args(prhs[nrhs], A4, nrhs);
setup_input_args(prhs[nrhs], A5, nrhs);
setup_input_args(prhs[nrhs], A6, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
int i = 0;
setup_output_args(function_name, plhs[i], A1, i);
setup_output_args(function_name, plhs[i], A2, i);
setup_output_args(function_name, plhs[i], A3, i);
setup_output_args(function_name, plhs[i], A4, i);
setup_output_args(function_name, plhs[i], A5, i);
setup_output_args(function_name, plhs[i], A6, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7
>
void call_matlab (
const std::string& function_name,
const T1& A1,
const T2& A2,
const T3& A3,
const T4& A4,
const T5& A5,
const T6& A6,
const T7& A7
)
{
using namespace mex_binding;
const int num_args = 7;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
int nrhs = 0;
setup_input_args(prhs[nrhs], A1, nrhs);
setup_input_args(prhs[nrhs], A2, nrhs);
setup_input_args(prhs[nrhs], A3, nrhs);
setup_input_args(prhs[nrhs], A4, nrhs);
setup_input_args(prhs[nrhs], A5, nrhs);
setup_input_args(prhs[nrhs], A6, nrhs);
setup_input_args(prhs[nrhs], A7, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
protected:
int i = 0;
setup_output_args(function_name, plhs[i], A1, i);
setup_output_args(function_name, plhs[i], A2, i);
setup_output_args(function_name, plhs[i], A3, i);
setup_output_args(function_name, plhs[i], A4, i);
setup_output_args(function_name, plhs[i], A5, i);
setup_output_args(function_name, plhs[i], A6, i);
setup_output_args(function_name, plhs[i], A7, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
int
sync
(
)
{
int
num
=
static_cast
<
int
>
(
pptr
()
-
pbase
());
if
(
num
!=
0
)
{
buf
[
num
]
=
0
;
// null terminate the string
mexPrintf
(
"%s"
,
&
buf
[
0
]);
mexEvalString
(
"drawnow"
);
// flush print to screen
pbump
(
-
num
);
}
return
0
;
}
int_type
overflow
(
int_type
c
)
{
if
(
c
!=
EOF
)
{
*
pptr
()
=
c
;
pbump
(
1
);
}
sync
();
return
c
;
}
template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8
>
void call_matlab (
const std::string& function_name,
const T1& A1,
const T2& A2,
const T3& A3,
const T4& A4,
const T5& A5,
const T6& A6,
const T7& A7,
const T8& A8
)
{
using namespace mex_binding;
const int num_args = 8;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
private:
std
::
vector
<
char
>
buf
;
int nrhs = 0;
setup_input_args(prhs[nrhs], A1, nrhs);
setup_input_args(prhs[nrhs], A2, nrhs);
setup_input_args(prhs[nrhs], A3, nrhs);
setup_input_args(prhs[nrhs], A4, nrhs);
setup_input_args(prhs[nrhs], A5, nrhs);
setup_input_args(prhs[nrhs], A6, nrhs);
setup_input_args(prhs[nrhs], A7, nrhs);
setup_input_args(prhs[nrhs], A8, nrhs);
};
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
int i = 0;
setup_output_args(function_name, plhs[i], A1, i);
setup_output_args(function_name, plhs[i], A2, i);
setup_output_args(function_name, plhs[i], A3, i);
setup_output_args(function_name, plhs[i], A4, i);
setup_output_args(function_name, plhs[i], A5, i);
setup_output_args(function_name, plhs[i], A6, i);
setup_output_args(function_name, plhs[i], A7, i);
setup_output_args(function_name, plhs[i], A8, i);
template
<
typename
T
>
void
setup_input_args
(
mxArray
*&
array
,
const
T
&
item
,
int
&
nrhs
)
{
assign_to_matlab
(
array
,
item
);
++
nrhs
;
}
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
void
setup_input_args
(
mxArray
*&
array
,
const
function_handle
&
item
,
int
&
nrhs
)
{
array
=
static_cast
<
mxArray
*>
(
item
.
h
);
++
nrhs
;
}
template
<
typename
T
>
void
setup_input_args
(
mxArray
*&
array
,
const
output_decorator
<
T
>&
item
,
int
&
nrhs
)
{
}
template
<
typename
T
>
void
setup_output_args
(
const
std
::
string
&
function_name
,
mxArray
*
array
,
const
T
&
item
,
int
&
nrhs
)
{
}
template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9
>
void call_matlab (
const std::string& function_name,
const T1& A1,
const T2& A2,
const T3& A3,
const T4& A4,
const T5& A5,
const T6& A6,
const T7& A7,
const T8& A8,
const T9& A9
)
{
using namespace mex_binding;
const int num_args = 9;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
template
<
typename
T
>
void
setup_output_args
(
const
std
::
string
&
function_name
,
mxArray
*
array
,
const
output_decorator
<
T
>&
item
,
int
&
i
)
{
try
{
validate_and_populate_arg
(
i
,
array
,
const_cast
<
T
&>
(
item
.
item
));
++
i
;
}
catch
(
invalid_args_exception
&
e
)
{
throw
dlib
::
error
(
"Error occurred calling MATLAB function '"
+
function_name
+
"' from mex file.
\n
"
"The MATLAB function didn't return what we expected it to.
\n
In particular, return"
+
e
.
msg
);
}
}
int nrhs = 0;
setup_input_args(prhs[nrhs], A1, nrhs);
setup_input_args(prhs[nrhs], A2, nrhs);
setup_input_args(prhs[nrhs], A3, nrhs);
setup_input_args(prhs[nrhs], A4, nrhs);
setup_input_args(prhs[nrhs], A5, nrhs);
setup_input_args(prhs[nrhs], A6, nrhs);
setup_input_args(prhs[nrhs], A7, nrhs);
setup_input_args(prhs[nrhs], A8, nrhs);
setup_input_args(prhs[nrhs], A9, nrhs);
void
call_matlab_for_real
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
mxArray
*
prhs
[],
const
std
::
string
&
function_name
)
{
int
status
=
mexCallMATLAB
(
nlhs
,
plhs
,
nrhs
,
prhs
,
function_name
.
c_str
());
if
(
status
)
{
throw
dlib
::
error
(
"Error, an exception was thrown when we tried to call the MATLAB function '"
+
function_name
+
"'."
);
}
}
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
int i = 0;
setup_output_args(function_name, plhs[i], A1, i);
setup_output_args(function_name, plhs[i], A2, i);
setup_output_args(function_name, plhs[i], A3, i);
setup_output_args(function_name, plhs[i], A4, i);
setup_output_args(function_name, plhs[i], A5, i);
setup_output_args(function_name, plhs[i], A6, i);
setup_output_args(function_name, plhs[i], A7, i);
setup_output_args(function_name, plhs[i], A8, i);
setup_output_args(function_name, plhs[i], A9, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9,
typename T10
>
void call_matlab (
const
std
::
string
&
function_name
const std::string& function_name,
const T1& A1,
const T2& A2,
const T3& A3,
const T4& A4,
const T5& A5,
const T6& A6,
const T7& A7,
const T8& A8,
const T9& A9,
const T10& A10
)
{
using namespace mex_binding;
const int num_args = 10;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
int nrhs = 0;
setup_input_args(prhs[nrhs], A1, nrhs);
setup_input_args(prhs[nrhs], A2, nrhs);
setup_input_args(prhs[nrhs], A3, nrhs);
setup_input_args(prhs[nrhs], A4, nrhs);
setup_input_args(prhs[nrhs], A5, nrhs);
setup_input_args(prhs[nrhs], A6, nrhs);
setup_input_args(prhs[nrhs], A7, nrhs);
setup_input_args(prhs[nrhs], A8, nrhs);
setup_input_args(prhs[nrhs], A9, nrhs);
setup_input_args(prhs[nrhs], A10, nrhs);
c
all_matlab_for_real
(
0
,
NULL
,
0
,
NULL
,
function_name
)
;
}
c
onst int nlhs = num_args - nrhs
;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
template
<
typename
T1
>
void
free_callback_resources
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
mxArray
*
p
r
hs
[
]
)
{
// free resources
for
(
int
i
=
0
;
i
<
nlhs
;
++
i
)
mxDestroyArray
(
plhs
[
i
]
);
int i = 0;
setup_output_args(function_name, plhs[i], A1, i);
setup_output_args(function_name, plhs[i], A2, i);
setup_output_args(function_name,
plhs[
i
],
A3, i);
setup_output_args(function_name, plhs[i], A4, i);
setup_output_args(function_name,
p
l
hs[
i], A5, i);
setup_output_args(function_name, plhs[i], A6, i);
setup_output_args(function_name, plhs[i], A7, i);
setup_output_args(function_name, plhs[i], A8, i);
setup_output_args(function_name, plhs[i], A9,
i)
;
setup_output_args(function_name, plhs[i], A10, i
);
for
(
int
i
=
0
;
i
<
nrhs
;
++
i
)
{
// don't call mxDestroyArray() on function handles (which should only ever be in prhs[0])
if
(
i
==
0
&&
dlib
::
is_same_type
<
T1
,
function_handle
>::
value
)
continue
;
mxDestroyArray
(
prhs
[
i
]);
}
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename
T1
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9,
typename T10,
typename T11
>
void call_matlab (
const std::string& function_name,
const
T1
&
A1
const T1& A1,
const T2& A2,
const T3& A3,
const T4& A4,
const T5& A5,
const T6& A6,
const T7& A7,
const T8& A8,
const T9& A9,
const T10& A10,
const T11& A11
)
{
using namespace mex_binding;
const
int
num_args
=
1
;
const int num_args =
1
1;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
int nrhs = 0;
setup_input_args(prhs[nrhs], A1, nrhs);
setup_input_args(prhs[nrhs], A2, nrhs);
setup_input_args(prhs[nrhs], A3, nrhs);
setup_input_args(prhs[nrhs], A4, nrhs);
setup_input_args(prhs[nrhs], A5, nrhs);
setup_input_args(prhs[nrhs], A6, nrhs);
setup_input_args(prhs[nrhs], A7, nrhs);
setup_input_args(prhs[nrhs], A8, nrhs);
setup_input_args(prhs[nrhs], A9, nrhs);
setup_input_args(prhs[nrhs], A10, nrhs);
setup_input_args(prhs[nrhs], A11, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
int i = 0;
setup_output_args(function_name, plhs[i], A1, i);
setup_output_args(function_name, plhs[i], A2, i);
setup_output_args(function_name, plhs[i], A3, i);
setup_output_args(function_name, plhs[i], A4, i);
setup_output_args(function_name, plhs[i], A5, i);
setup_output_args(function_name, plhs[i], A6, i);
setup_output_args(function_name, plhs[i], A7, i);
setup_output_args(function_name, plhs[i], A8, i);
setup_output_args(function_name, plhs[i], A9, i);
setup_output_args(function_name, plhs[i], A10, i);
setup_output_args(function_name, plhs[i], A11, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename T1,
typename
T2
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9,
typename T10,
typename T11,
typename T12
>
void call_matlab (
const std::string& function_name,
const T1& A1,
const
T2
&
A2
const T2& A2,
const T3& A3,
const T4& A4,
const T5& A5,
const T6& A6,
const T7& A7,
const T8& A8,
const T9& A9,
const T10& A10,
const T11& A11,
const T12& A12
)
{
using namespace mex_binding;
const
int
num_args
=
2
;
const int num_args =
1
2;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
int nrhs = 0;
setup_input_args(prhs[nrhs], A1, nrhs);
setup_input_args(prhs[nrhs], A2, nrhs);
setup_input_args(prhs[nrhs], A3, nrhs);
setup_input_args(prhs[nrhs], A4, nrhs);
setup_input_args(prhs[nrhs], A5, nrhs);
setup_input_args(prhs[nrhs], A6, nrhs);
setup_input_args(prhs[nrhs], A7, nrhs);
setup_input_args(prhs[nrhs], A8, nrhs);
setup_input_args(prhs[nrhs], A9, nrhs);
setup_input_args(prhs[nrhs], A10, nrhs);
setup_input_args(prhs[nrhs], A11, nrhs);
setup_input_args(prhs[nrhs], A12, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
...
...
@@ -1926,6 +3609,16 @@ void call_matlab (
int i = 0;
setup_output_args(function_name, plhs[i], A1, i);
setup_output_args(function_name, plhs[i], A2, i);
setup_output_args(function_name, plhs[i], A3, i);
setup_output_args(function_name, plhs[i], A4, i);
setup_output_args(function_name, plhs[i], A5, i);
setup_output_args(function_name, plhs[i], A6, i);
setup_output_args(function_name, plhs[i], A7, i);
setup_output_args(function_name, plhs[i], A8, i);
setup_output_args(function_name, plhs[i], A9, i);
setup_output_args(function_name, plhs[i], A10, i);
setup_output_args(function_name, plhs[i], A11, i);
setup_output_args(function_name, plhs[i], A12, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
...
...
@@ -1933,17 +3626,37 @@ void call_matlab (
template <
typename T1,
typename T2,
typename
T3
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9,
typename T10,
typename T11,
typename T12,
typename T13
>
void call_matlab (
const std::string& function_name,
const T1& A1,
const T2& A2,
const
T3
&
A3
const T3& A3,
const T4& A4,
const T5& A5,
const T6& A6,
const T7& A7,
const T8& A8,
const T9& A9,
const T10& A10,
const T11& A11,
const T12& A12,
const T13& A13
)
{
using namespace mex_binding;
const
int
num_args
=
3
;
const int num_args =
1
3;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
...
...
@@ -1951,6 +3664,16 @@ void call_matlab (
setup_input_args(prhs[nrhs], A1, nrhs);
setup_input_args(prhs[nrhs], A2, nrhs);
setup_input_args(prhs[nrhs], A3, nrhs);
setup_input_args(prhs[nrhs], A4, nrhs);
setup_input_args(prhs[nrhs], A5, nrhs);
setup_input_args(prhs[nrhs], A6, nrhs);
setup_input_args(prhs[nrhs], A7, nrhs);
setup_input_args(prhs[nrhs], A8, nrhs);
setup_input_args(prhs[nrhs], A9, nrhs);
setup_input_args(prhs[nrhs], A10, nrhs);
setup_input_args(prhs[nrhs], A11, nrhs);
setup_input_args(prhs[nrhs], A12, nrhs);
setup_input_args(prhs[nrhs], A13, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
...
...
@@ -1959,27 +3682,56 @@ void call_matlab (
setup_output_args(function_name, plhs[i], A1, i);
setup_output_args(function_name, plhs[i], A2, i);
setup_output_args(function_name, plhs[i], A3, i);
setup_output_args(function_name, plhs[i], A4, i);
setup_output_args(function_name, plhs[i], A5, i);
setup_output_args(function_name, plhs[i], A6, i);
setup_output_args(function_name, plhs[i], A7, i);
setup_output_args(function_name, plhs[i], A8, i);
setup_output_args(function_name, plhs[i], A9, i);
setup_output_args(function_name, plhs[i], A10, i);
setup_output_args(function_name, plhs[i], A11, i);
setup_output_args(function_name, plhs[i], A12, i);
setup_output_args(function_name, plhs[i], A13, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename T1,
typename T2,
typename T3,
typename
T4
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9,
typename T10,
typename T11,
typename T12,
typename T13,
typename T14
>
void call_matlab (
const std::string& function_name,
const T1& A1,
const T2& A2,
const T3& A3,
const
T4
&
A4
const T4& A4,
const T5& A5,
const T6& A6,
const T7& A7,
const T8& A8,
const T9& A9,
const T10& A10,
const T11& A11,
const T12& A12,
const T13& A13,
const T14& A14
)
{
using namespace mex_binding;
const
int
num_args
=
4
;
const int num_args =
1
4;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
...
...
@@ -1988,6 +3740,16 @@ void call_matlab (
setup_input_args(prhs[nrhs], A2, nrhs);
setup_input_args(prhs[nrhs], A3, nrhs);
setup_input_args(prhs[nrhs], A4, nrhs);
setup_input_args(prhs[nrhs], A5, nrhs);
setup_input_args(prhs[nrhs], A6, nrhs);
setup_input_args(prhs[nrhs], A7, nrhs);
setup_input_args(prhs[nrhs], A8, nrhs);
setup_input_args(prhs[nrhs], A9, nrhs);
setup_input_args(prhs[nrhs], A10, nrhs);
setup_input_args(prhs[nrhs], A11, nrhs);
setup_input_args(prhs[nrhs], A12, nrhs);
setup_input_args(prhs[nrhs], A13, nrhs);
setup_input_args(prhs[nrhs], A14, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
...
...
@@ -1997,17 +3759,36 @@ void call_matlab (
setup_output_args(function_name, plhs[i], A2, i);
setup_output_args(function_name, plhs[i], A3, i);
setup_output_args(function_name, plhs[i], A4, i);
setup_output_args(function_name, plhs[i], A5, i);
setup_output_args(function_name, plhs[i], A6, i);
setup_output_args(function_name, plhs[i], A7, i);
setup_output_args(function_name, plhs[i], A8, i);
setup_output_args(function_name, plhs[i], A9, i);
setup_output_args(function_name, plhs[i], A10, i);
setup_output_args(function_name, plhs[i], A11, i);
setup_output_args(function_name, plhs[i], A12, i);
setup_output_args(function_name, plhs[i], A13, i);
setup_output_args(function_name, plhs[i], A14, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename T1,
typename T2,
typename T3,
typename T4,
typename
T5
typename T5,
typename T6,
typename T7,
typename T8,
typename T9,
typename T10,
typename T11,
typename T12,
typename T13,
typename T14,
typename T15
>
void call_matlab (
const std::string& function_name,
...
...
@@ -2015,11 +3796,21 @@ void call_matlab (
const T2& A2,
const T3& A3,
const T4& A4,
const
T5
&
A5
const T5& A5,
const T6& A6,
const T7& A7,
const T8& A8,
const T9& A9,
const T10& A10,
const T11& A11,
const T12& A12,
const T13& A13,
const T14& A14,
const T15& A15
)
{
using namespace mex_binding;
const
int
num_args
=
5
;
const int num_args =
1
5;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
...
...
@@ -2029,6 +3820,16 @@ void call_matlab (
setup_input_args(prhs[nrhs], A3, nrhs);
setup_input_args(prhs[nrhs], A4, nrhs);
setup_input_args(prhs[nrhs], A5, nrhs);
setup_input_args(prhs[nrhs], A6, nrhs);
setup_input_args(prhs[nrhs], A7, nrhs);
setup_input_args(prhs[nrhs], A8, nrhs);
setup_input_args(prhs[nrhs], A9, nrhs);
setup_input_args(prhs[nrhs], A10, nrhs);
setup_input_args(prhs[nrhs], A11, nrhs);
setup_input_args(prhs[nrhs], A12, nrhs);
setup_input_args(prhs[nrhs], A13, nrhs);
setup_input_args(prhs[nrhs], A14, nrhs);
setup_input_args(prhs[nrhs], A15, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
...
...
@@ -2039,18 +3840,37 @@ void call_matlab (
setup_output_args(function_name, plhs[i], A3, i);
setup_output_args(function_name, plhs[i], A4, i);
setup_output_args(function_name, plhs[i], A5, i);
setup_output_args(function_name, plhs[i], A6, i);
setup_output_args(function_name, plhs[i], A7, i);
setup_output_args(function_name, plhs[i], A8, i);
setup_output_args(function_name, plhs[i], A9, i);
setup_output_args(function_name, plhs[i], A10, i);
setup_output_args(function_name, plhs[i], A11, i);
setup_output_args(function_name, plhs[i], A12, i);
setup_output_args(function_name, plhs[i], A13, i);
setup_output_args(function_name, plhs[i], A14, i);
setup_output_args(function_name, plhs[i], A15, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename
T6
typename T6,
typename T7,
typename T8,
typename T9,
typename T10,
typename T11,
typename T12,
typename T13,
typename T14,
typename T15,
typename T16
>
void call_matlab (
const std::string& function_name,
...
...
@@ -2059,11 +3879,21 @@ void call_matlab (
const T3& A3,
const T4& A4,
const T5& A5,
const
T6
&
A6
const T6& A6,
const T7& A7,
const T8& A8,
const T9& A9,
const T10& A10,
const T11& A11,
const T12& A12,
const T13& A13,
const T14& A14,
const T15& A15,
const T16& A16
)
{
using namespace mex_binding;
const
int
num_args
=
6
;
const int num_args =
1
6;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
...
...
@@ -2074,6 +3904,16 @@ void call_matlab (
setup_input_args(prhs[nrhs], A4, nrhs);
setup_input_args(prhs[nrhs], A5, nrhs);
setup_input_args(prhs[nrhs], A6, nrhs);
setup_input_args(prhs[nrhs], A7, nrhs);
setup_input_args(prhs[nrhs], A8, nrhs);
setup_input_args(prhs[nrhs], A9, nrhs);
setup_input_args(prhs[nrhs], A10, nrhs);
setup_input_args(prhs[nrhs], A11, nrhs);
setup_input_args(prhs[nrhs], A12, nrhs);
setup_input_args(prhs[nrhs], A13, nrhs);
setup_input_args(prhs[nrhs], A14, nrhs);
setup_input_args(prhs[nrhs], A15, nrhs);
setup_input_args(prhs[nrhs], A16, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
...
...
@@ -2085,11 +3925,20 @@ void call_matlab (
setup_output_args(function_name, plhs[i], A4, i);
setup_output_args(function_name, plhs[i], A5, i);
setup_output_args(function_name, plhs[i], A6, i);
setup_output_args(function_name, plhs[i], A7, i);
setup_output_args(function_name, plhs[i], A8, i);
setup_output_args(function_name, plhs[i], A9, i);
setup_output_args(function_name, plhs[i], A10, i);
setup_output_args(function_name, plhs[i], A11, i);
setup_output_args(function_name, plhs[i], A12, i);
setup_output_args(function_name, plhs[i], A13, i);
setup_output_args(function_name, plhs[i], A14, i);
setup_output_args(function_name, plhs[i], A15, i);
setup_output_args(function_name, plhs[i], A16, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename T1,
typename T2,
...
...
@@ -2097,7 +3946,17 @@ template <
typename T4,
typename T5,
typename T6,
typename
T7
typename T7,
typename T8,
typename T9,
typename T10,
typename T11,
typename T12,
typename T13,
typename T14,
typename T15,
typename T16,
typename T17
>
void call_matlab (
const std::string& function_name,
...
...
@@ -2107,11 +3966,21 @@ void call_matlab (
const T4& A4,
const T5& A5,
const T6& A6,
const
T7
&
A7
const T7& A7,
const T8& A8,
const T9& A9,
const T10& A10,
const T11& A11,
const T12& A12,
const T13& A13,
const T14& A14,
const T15& A15,
const T16& A16,
const T17& A17
)
{
using namespace mex_binding;
const
int
num_args
=
7
;
const int num_args =
1
7;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
...
...
@@ -2123,6 +3992,16 @@ void call_matlab (
setup_input_args(prhs[nrhs], A5, nrhs);
setup_input_args(prhs[nrhs], A6, nrhs);
setup_input_args(prhs[nrhs], A7, nrhs);
setup_input_args(prhs[nrhs], A8, nrhs);
setup_input_args(prhs[nrhs], A9, nrhs);
setup_input_args(prhs[nrhs], A10, nrhs);
setup_input_args(prhs[nrhs], A11, nrhs);
setup_input_args(prhs[nrhs], A12, nrhs);
setup_input_args(prhs[nrhs], A13, nrhs);
setup_input_args(prhs[nrhs], A14, nrhs);
setup_input_args(prhs[nrhs], A15, nrhs);
setup_input_args(prhs[nrhs], A16, nrhs);
setup_input_args(prhs[nrhs], A17, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
...
...
@@ -2135,11 +4014,20 @@ void call_matlab (
setup_output_args(function_name, plhs[i], A5, i);
setup_output_args(function_name, plhs[i], A6, i);
setup_output_args(function_name, plhs[i], A7, i);
setup_output_args(function_name, plhs[i], A8, i);
setup_output_args(function_name, plhs[i], A9, i);
setup_output_args(function_name, plhs[i], A10, i);
setup_output_args(function_name, plhs[i], A11, i);
setup_output_args(function_name, plhs[i], A12, i);
setup_output_args(function_name, plhs[i], A13, i);
setup_output_args(function_name, plhs[i], A14, i);
setup_output_args(function_name, plhs[i], A15, i);
setup_output_args(function_name, plhs[i], A16, i);
setup_output_args(function_name, plhs[i], A17, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename T1,
typename T2,
...
...
@@ -2148,7 +4036,17 @@ template <
typename T5,
typename T6,
typename T7,
typename
T8
typename T8,
typename T9,
typename T10,
typename T11,
typename T12,
typename T13,
typename T14,
typename T15,
typename T16,
typename T17,
typename T18
>
void call_matlab (
const std::string& function_name,
...
...
@@ -2159,11 +4057,21 @@ void call_matlab (
const T5& A5,
const T6& A6,
const T7& A7,
const
T8
&
A8
const T8& A8,
const T9& A9,
const T10& A10,
const T11& A11,
const T12& A12,
const T13& A13,
const T14& A14,
const T15& A15,
const T16& A16,
const T17& A17,
const T18& A18
)
{
using namespace mex_binding;
const
int
num_args
=
8
;
const int num_args =
1
8;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
...
...
@@ -2176,6 +4084,16 @@ void call_matlab (
setup_input_args(prhs[nrhs], A6, nrhs);
setup_input_args(prhs[nrhs], A7, nrhs);
setup_input_args(prhs[nrhs], A8, nrhs);
setup_input_args(prhs[nrhs], A9, nrhs);
setup_input_args(prhs[nrhs], A10, nrhs);
setup_input_args(prhs[nrhs], A11, nrhs);
setup_input_args(prhs[nrhs], A12, nrhs);
setup_input_args(prhs[nrhs], A13, nrhs);
setup_input_args(prhs[nrhs], A14, nrhs);
setup_input_args(prhs[nrhs], A15, nrhs);
setup_input_args(prhs[nrhs], A16, nrhs);
setup_input_args(prhs[nrhs], A17, nrhs);
setup_input_args(prhs[nrhs], A18, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
...
...
@@ -2189,12 +4107,20 @@ void call_matlab (
setup_output_args(function_name, plhs[i], A6, i);
setup_output_args(function_name, plhs[i], A7, i);
setup_output_args(function_name, plhs[i], A8, i);
setup_output_args(function_name, plhs[i], A9, i);
setup_output_args(function_name, plhs[i], A10, i);
setup_output_args(function_name, plhs[i], A11, i);
setup_output_args(function_name, plhs[i], A12, i);
setup_output_args(function_name, plhs[i], A13, i);
setup_output_args(function_name, plhs[i], A14, i);
setup_output_args(function_name, plhs[i], A15, i);
setup_output_args(function_name, plhs[i], A16, i);
setup_output_args(function_name, plhs[i], A17, i);
setup_output_args(function_name, plhs[i], A18, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename T1,
typename T2,
...
...
@@ -2204,7 +4130,17 @@ template <
typename T6,
typename T7,
typename T8,
typename
T9
typename T9,
typename T10,
typename T11,
typename T12,
typename T13,
typename T14,
typename T15,
typename T16,
typename T17,
typename T18,
typename T19
>
void call_matlab (
const std::string& function_name,
...
...
@@ -2216,11 +4152,21 @@ void call_matlab (
const T6& A6,
const T7& A7,
const T8& A8,
const
T9
&
A9
const T9& A9,
const T10& A10,
const T11& A11,
const T12& A12,
const T13& A13,
const T14& A14,
const T15& A15,
const T16& A16,
const T17& A17,
const T18& A18,
const T19& A19
)
{
using namespace mex_binding;
const
int
num_args
=
9
;
const int num_args =
1
9;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
...
...
@@ -2234,6 +4180,16 @@ void call_matlab (
setup_input_args(prhs[nrhs], A7, nrhs);
setup_input_args(prhs[nrhs], A8, nrhs);
setup_input_args(prhs[nrhs], A9, nrhs);
setup_input_args(prhs[nrhs], A10, nrhs);
setup_input_args(prhs[nrhs], A11, nrhs);
setup_input_args(prhs[nrhs], A12, nrhs);
setup_input_args(prhs[nrhs], A13, nrhs);
setup_input_args(prhs[nrhs], A14, nrhs);
setup_input_args(prhs[nrhs], A15, nrhs);
setup_input_args(prhs[nrhs], A16, nrhs);
setup_input_args(prhs[nrhs], A17, nrhs);
setup_input_args(prhs[nrhs], A18, nrhs);
setup_input_args(prhs[nrhs], A19, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
...
...
@@ -2248,11 +4204,20 @@ void call_matlab (
setup_output_args(function_name, plhs[i], A7, i);
setup_output_args(function_name, plhs[i], A8, i);
setup_output_args(function_name, plhs[i], A9, i);
setup_output_args(function_name, plhs[i], A10, i);
setup_output_args(function_name, plhs[i], A11, i);
setup_output_args(function_name, plhs[i], A12, i);
setup_output_args(function_name, plhs[i], A13, i);
setup_output_args(function_name, plhs[i], A14, i);
setup_output_args(function_name, plhs[i], A15, i);
setup_output_args(function_name, plhs[i], A16, i);
setup_output_args(function_name, plhs[i], A17, i);
setup_output_args(function_name, plhs[i], A18, i);
setup_output_args(function_name, plhs[i], A19, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
template <
typename T1,
typename T2,
...
...
@@ -2263,7 +4228,17 @@ template <
typename T7,
typename T8,
typename T9,
typename
T10
typename T10,
typename T11,
typename T12,
typename T13,
typename T14,
typename T15,
typename T16,
typename T17,
typename T18,
typename T19,
typename T20
>
void call_matlab (
const std::string& function_name,
...
...
@@ -2276,11 +4251,21 @@ void call_matlab (
const T7& A7,
const T8& A8,
const T9& A9,
const
T10
&
A10
const T10& A10,
const T11& A11,
const T12& A12,
const T13& A13,
const T14& A14,
const T15& A15,
const T16& A16,
const T17& A17,
const T18& A18,
const T19& A19,
const T20& A20
)
{
using namespace mex_binding;
const
int
num_args
=
1
0
;
const int num_args =
2
0;
mxArray* plhs[num_args] = {0};
mxArray* prhs[num_args] = {0};
...
...
@@ -2295,6 +4280,16 @@ void call_matlab (
setup_input_args(prhs[nrhs], A8, nrhs);
setup_input_args(prhs[nrhs], A9, nrhs);
setup_input_args(prhs[nrhs], A10, nrhs);
setup_input_args(prhs[nrhs], A11, nrhs);
setup_input_args(prhs[nrhs], A12, nrhs);
setup_input_args(prhs[nrhs], A13, nrhs);
setup_input_args(prhs[nrhs], A14, nrhs);
setup_input_args(prhs[nrhs], A15, nrhs);
setup_input_args(prhs[nrhs], A16, nrhs);
setup_input_args(prhs[nrhs], A17, nrhs);
setup_input_args(prhs[nrhs], A18, nrhs);
setup_input_args(prhs[nrhs], A19, nrhs);
setup_input_args(prhs[nrhs], A20, nrhs);
const int nlhs = num_args - nrhs;
call_matlab_for_real(nlhs,plhs,nrhs,prhs, function_name);
...
...
@@ -2310,6 +4305,16 @@ void call_matlab (
setup_output_args(function_name, plhs[i], A8, i);
setup_output_args(function_name, plhs[i], A9, i);
setup_output_args(function_name, plhs[i], A10, i);
setup_output_args(function_name, plhs[i], A11, i);
setup_output_args(function_name, plhs[i], A12, i);
setup_output_args(function_name, plhs[i], A13, i);
setup_output_args(function_name, plhs[i], A14, i);
setup_output_args(function_name, plhs[i], A15, i);
setup_output_args(function_name, plhs[i], A16, i);
setup_output_args(function_name, plhs[i], A17, i);
setup_output_args(function_name, plhs[i], A18, i);
setup_output_args(function_name, plhs[i], A19, i);
setup_output_args(function_name, plhs[i], A20, i);
free_callback_resources<T1>(nlhs,plhs,nrhs,prhs);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment