static property is known by function! Makes so much more sense...
parent
0eaabd700b
commit
0261c59063
|
@ -55,10 +55,10 @@ bool Function::initializeOrCheck(const string& name, const Qualified& instName,
|
|||
|
||||
/* ************************************************************************* */
|
||||
void Function::emit_call(FileWriter& proxyFile, const ReturnValue& returnVal,
|
||||
const string& wrapperName, int id, bool staticMethod) const {
|
||||
const string& wrapperName, int id) const {
|
||||
returnVal.emit_matlab(proxyFile);
|
||||
proxyFile.oss << wrapperName << "(" << id;
|
||||
if (!staticMethod)
|
||||
if (!isStatic())
|
||||
proxyFile.oss << ", this";
|
||||
proxyFile.oss << ", varargin{:});\n";
|
||||
}
|
||||
|
@ -66,14 +66,14 @@ void Function::emit_call(FileWriter& proxyFile, const ReturnValue& returnVal,
|
|||
/* ************************************************************************* */
|
||||
void Function::emit_conditional_call(FileWriter& proxyFile,
|
||||
const ReturnValue& returnVal, const ArgumentList& args,
|
||||
const string& wrapperName, int id, bool staticMethod) const {
|
||||
const string& wrapperName, int id) const {
|
||||
|
||||
// Check all arguments
|
||||
args.proxy_check_arguments(proxyFile);
|
||||
|
||||
// output call to C++ wrapper
|
||||
proxyFile.oss << " ";
|
||||
emit_call(proxyFile, returnVal, wrapperName, id, staticMethod);
|
||||
emit_call(proxyFile, returnVal, wrapperName, id);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
|
|
@ -44,6 +44,11 @@ public:
|
|||
return name_;
|
||||
}
|
||||
|
||||
/// Only Methods are non-static
|
||||
virtual bool isStatic() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string matlabName() const {
|
||||
if (templateArgValue_.empty())
|
||||
return name_;
|
||||
|
@ -53,12 +58,12 @@ public:
|
|||
|
||||
/// Emit function call to MATLAB (no argument checking)
|
||||
void emit_call(FileWriter& proxyFile, const ReturnValue& returnVal,
|
||||
const std::string& wrapperName, int id, bool staticMethod) const;
|
||||
const std::string& wrapperName, int id) const;
|
||||
|
||||
/// Emit checking arguments and function call to MATLAB
|
||||
void emit_conditional_call(FileWriter& proxyFile,
|
||||
const ReturnValue& returnVal, const ArgumentList& args,
|
||||
const std::string& wrapperName, int id, bool staticMethod) const;
|
||||
const std::string& wrapperName, int id) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -80,8 +80,7 @@ void GlobalFunction::generateSingleFunction(const string& toolboxPath,
|
|||
|
||||
// Output proxy matlab code
|
||||
mfunctionFile.oss << " " << (i == 0 ? "" : "else");
|
||||
emit_conditional_call(mfunctionFile, returnVal, args, wrapperName, id,
|
||||
true); // true omits "this"
|
||||
emit_conditional_call(mfunctionFile, returnVal, args, wrapperName, id);
|
||||
|
||||
// Output C++ wrapper code
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ void MethodBase::proxy_wrapper_fragments(FileWriter& proxyFile,
|
|||
// TODO: document why is it OK to not check arguments in this case
|
||||
proxyFile.oss << " ";
|
||||
const int id = (int) functionNames.size();
|
||||
emit_call(proxyFile, returnValue(0), wrapperName, id, isStatic());
|
||||
emit_call(proxyFile, returnValue(0), wrapperName, id);
|
||||
|
||||
// Output C++ wrapper code
|
||||
const string wrapFunctionName = wrapper_fragment(wrapperFile, cppClassName,
|
||||
|
@ -71,7 +71,7 @@ void MethodBase::proxy_wrapper_fragments(FileWriter& proxyFile,
|
|||
proxyFile.oss << " " << (i == 0 ? "" : "else");
|
||||
const int id = (int) functionNames.size();
|
||||
emit_conditional_call(proxyFile, returnValue(i), argumentList(i),
|
||||
wrapperName, id, isStatic());
|
||||
wrapperName, id);
|
||||
|
||||
// Output C++ wrapper code
|
||||
const string wrapFunctionName = wrapper_fragment(wrapperFile,
|
||||
|
|
|
@ -28,8 +28,6 @@ struct MethodBase: public FullyOverloadedFunction {
|
|||
|
||||
typedef const std::string& Str;
|
||||
|
||||
virtual bool isStatic() const = 0;
|
||||
|
||||
// emit a list of comments, one for each overload
|
||||
void comment_fragment(FileWriter& proxyFile) const {
|
||||
SignatureOverloads::comment_fragment(proxyFile, matlabName());
|
||||
|
|
|
@ -28,10 +28,6 @@ struct StaticMethod: public MethodBase {
|
|||
|
||||
typedef const std::string& Str;
|
||||
|
||||
virtual bool isStatic() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const StaticMethod& m) {
|
||||
for (size_t i = 0; i < m.nrOverloads(); i++)
|
||||
os << "static " << m.returnVals_[i] << " " << m.name_ << m.argLists_[i];
|
||||
|
|
Loading…
Reference in New Issue