Now using emit_conditional_call (changed indenting)

release/4.3a0
dellaert 2014-05-25 16:28:39 -04:00
parent 925f23515d
commit 5e9632e781
2 changed files with 11 additions and 30 deletions

View File

@ -84,32 +84,13 @@ void GlobalFunction::generateSingleFunction(const std::string& toolboxPath,
for (size_t overload = 0; overload < argLists.size(); ++overload) {
const ArgumentList& args = argLists[overload];
const ReturnValue& returnVal = returnVals[overload];
size_t nrArgs = args.size();
const int id = functionNames.size();
// Output proxy matlab code
// check for number of arguments...
mfunctionFile.oss << (overload == 0 ? "" : "else")
<< "if length(varargin) == " << nrArgs;
if (nrArgs > 0)
mfunctionFile.oss << " && ";
// ...and their types
bool first = true;
for (size_t i = 0; i < nrArgs; i++) {
if (!first)
mfunctionFile.oss << " && ";
mfunctionFile.oss << "isa(varargin{" << i + 1 << "},'"
<< args[i].matlabClass(".") << "')";
first = false;
}
mfunctionFile.oss << "\n";
// output call to C++ wrapper
mfunctionFile.oss << " ";
returnVal.emit_matlab(mfunctionFile);
mfunctionFile.oss << wrapperName << "(" << id << ", varargin{:});\n";
mfunctionFile.oss << " " << (overload == 0 ? "" : "else");
argLists[overload].emit_conditional_call(mfunctionFile,
returnVals[overload], wrapperName, id, true); // true omits "this"
// Output C++ wrapper code