MCPcopy Create free account
hub / github.com/davisking/dlib / call_mex_function

Function call_mex_function

dlib/matlab/mex_wrapper.cpp:2779–3037  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2777 typename funct
2778 >
2779 void call_mex_function (
2780 const funct& f,
2781 int nlhs, mxArray *plhs[],
2782 int nrhs, const mxArray *prhs[]
2783 )
2784 {
2785 const long expected_nrhs = funct_traits<funct>::num_inputs;
2786 const long expected_nlhs = funct_traits<funct>::num_outputs;
2787 const long expected_args = expected_nrhs + expected_nlhs;
2788
2789 long defaulted_args = 0;
2790
2791 #ifdef ARG_1_DEFAULT
2792 ++defaulted_args;
2793 // You can only set an argument's default value if it is an input argument.
2794 COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg1_type>::value);
2795 #ifndef ARG_2_DEFAULT
2796 // You can't define a default for argument 1 if you don't define one for argument 2 also.
2797 COMPILE_TIME_ASSERT(expected_args < 2);
2798 #endif
2799 COMPILE_TIME_ASSERT(1 <= expected_args); // You can't define a default for an argument that doesn't exist.
2800 #endif
2801 #ifdef ARG_2_DEFAULT
2802 ++defaulted_args;
2803 // You can only set an argument's default value if it is an input argument.
2804 COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg2_type>::value);
2805 #ifndef ARG_3_DEFAULT
2806 // You can't define a default for argument 2 if you don't define one for argument 3 also.
2807 COMPILE_TIME_ASSERT(expected_args < 3);
2808 #endif
2809 COMPILE_TIME_ASSERT(2 <= expected_args); // You can't define a default for an argument that doesn't exist.
2810 #endif
2811 #ifdef ARG_3_DEFAULT
2812 ++defaulted_args;
2813 // You can only set an argument's default value if it is an input argument.
2814 COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg3_type>::value);
2815 #ifndef ARG_4_DEFAULT
2816 // You can't define a default for argument 3 if you don't define one for argument 4 also.
2817 COMPILE_TIME_ASSERT(expected_args < 4);
2818 #endif
2819 COMPILE_TIME_ASSERT(3 <= expected_args); // You can't define a default for an argument that doesn't exist.
2820 #endif
2821 #ifdef ARG_4_DEFAULT
2822 ++defaulted_args;
2823 // You can only set an argument's default value if it is an input argument.
2824 COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg4_type>::value);
2825 #ifndef ARG_5_DEFAULT
2826 // You can't define a default for argument 4 if you don't define one for argument 5 also.
2827 COMPILE_TIME_ASSERT(expected_args < 5);
2828 #endif
2829 COMPILE_TIME_ASSERT(4 <= expected_args); // You can't define a default for an argument that doesn't exist.
2830 #endif
2831 #ifdef ARG_5_DEFAULT
2832 ++defaulted_args;
2833 // You can only set an argument's default value if it is an input argument.
2834 COMPILE_TIME_ASSERT(is_input_type<typename sig_traits<funct>::arg5_type>::value);
2835 #ifndef ARG_6_DEFAULT
2836 // You can't define a default for argument 5 if you don't define one for argument 6 also.

Callers 2

operator()Method · 0.85
mexFunctionFunction · 0.85

Calls 2

escape_percentFunction · 0.85
callitMethod · 0.45

Tested by

no test coverage detected