Fixed unrwapping of scalar references.
							parent
							
								
									a738529af9
								
							
						
					
					
						commit
						21aa7a2e85
					
				| 
						 | 
				
			
			@ -75,16 +75,17 @@ void Argument::matlab_unwrap(FileWriter& file, const string& matlabName) const {
 | 
			
		|||
 | 
			
		||||
  string cppType = type.qualifiedName("::");
 | 
			
		||||
  string matlabUniqueType = type.qualifiedName();
 | 
			
		||||
  bool isNotScalar = !Argument::isScalar();
 | 
			
		||||
 | 
			
		||||
  if (is_ptr && type.category != Qualified::EIGEN)
 | 
			
		||||
    // A pointer: emit an "unwrap_shared_ptr" call which returns a pointer
 | 
			
		||||
    file.oss << "boost::shared_ptr<" << cppType << "> " << name
 | 
			
		||||
        << " = unwrap_shared_ptr< ";
 | 
			
		||||
  else if (is_ref && type.category != Qualified::EIGEN)
 | 
			
		||||
  else if (is_ref && isNotScalar && type.category != Qualified::EIGEN)
 | 
			
		||||
    // A reference: emit an "unwrap_shared_ptr" call and de-reference the pointer
 | 
			
		||||
    file.oss << cppType << "& " << name << " = *unwrap_shared_ptr< ";
 | 
			
		||||
  else
 | 
			
		||||
    // Not a pointer or a reference: emit an "unwrap" call
 | 
			
		||||
    // Not a pointer, or a reference to a scalar type. Therefore, 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]);
 | 
			
		||||
| 
						 | 
				
			
			@ -92,7 +93,7 @@ void Argument::matlab_unwrap(FileWriter& file, const string& matlabName) const {
 | 
			
		|||
    file.oss << cppType << " " << name << " = unwrap< ";
 | 
			
		||||
 | 
			
		||||
  file.oss << cppType << " >(" << matlabName;
 | 
			
		||||
  if( (is_ptr || is_ref) && type.category != Qualified::EIGEN)
 | 
			
		||||
  if( (is_ptr || is_ref) && isNotScalar && type.category != Qualified::EIGEN)
 | 
			
		||||
    file.oss << ", \"ptr_" << matlabUniqueType << "\"";
 | 
			
		||||
  file.oss << ");" << endl;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue