/** * file: Constructor.ccp * Author: Frank Dellaert **/ #include #include #include #include "utilities.h" #include "Constructor.h" using namespace std; /* ************************************************************************* */ string Constructor::matlab_wrapper_name(const string& className) { string str = "new_" + className + "_" + args.signature(); return str; } /* ************************************************************************* */ void Constructor::matlab_proxy_fragment(ofstream& ofs, const string& className) { ofs << " if nargin == " << args.size() << ", obj.self = " << matlab_wrapper_name(className) << "("; bool first = true; for(size_t i=0;i" << endl; ofs << "#include <" << className << ".h>" << endl; if (!nameSpace.empty()) ofs << "using namespace " << nameSpace << ";" << endl; ofs << "void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])" << endl; ofs << "{" << endl; ofs << " checkArguments(\"" << name << "\",nargout,nargin," << args.size() << ");" << endl; args.matlab_unwrap(ofs); // unwrap arguments ofs << " " << className << "* self = new " << className << "(" << args.names() << ");" << endl; ofs << " out[0] = wrap_constructed(self,\"" << className << "\");" << endl; ofs << "}" << endl; // close file ofs.close(); } /* ************************************************************************* */