Implemented method overloading in matlab wrapper, made static functions static in matlab classes

release/4.3a0
Richard Roberts 2012-07-05 14:05:00 +00:00
parent 8ab18498ad
commit f774a380ec
7 changed files with 248 additions and 100 deletions

View File

@ -70,7 +70,7 @@ void Class::matlab_proxy(const string& classFile, const string& wrapperName, Fil
functionNames.push_back(wrapFunctionName); functionNames.push_back(wrapFunctionName);
} }
proxyFile.oss << " else\n"; proxyFile.oss << " else\n";
proxyFile.oss << " error('" << matlabName << " constructor failed');" << endl; proxyFile.oss << " error('Arguments do not match any overload of " << matlabName << " constructor');" << endl;
proxyFile.oss << " end\n"; proxyFile.oss << " end\n";
proxyFile.oss << " end\n\n"; proxyFile.oss << " end\n\n";
@ -88,14 +88,23 @@ void Class::matlab_proxy(const string& classFile, const string& wrapperName, Fil
proxyFile.oss << " function disp(obj), obj.display; end\n\n"; proxyFile.oss << " function disp(obj), obj.display; end\n\n";
// Methods // Methods
BOOST_FOREACH(Method m, methods) { BOOST_FOREACH(const Methods::value_type& name_m, methods) {
const int id = functionNames.size(); const Method& m = name_m.second;
m.proxy_fragment(proxyFile, wrapperName, id); m.proxy_wrapper_fragments(proxyFile, wrapperFile, cppName, matlabName, wrapperName, using_namespaces, functionNames);
proxyFile.oss << "\n";
wrapperFile.oss << "\n";
}
proxyFile.oss << " end\n";
proxyFile.oss << "\n";
proxyFile.oss << " methods(Static = true)\n";
// Static methods
BOOST_FOREACH(const StaticMethods::value_type& name_m, static_methods) {
const StaticMethod& m = name_m.second;
m.proxy_wrapper_fragments(proxyFile, wrapperFile, cppName, matlabName, wrapperName, using_namespaces, functionNames);
proxyFile.oss << "\n"; proxyFile.oss << "\n";
const string wrapFunctionName = m.wrapper_fragment(wrapperFile,
cppName, matlabName, id, using_namespaces);
wrapperFile.oss << "\n"; wrapperFile.oss << "\n";
functionNames.push_back(wrapFunctionName);
} }
proxyFile.oss << " end" << endl; proxyFile.oss << " end" << endl;
@ -105,18 +114,6 @@ void Class::matlab_proxy(const string& classFile, const string& wrapperName, Fil
proxyFile.emit(true); proxyFile.emit(true);
} }
/* ************************************************************************* */
void Class::matlab_static_methods(const string& toolboxPath, const string& wrapperName,
FileWriter& wrapperFile, vector<string>& functionNames) const {
string matlabName = qualifiedName(), cppName = qualifiedName("::");
BOOST_FOREACH(const StaticMethod& m, static_methods) {
const int id = functionNames.size();
m.proxy_fragment(toolboxPath, matlabName, wrapperName, id);
const string wrapFunction = m.wrapper_fragment(wrapperFile, matlabName, cppName, id, using_namespaces);
functionNames.push_back(wrapFunction);
}
}
/* ************************************************************************* */ /* ************************************************************************* */
string Class::qualifiedName(const string& delim) const { string Class::qualifiedName(const string& delim) const {
string result; string result;

View File

@ -19,7 +19,7 @@
#pragma once #pragma once
#include <string> #include <string>
#include <boost/bimap.hpp> #include <map>
#include "Constructor.h" #include "Constructor.h"
#include "Deconstructor.h" #include "Deconstructor.h"
@ -30,13 +30,16 @@ namespace wrap {
/// Class has name, constructors, methods /// Class has name, constructors, methods
struct Class { struct Class {
typedef std::map<std::string, Method> Methods;
typedef std::map<std::string, StaticMethod> StaticMethods;
/// Constructor creates an empty class /// Constructor creates an empty class
Class(bool verbose=true) : verbose_(verbose) {} Class(bool verbose=true) : verbose_(verbose) {}
// Then the instance variables are set directly by the Module constructor // Then the instance variables are set directly by the Module constructor
std::string name; ///< Class name std::string name; ///< Class name
std::vector<Method> methods; ///< Class methods Methods methods; ///< Class methods
std::vector<StaticMethod> static_methods; ///< Static methods StaticMethods static_methods; ///< Static methods
std::vector<std::string> namespaces; ///< Stack of namespaces std::vector<std::string> namespaces; ///< Stack of namespaces
std::vector<std::string> using_namespaces;///< default namespaces std::vector<std::string> using_namespaces;///< default namespaces
std::vector<std::string> includes; ///< header include overrides std::vector<std::string> includes; ///< header include overrides
@ -47,8 +50,6 @@ struct Class {
// And finally MATLAB code is emitted, methods below called by Module::matlab_code // And finally MATLAB code is emitted, methods below called by Module::matlab_code
void matlab_proxy(const std::string& classFile, const std::string& wrapperName, void matlab_proxy(const std::string& classFile, const std::string& wrapperName,
FileWriter& wrapperFile, std::vector<std::string>& functionNames) const; ///< emit proxy class FileWriter& wrapperFile, std::vector<std::string>& functionNames) const; ///< emit proxy class
void matlab_static_methods(const std::string& toolboxPath, const std::string& wrapperName,
FileWriter& wrapperFile, std::vector<std::string>& functionNames) const; ///< emit static method wrappers
std::string qualifiedName(const std::string& delim = "") const; ///< creates a namespace-qualified name, optional delimiter std::string qualifiedName(const std::string& delim = "") const; ///< creates a namespace-qualified name, optional delimiter
private: private:

View File

@ -27,24 +27,78 @@ using namespace std;
using namespace wrap; using namespace wrap;
/* ************************************************************************* */ /* ************************************************************************* */
void Method::proxy_fragment(FileWriter& file, const std::string& wrapperName, const int id) const { void Method::addOverload(bool verbose, bool is_const, const std::string& name,
const ArgumentList& args, const ReturnValue& retVal) {
this->verbose_ = verbose;
this->is_const_ = is_const;
this->name = name;
this->argLists.push_back(args);
this->returnVals.push_back(retVal);
}
string output; void Method::proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wrapperFile,
if(returnVal.isPair) const string& cppClassName,
output = "[ r1 r2 ] = "; const string& matlabClassName,
else if(returnVal.category1 == ReturnValue::VOID) const string& wrapperName,
output = ""; const vector<string>& using_namespaces,
else vector<string>& functionNames) const {
output = "r = ";
file.oss << " function " << output << name << "(varargin)\n"; proxyFile.oss << " function varargout = " << name << "(self, varargin)\n";
file.oss << " " << output << wrapperName << "(" << id << ", varargin{:});\n";
file.oss << " end\n"; 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...
proxyFile.oss << " " << (overload==0?"":"else") << "if length(varargin) == " << nrArgs;
if (nrArgs>0) proxyFile.oss << " && ";
// ...and their types
bool first = true;
for(size_t i=0;i<nrArgs;i++) {
if (!first) proxyFile.oss << " && ";
proxyFile.oss << "isa(varargin{" << i+1 << "},'" << args[i].matlabClass() << "')";
first=false;
}
proxyFile.oss << "\n";
// output call to C++ wrapper
string output;
if(returnVal.isPair)
output = "[ varargout{1} varargout{2} ] = ";
else if(returnVal.category1 == ReturnValue::VOID)
output = "";
else
output = "varargout{1} = ";
proxyFile.oss << " " << output << wrapperName << "(" << id << ", self, varargin{:});\n";
// Output C++ wrapper code
const string wrapFunctionName = wrapper_fragment(
wrapperFile, cppClassName, matlabClassName, overload, id, using_namespaces);
// Add to function list
functionNames.push_back(wrapFunctionName);
}
proxyFile.oss << " else\n";
proxyFile.oss << " error('Arguments do not match any overload of function " <<
matlabClassName << "." << name << "');" << endl;
proxyFile.oss << " end\n";
proxyFile.oss << " end\n";
} }
/* ************************************************************************* */ /* ************************************************************************* */
string Method::wrapper_fragment(FileWriter& file, string Method::wrapper_fragment(FileWriter& file,
const string& cppClassName, const string& cppClassName,
const string& matlabClassName, const string& matlabClassName,
int overload,
int id, int id,
const vector<string>& using_namespaces) const { const vector<string>& using_namespaces) const {
@ -52,6 +106,9 @@ string Method::wrapper_fragment(FileWriter& file,
const string wrapFunctionName = matlabClassName + "_" + name + "_" + boost::lexical_cast<string>(id); const string wrapFunctionName = matlabClassName + "_" + name + "_" + boost::lexical_cast<string>(id);
const ArgumentList& args = argLists[overload];
const ReturnValue& returnVal = returnVals[overload];
// call // call
file.oss << "void " << wrapFunctionName << "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n"; file.oss << "void " << wrapFunctionName << "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n";
// start // start

View File

@ -36,16 +36,27 @@ struct Method {
bool verbose_; bool verbose_;
bool is_const_; bool is_const_;
std::string name; std::string name;
ArgumentList args; std::vector<ArgumentList> argLists;
ReturnValue returnVal; std::vector<ReturnValue> returnVals;
// The first time this function is called, it initializes the class members
// with those in rhs, but in subsequent calls it adds additional argument
// lists as function overloads.
void addOverload(bool verbose, bool is_const, const std::string& name,
const ArgumentList& args, const ReturnValue& retVal);
// MATLAB code generation // MATLAB code generation
// classPath is class directory, e.g., ../matlab/@Point2 // classPath is class directory, e.g., ../matlab/@Point2
void proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wrapperFile,
const std::string& cppClassName, const std::string& matlabClassName,
const std::string& wrapperName, const std::vector<std::string>& using_namespaces,
std::vector<std::string>& functionNames) const;
void proxy_fragment(FileWriter& file, const std::string& wrapperName, const int id) const; private:
std::string wrapper_fragment(FileWriter& file, std::string wrapper_fragment(FileWriter& file,
const std::string& cppClassName, const std::string& cppClassName,
const std::string& matlabClassname, const std::string& matlabClassname,
int overload,
int id, int id,
const std::vector<std::string>& using_namespaces) const; ///< cpp wrapper const std::vector<std::string>& using_namespaces) const; ///< cpp wrapper
}; };

View File

@ -24,6 +24,8 @@
//#define BOOST_SPIRIT_DEBUG //#define BOOST_SPIRIT_DEBUG
#include <boost/spirit/include/classic_confix.hpp> #include <boost/spirit/include/classic_confix.hpp>
#include <boost/spirit/include/classic_clear_actor.hpp> #include <boost/spirit/include/classic_clear_actor.hpp>
#include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
@ -34,6 +36,7 @@
using namespace std; using namespace std;
using namespace wrap; using namespace wrap;
using namespace BOOST_SPIRIT_CLASSIC_NS; using namespace BOOST_SPIRIT_CLASSIC_NS;
namespace bl = boost::lambda;
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
typedef rule<BOOST_SPIRIT_CLASSIC_NS::phrase_scanner_t> Rule; typedef rule<BOOST_SPIRIT_CLASSIC_NS::phrase_scanner_t> Rule;
@ -51,13 +54,15 @@ Module::Module(const string& interfacePath,
{ {
// these variables will be imperatively updated to gradually build [cls] // these variables will be imperatively updated to gradually build [cls]
// The one with postfix 0 are used to reset the variables after parse. // The one with postfix 0 are used to reset the variables after parse.
string methodName, methodName0;
bool isConst, isConst0 = false;
ReturnValue retVal0, retVal; ReturnValue retVal0, retVal;
Argument arg0, arg; Argument arg0, arg;
ArgumentList args0, args; ArgumentList args0, args;
vector<string> arg_dup; ///keep track of duplicates vector<string> arg_dup; ///keep track of duplicates
Constructor constructor0(enable_verbose), constructor(enable_verbose); Constructor constructor0(enable_verbose), constructor(enable_verbose);
Deconstructor deconstructor0(enable_verbose), deconstructor(enable_verbose); Deconstructor deconstructor0(enable_verbose), deconstructor(enable_verbose);
Method method0(enable_verbose), method(enable_verbose); //Method method0(enable_verbose), method(enable_verbose);
StaticMethod static_method0(enable_verbose), static_method(enable_verbose); StaticMethod static_method0(enable_verbose), static_method(enable_verbose);
Class cls0(enable_verbose),cls(enable_verbose); Class cls0(enable_verbose),cls(enable_verbose);
vector<string> namespaces, /// current namespace tag vector<string> namespaces, /// current namespace tag
@ -155,27 +160,35 @@ Module::Module(const string& interfacePath,
Rule methodName_p = lexeme_d[lower_p >> *(alnum_p | '_')]; Rule methodName_p = lexeme_d[lower_p >> *(alnum_p | '_')];
Rule method_p = Rule method_p =
(returnType_p >> methodName_p[assign_a(method.name)] >> (returnType_p >> methodName_p[assign_a(methodName)] >>
'(' >> argumentList_p >> ')' >> '(' >> argumentList_p >> ')' >>
!str_p("const")[assign_a(method.is_const_,true)] >> ';' >> *comments_p) !str_p("const")[assign_a(isConst,true)] >> ';' >> *comments_p)
[assign_a(method.args,args)] [bl::bind(&Method::addOverload,
bl::var(cls.methods)[bl::var(methodName)],
verbose,
bl::var(isConst),
bl::var(methodName),
bl::var(args),
bl::var(retVal))]
[assign_a(isConst,isConst0)]
[assign_a(methodName,methodName0)]
[assign_a(args,args0)] [assign_a(args,args0)]
[assign_a(method.returnVal,retVal)] [assign_a(retVal,retVal0)];
[assign_a(retVal,retVal0)]
[push_back_a(cls.methods, method)]
[assign_a(method,method0)];
Rule staticMethodName_p = lexeme_d[(upper_p | lower_p) >> *(alnum_p | '_')]; Rule staticMethodName_p = lexeme_d[(upper_p | lower_p) >> *(alnum_p | '_')];
Rule static_method_p = Rule static_method_p =
(str_p("static") >> returnType_p >> staticMethodName_p[assign_a(static_method.name)] >> (str_p("static") >> returnType_p >> staticMethodName_p[assign_a(methodName)] >>
'(' >> argumentList_p >> ')' >> ';' >> *comments_p) '(' >> argumentList_p >> ')' >> ';' >> *comments_p)
[assign_a(static_method.args,args)] [bl::bind(&StaticMethod::addOverload,
bl::var(cls.static_methods)[bl::var(methodName)],
verbose,
bl::var(methodName),
bl::var(args),
bl::var(retVal))]
[assign_a(methodName,methodName0)]
[assign_a(args,args0)] [assign_a(args,args0)]
[assign_a(static_method.returnVal,retVal)] [assign_a(retVal,retVal0)];
[assign_a(retVal,retVal0)]
[push_back_a(cls.static_methods, static_method)]
[assign_a(static_method,static_method0)];
Rule functions_p = constructor_p | method_p | static_method_p; Rule functions_p = constructor_p | method_p | static_method_p;
@ -262,26 +275,33 @@ Module::Module(const string& interfacePath,
/* ************************************************************************* */ /* ************************************************************************* */
template<class T> template<class T>
void verifyArguments(const vector<string>& validArgs, const vector<T>& vt) { void verifyArguments(const vector<string>& validArgs, const map<string,T>& vt) {
BOOST_FOREACH(const T& t, vt) { typedef map<string,T>::value_type Name_Method;
BOOST_FOREACH(Argument arg, t.args) { BOOST_FOREACH(const Name_Method& name_method, vt) {
string fullType = arg.qualifiedType("::"); const T& t = name_method.second;
if(find(validArgs.begin(), validArgs.end(), fullType) BOOST_FOREACH(const ArgumentList& argList, t.argLists) {
== validArgs.end()) BOOST_FOREACH(Argument arg, argList) {
throw DependencyMissing(fullType, t.name); string fullType = arg.qualifiedType("::");
if(find(validArgs.begin(), validArgs.end(), fullType)
== validArgs.end())
throw DependencyMissing(fullType, t.name);
}
} }
} }
} }
/* ************************************************************************* */ /* ************************************************************************* */
template<class T> template<class T>
void verifyReturnTypes(const vector<string>& validtypes, const vector<T>& vt) { void verifyReturnTypes(const vector<string>& validtypes, const map<string,T>& vt) {
BOOST_FOREACH(const T& t, vt) { typedef map<string,T>::value_type Name_Method;
const ReturnValue& retval = t.returnVal; BOOST_FOREACH(const Name_Method& name_method, vt) {
if (find(validtypes.begin(), validtypes.end(), retval.qualifiedType1("::")) == validtypes.end()) const T& t = name_method.second;
throw DependencyMissing(retval.qualifiedType1("::"), t.name); BOOST_FOREACH(const ReturnValue& retval, t.returnVals) {
if (retval.isPair && find(validtypes.begin(), validtypes.end(), retval.qualifiedType2("::")) == validtypes.end()) if (find(validtypes.begin(), validtypes.end(), retval.qualifiedType1("::")) == validtypes.end())
throw DependencyMissing(retval.qualifiedType2("::"), t.name); throw DependencyMissing(retval.qualifiedType1("::"), t.name);
if (retval.isPair && find(validtypes.begin(), validtypes.end(), retval.qualifiedType2("::")) == validtypes.end())
throw DependencyMissing(retval.qualifiedType2("::"), t.name);
}
} }
} }
@ -350,7 +370,7 @@ void Module::matlab_code(const string& toolboxPath, const string& headerPath) co
// generate proxy classes and wrappers // generate proxy classes and wrappers
BOOST_FOREACH(Class cls, classes) { BOOST_FOREACH(Class cls, classes) {
// create proxy class // create proxy class and wrapper code
string classFile = toolboxPath + "/" + cls.qualifiedName() + ".m"; string classFile = toolboxPath + "/" + cls.qualifiedName() + ".m";
cls.matlab_proxy(classFile, wrapperName, wrapperFile, functionNames); cls.matlab_proxy(classFile, wrapperName, wrapperFile, functionNames);
@ -362,9 +382,6 @@ void Module::matlab_code(const string& toolboxPath, const string& headerPath) co
// verify function return types // verify function return types
verifyReturnTypes<StaticMethod>(validTypes, cls.static_methods); verifyReturnTypes<StaticMethod>(validTypes, cls.static_methods);
verifyReturnTypes<Method>(validTypes, cls.methods); verifyReturnTypes<Method>(validTypes, cls.methods);
// create constructor and method wrappers
cls.matlab_static_methods(toolboxPath, wrapperName, wrapperFile, functionNames);
} }
// finish wrapper file // finish wrapper file

View File

@ -27,34 +27,91 @@
using namespace std; using namespace std;
using namespace wrap; using namespace wrap;
/* ************************************************************************* */ /* ************************************************************************* */
void StaticMethod::proxy_fragment(const string& toolboxPath, const string& matlabClassName, const std::string& wrapperName, const int id) const { void StaticMethod::addOverload(bool verbose, const std::string& name,
const ArgumentList& args, const ReturnValue& retVal) {
this->verbose = verbose;
this->name = name;
this->argLists.push_back(args);
this->returnVals.push_back(retVal);
}
const string full_name = matlabClassName + "_" + name; void StaticMethod::proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wrapperFile,
FileWriter file(toolboxPath + "/" + full_name + ".m", verbose, "%"); const string& cppClassName,
const string& matlabClassName,
const string& wrapperName,
const vector<string>& using_namespaces,
vector<string>& functionNames) const {
string output; string upperName = name; upperName[0] = std::toupper(upperName[0], std::locale());
if(returnVal.isPair)
output = "[ r1 r2 ] = ";
else if(returnVal.category1 == ReturnValue::VOID)
output = "";
else
output = "r = ";
file.oss << "function " << output << full_name << "(varargin)\n";
file.oss << " " << output << wrapperName << "(" << id << ", varargin{:});\n";
file.oss << "end\n";
file.emit(true); proxyFile.oss << " function varargout = " << upperName << "(varargin)\n";
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...
proxyFile.oss << " " << (overload==0?"":"else") << "if length(varargin) == " << nrArgs;
if (nrArgs>0) proxyFile.oss << " && ";
// ...and their types
bool first = true;
for(size_t i=0;i<nrArgs;i++) {
if (!first) proxyFile.oss << " && ";
proxyFile.oss << "isa(varargin{" << i+1 << "},'" << args[i].matlabClass() << "')";
first=false;
}
proxyFile.oss << "\n";
// output call to C++ wrapper
string output;
if(returnVal.isPair)
output = "[ varargout{1} varargout{2} ] = ";
else if(returnVal.category1 == ReturnValue::VOID)
output = "";
else
output = "varargout{1} = ";
proxyFile.oss << " " << output << wrapperName << "(" << id << ", varargin{:});\n";
// Output C++ wrapper code
const string wrapFunctionName = wrapper_fragment(
wrapperFile, cppClassName, matlabClassName, overload, id, using_namespaces);
// Add to function list
functionNames.push_back(wrapFunctionName);
}
proxyFile.oss << " else\n";
proxyFile.oss << " error('Arguments do not match any overload of function " <<
matlabClassName << "." << upperName << "');" << endl;
proxyFile.oss << " end\n";
proxyFile.oss << " end\n";
} }
/* ************************************************************************* */ /* ************************************************************************* */
string StaticMethod::wrapper_fragment(FileWriter& file, string StaticMethod::wrapper_fragment(FileWriter& file,
const string& matlabClassName, const string& cppClassName, const string& cppClassName,
int id, const vector<string>& using_namespaces) const { const string& matlabClassName,
int overload,
const string full_name = matlabClassName + "_" + name; int id,
const vector<string>& using_namespaces) const {
// generate code
const string wrapFunctionName = matlabClassName + "_" + name + "_" + boost::lexical_cast<string>(id); const string wrapFunctionName = matlabClassName + "_" + name + "_" + boost::lexical_cast<string>(id);
const ArgumentList& args = argLists[overload];
const ReturnValue& returnVal = returnVals[overload];
// call // call
file.oss << "void " << wrapFunctionName << "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n"; file.oss << "void " << wrapFunctionName << "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n";
// start // start
@ -76,7 +133,7 @@ string StaticMethod::wrapper_fragment(FileWriter& file,
// check arguments // check arguments
// NOTE: for static functions, there is no object passed // NOTE: for static functions, there is no object passed
file.oss << " checkArguments(\"" << full_name << "\",nargout,nargin," << args.size() << ");\n"; file.oss << " checkArguments(\"" << matlabClassName << "." << name << "\",nargout,nargin," << args.size() << ");\n";
// unwrap arguments, see Argument.cpp // unwrap arguments, see Argument.cpp
args.matlab_unwrap(file,0); // We start at 0 because there is no self object args.matlab_unwrap(file,0); // We start at 0 because there is no self object

View File

@ -36,21 +36,29 @@ struct StaticMethod {
// Then the instance variables are set directly by the Module constructor // Then the instance variables are set directly by the Module constructor
bool verbose; bool verbose;
std::string name; std::string name;
ArgumentList args; std::vector<ArgumentList> argLists;
ReturnValue returnVal; std::vector<ReturnValue> returnVals;
// The first time this function is called, it initializes the class members
// with those in rhs, but in subsequent calls it adds additional argument
// lists as function overloads.
void addOverload(bool verbose, const std::string& name,
const ArgumentList& args, const ReturnValue& retVal);
// MATLAB code generation // MATLAB code generation
// toolboxPath is the core toolbox directory, e.g., ../matlab // classPath is class directory, e.g., ../matlab/@Point2
// NOTE: static functions are not inside the class, and void proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wrapperFile,
// are created with [ClassName]_[FunctionName]() format const std::string& cppClassName, const std::string& matlabClassName,
const std::string& wrapperName, const std::vector<std::string>& using_namespaces,
std::vector<std::string>& functionNames) const;
void proxy_fragment(const std::string& toolboxPath, const std::string& matlabClassName, private:
const std::string& wrapperName, const int id) const; ///< m-file
std::string wrapper_fragment(FileWriter& file, std::string wrapper_fragment(FileWriter& file,
const std::string& matlabClassName, const std::string& cppClassName,
const std::string& cppClassName, const std::string& matlabClassname,
int overload,
int id, int id,
const std::vector<std::string>& using_namespaces) const; ///< cpp wrapper const std::vector<std::string>& using_namespaces) const; ///< cpp wrapper
}; };
} // \namespace wrap } // \namespace wrap