Added comments

release/4.3a0
Frank Dellaert 2011-10-21 02:17:20 +00:00
parent af093c2a27
commit 1af9cae2e8
1 changed files with 14 additions and 9 deletions

View File

@ -27,15 +27,20 @@ using namespace std;
void Argument::matlab_unwrap(ofstream& ofs, void Argument::matlab_unwrap(ofstream& ofs,
const string& matlabName) const string& matlabName)
{ {
// the templated unwrap function returns a pointer
// example: double tol = unwrap< double >(in[2]);
ofs << " "; ofs << " ";
if (is_ptr) if (is_ptr)
// A pointer: emit an "unwrap_shared_ptr" call which returns a pointer
ofs << "shared_ptr<" << type << "> " << name << " = unwrap_shared_ptr< "; ofs << "shared_ptr<" << type << "> " << name << " = unwrap_shared_ptr< ";
else if (is_ref) else if (is_ref)
// A reference: emit an "unwrap_shared_ptr" call and de-reference the pointer
ofs << type << "& " << name << " = *unwrap_shared_ptr< "; ofs << type << "& " << name << " = *unwrap_shared_ptr< ";
else else
// Not a pointer or a reference: emit an "unwrap" call
// unwrap is specified in matlab.h as a series of template specializations
// that know how to unpack the expected MATLAB object
// example: double tol = unwrap< double >(in[2]);
// example: Vector v = unwrap< Vector >(in[1]);
ofs << type << " " << name << " = unwrap< "; ofs << type << " " << name << " = unwrap< ";
ofs << type << " >(" << matlabName; ofs << type << " >(" << matlabName;