diff --git a/wrap/Class.cpp b/wrap/Class.cpp index 7280d5488..5e0237d3a 100644 --- a/wrap/Class.cpp +++ b/wrap/Class.cpp @@ -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; diff --git a/wrap/Constructor.cpp b/wrap/Constructor.cpp index 97a6af4fc..e999951b2 100644 --- a/wrap/Constructor.cpp +++ b/wrap/Constructor.cpp @@ -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; diff --git a/wrap/Method.cpp b/wrap/Method.cpp index ccd36fe50..f5da0d370 100644 --- a/wrap/Method.cpp +++ b/wrap/Method.cpp @@ -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 diff --git a/wrap/matlab.h b/wrap/matlab.h index 99dd0c6b3..74c0823e4 100644 --- a/wrap/matlab.h +++ b/wrap/matlab.h @@ -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 mxArray* wrap_shared_ptr(boost::shared_ptr< Class >* shared_ptr, const char *classname) { mxArray* mxh = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); *reinterpret_cast**> (mxGetPr(mxh)) = shared_ptr; - cout << "wrapped:" << mxh << endl << "end wrap" << endl; //return mxh; return create_object(classname, mxh); } @@ -363,23 +361,19 @@ template mxArray* wrap_collect_shared_ptr(boost::shared_ptr< Class >* shared_ptr, const char *classname) { mxArray* mxh = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); *reinterpret_cast**> (mxGetPr(mxh)) = shared_ptr; - cout << "wrapped:" << mxh << endl << "end wrap" << endl; //return mxh; return create_collect_object(classname, mxh); } template boost::shared_ptr 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* spp = *reinterpret_cast**> (mxGetPr(mxh)); - cout << "unwrapped:" << spp << endl; return *spp; }