opencv/modules/matlab/generator/templates/template_function_base.cpp

48 lines
1.4 KiB
C++
Raw Normal View History

{% import 'functional.cpp' as functional %}
/*
* file: {{fun.name}}.cpp
* author: A trusty code generator
2013-03-18 10:37:42 +08:00
* date: {{time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())}}
*
* This file was autogenerated, do not modify.
* See LICENCE for full modification and redistribution details.
2013-03-18 10:37:42 +08:00
* Copyright {{time.strftime("%Y", time.localtime())}} The OpenCV Foundation
*/
#include "mex.h"
#include "bridge.hpp"
#include <string>
#include <vector>
#include <exception>
#include <opencv2/{{ns}}.hpp>
{% block includes %}
{% endblock %}
using namespace std;
using namespace cv;
/*
* {{ fun.name }}
2013-03-18 08:35:43 +08:00
* Gateway routine
* nlhs - number of return arguments
* plhs - pointers to return arguments
* nrhs - number of input arguments
* prhs - pointers to input arguments
*/
void mexFunction(int nlhs, mxArray* plhs[],
int nrhs, const mxArray* prhs[]) {
// assertions
mxAssert(nrhs >= {{fun.req|length - fun.req|noutputs}}, "Too few required input arguments specified");
mxAssert(nrhs <= {{fun.req|length + fun.opt|length - fun.req|noutputs - fun.opt|noutputs}}, "Too many input arguments specified");
mxAssert(nlhs <= {{fun.ret|length + fun.req|noutputs + fun.opt|noutputs}}, "Too many output arguments specified");
// setup
vector<Bridge> inputs(plhs, plhs+nrhs);
vector<Bridge> outputs(nlhs);
{{ fun }}
{{ functional.generate(fun) }}
// setdown
}