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