fixes for two word args

release/4.3a0
Andrew Melim 2012-06-27 21:50:45 +00:00
parent ddbea256af
commit fb00f4b834
4 changed files with 9 additions and 11 deletions

View File

@ -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;

View File

@ -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;

View File

@ -63,10 +63,13 @@ void Method::matlab_wrapper(const string& classPath,
if(returnVal.isPair)
{
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
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;

View File

@ -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;
}