fixes for two word args
parent
ddbea256af
commit
fb00f4b834
|
@ -59,7 +59,8 @@ void Class::matlab_proxy(const string& classFile) const {
|
|||
// deconstructor
|
||||
file.oss << " function delete(obj)" << endl;
|
||||
file.oss << " if obj.self ~= 0" << endl;
|
||||
file.oss << " fprintf(1,'MATLAB class deleting %x',obj.self);" << endl;
|
||||
//TODO: Add verbosity flag
|
||||
//file.oss << " fprintf(1,'MATLAB class deleting %x',obj.self);" << endl;
|
||||
file.oss << " new_" << matlabName << "_(obj.self);" << endl;
|
||||
file.oss << " obj.self = 0;" << endl;
|
||||
file.oss << " end" << endl;
|
||||
|
|
|
@ -129,7 +129,7 @@ void Constructor::matlab_wrapper(const string& toolboxPath,
|
|||
file.oss << " if(nargin > 1) {" << endl;
|
||||
file.oss << " collector.insert(self);" << endl;
|
||||
//TODO: Add verbosity flag
|
||||
file.oss << " std::cout << \"Collected\" << collector.size() << std::endl;" << endl;
|
||||
//file.oss << " std::cout << \"Collected\" << collector.size() << std::endl;" << endl;
|
||||
file.oss << " }" << endl;
|
||||
file.oss << " else if(collector.erase(self))" << endl;
|
||||
file.oss << " delete self;" << endl;
|
||||
|
|
|
@ -63,11 +63,14 @@ void Method::matlab_wrapper(const string& classPath,
|
|||
|
||||
if(returnVal.isPair)
|
||||
{
|
||||
file.oss << "typedef boost::shared_ptr<" << returnVal.qualifiedType1("::") << "> Shared" << returnVal.type1 << ";"<< endl;
|
||||
file.oss << "typedef boost::shared_ptr<" << returnVal.qualifiedType2("::") << "> Shared" << returnVal.type2 << ";"<< endl;
|
||||
if(returnVal.category1 == ReturnValue::CLASS)
|
||||
file.oss << "typedef boost::shared_ptr<" << returnVal.qualifiedType1("::") << "> Shared" << returnVal.type1 << ";"<< endl;
|
||||
if(returnVal.category2 == ReturnValue::CLASS)
|
||||
file.oss << "typedef boost::shared_ptr<" << returnVal.qualifiedType2("::") << "> Shared" << returnVal.type2 << ";"<< endl;
|
||||
}
|
||||
else
|
||||
file.oss << "typedef boost::shared_ptr<" << returnVal.qualifiedType1("::") << "> Shared" << returnVal.type1 << ";"<< endl;
|
||||
if(returnVal.category1 == ReturnValue::CLASS)
|
||||
file.oss << "typedef boost::shared_ptr<" << returnVal.qualifiedType1("::") << "> Shared" << returnVal.type1 << ";"<< endl;
|
||||
|
||||
file.oss << "typedef boost::shared_ptr<" << cppClassName << "> Shared;" << endl;
|
||||
// call
|
||||
|
|
|
@ -341,7 +341,6 @@ mxArray* create_collect_object(const char *classname, mxArray* h){
|
|||
mxArray* dummy[14] = {h,h,h,h,h, h,h,h,h,h, h,h,h,h};
|
||||
mexCallMATLAB(1,&result,14,dummy,classname);
|
||||
mxSetProperty(result, 0, "self", h);
|
||||
cout << "Return collect" << endl;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -354,7 +353,6 @@ template <typename Class>
|
|||
mxArray* wrap_shared_ptr(boost::shared_ptr< Class >* shared_ptr, const char *classname) {
|
||||
mxArray* mxh = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<boost::shared_ptr<Class>**> (mxGetPr(mxh)) = shared_ptr;
|
||||
cout << "wrapped:" << mxh << endl << "end wrap" << endl;
|
||||
//return mxh;
|
||||
return create_object(classname, mxh);
|
||||
}
|
||||
|
@ -363,23 +361,19 @@ template <typename Class>
|
|||
mxArray* wrap_collect_shared_ptr(boost::shared_ptr< Class >* shared_ptr, const char *classname) {
|
||||
mxArray* mxh = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<boost::shared_ptr<Class>**> (mxGetPr(mxh)) = shared_ptr;
|
||||
cout << "wrapped:" << mxh << endl << "end wrap" << endl;
|
||||
//return mxh;
|
||||
return create_collect_object(classname, mxh);
|
||||
}
|
||||
|
||||
template <typename Class>
|
||||
boost::shared_ptr<Class> unwrap_shared_ptr(const mxArray* obj, const string& className) {
|
||||
cout << "UNWRAP CALL" << endl;
|
||||
|
||||
mxArray* mxh = mxGetProperty(obj,0,"self");
|
||||
if (mxGetClassID(mxh) != mxUINT32OR64_CLASS || mxIsComplex(mxh)
|
||||
|| mxGetM(mxh) != 1 || mxGetN(mxh) != 1) error(
|
||||
"Parameter is not an Shared type.");
|
||||
|
||||
cout << "unwrapped:" << mxh << endl;
|
||||
boost::shared_ptr<Class>* spp = *reinterpret_cast<boost::shared_ptr<Class>**> (mxGetPr(mxh));
|
||||
cout << "unwrapped:" << spp << endl;
|
||||
return *spp;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue