Split up into two calls

release/4.3a0
dellaert 2014-05-25 14:59:20 -04:00
parent 52cd200718
commit 9d9614d185
2 changed files with 23 additions and 7 deletions

View File

@ -151,6 +151,15 @@ void ArgumentList::emit_prototype(FileWriter& file, const string& name) const {
file.oss << ")";
}
/* ************************************************************************* */
void ArgumentList::emit_call(FileWriter& file, const ReturnValue& returnVal,
const string& wrapperName, int id, bool staticMethod) const {
returnVal.emit_matlab(file);
file.oss << wrapperName << "(" << id;
if (!staticMethod)
file.oss << ", this";
file.oss << ", varargin{:});\n";
}
/* ************************************************************************* */
void ArgumentList::emit_conditional_call(FileWriter& file,
const ReturnValue& returnVal, const string& wrapperName, int id,
bool staticMethod) const {
@ -171,11 +180,7 @@ void ArgumentList::emit_conditional_call(FileWriter& file,
// output call to C++ wrapper
file.oss << " ";
returnVal.emit_matlab(file);
file.oss << wrapperName << "(" << id;
if (!staticMethod)
file.oss << ", this";
file.oss << ", varargin{:});\n";
emit_call(file, returnVal, wrapperName, id, staticMethod);
}
/* ************************************************************************* */

View File

@ -77,13 +77,24 @@ struct ArgumentList: public std::vector<Argument> {
void emit_prototype(FileWriter& file, const std::string& name) const;
/**
* emit conditional MATLAB call (checking arguments first)
* emit emit MATLAB call to wrapper
* @param file output stream
* @param returnVal the return value
* @param wrapperName of method or function
* @param staticMethod flag to emit "this" in call
*/
void emit_call(FileWriter& file, const ReturnValue& returnVal,
const std::string& wrapperName, int id, bool staticMethod = false) const;
/**
* emit conditional MATLAB call to wrapper (checking arguments first)
* @param file output stream
* @param returnVal the return value
* @param wrapperName of method or function
* @param staticMethod flag to emit "this" in call
*/
void emit_conditional_call(FileWriter& file, const ReturnValue& returnVal,
const std::string& wrapperName, int id, bool staticMethod=false) const;
const std::string& wrapperName, int id, bool staticMethod = false) const;
};
} // \namespace wrap