Got rid of some obsolete methods/arguments

release/4.3a0
Frank Dellaert 2019-03-19 12:42:40 -04:00
parent 40051a6226
commit aa8b40b594
5 changed files with 16 additions and 27 deletions

View File

@ -79,8 +79,8 @@ public:
if (argLCount != nrOverloads() - 1) if (argLCount != nrOverloads() - 1)
proxyFile.oss << ", "; proxyFile.oss << ", ";
else else
proxyFile.oss << " : returns " << returnValue(0).return_type(false) proxyFile.oss << " : returns " << returnValue(0).returnType()
<< std::endl; << std::endl;
argLCount++; argLCount++;
} }
} }
@ -91,8 +91,8 @@ public:
for(ArgumentList argList: argLists_) { for(ArgumentList argList: argLists_) {
proxyFile.oss << "%"; proxyFile.oss << "%";
argList.emit_prototype(proxyFile, name); argList.emit_prototype(proxyFile, name);
proxyFile.oss << " : returns " << returnVals_[i++].return_type(false) proxyFile.oss << " : returns " << returnVals_[i++].returnType()
<< std::endl; << std::endl;
} }
} }

View File

@ -12,18 +12,12 @@
using namespace std; using namespace std;
using namespace wrap; using namespace wrap;
/* ************************************************************************* */
string ReturnType::str(bool add_ptr) const {
return maybe_shared_ptr(add_ptr && isPtr, qualifiedName("::"), name());
}
/* ************************************************************************* */ /* ************************************************************************* */
void ReturnType::wrap_result(const string& out, const string& result, void ReturnType::wrap_result(const string& out, const string& result,
FileWriter& wrapperFile, FileWriter& wrapperFile,
const TypeAttributesTable& typeAttributes) const { const TypeAttributesTable& typeAttributes) const {
string cppType = qualifiedName("::"), matlabType = qualifiedName("."); string cppType = qualifiedName("::"), matlabType = qualifiedName(".");
const string sharedType = "Shared" + name();
if (category == CLASS) { if (category == CLASS) {
// Handle Classes // Handle Classes
string objCopy, ptrType; string objCopy, ptrType;
@ -38,9 +32,7 @@ void ReturnType::wrap_result(const string& out, const string& result,
objCopy = result + ".clone()"; objCopy = result + ".clone()";
else { else {
// ...but a non-virtual class can just be copied // ...but a non-virtual class can just be copied
wrapperFile.oss << " typedef boost::shared_ptr<" << qualifiedName("::") objCopy = "boost::make_shared<" + cppType + ">(" + result + ")";
<< "> " << sharedType << ";" << endl;
objCopy = sharedType + "(new " + cppType + "(" + result + "))";
} }
} }
// e.g. out[1] = wrap_shared_ptr(pairResult.second,"gtsam.Point3", false); // e.g. out[1] = wrap_shared_ptr(pairResult.second,"gtsam.Point3", false);
@ -50,17 +42,15 @@ void ReturnType::wrap_result(const string& out, const string& result,
} else if (isPtr) { } else if (isPtr) {
// Handle shared pointer case for BASIS/EIGEN/VOID // Handle shared pointer case for BASIS/EIGEN/VOID
wrapperFile.oss << " typedef boost::shared_ptr<" << qualifiedName("::") // This case does not actually occur in GTSAM wrappers, so untested!
<< "> " << sharedType << ";" << endl; wrapperFile.oss << " {\n boost::shared_ptr<" << qualifiedName("::")
wrapperFile.oss << " {\n auto ret = new " << sharedType << "(" << result << "> shared(" << result << ");" << endl;
<< ");" << endl; wrapperFile.oss << out << " = wrap_shared_ptr(shared,\"" << matlabType
wrapperFile.oss << out << " = wrap_shared_ptr(ret,\"" << matlabType
<< "\");\n }\n"; << "\");\n }\n";
} else if (matlabType != "void") } else if (matlabType != "void")
// Handle normal case case for BASIS/EIGEN // Handle normal case case for BASIS/EIGEN
wrapperFile.oss << out << " = wrap< " << str(false) << " >(" << result wrapperFile.oss << out << " = wrap< " << qualifiedName("::") << " >(" << result
<< ");\n"; << ");\n";
} }

View File

@ -54,8 +54,6 @@ struct ReturnType : public Qualified {
private: private:
friend struct ReturnValue; friend struct ReturnValue;
std::string str(bool add_ptr) const;
/// Example: out[1] = wrap_shared_ptr(pairResult.second,"Test", false); /// Example: out[1] = wrap_shared_ptr(pairResult.second,"Test", false);
void wrap_result(const std::string& out, const std::string& result, void wrap_result(const std::string& out, const std::string& result,
FileWriter& wrapperFile, FileWriter& wrapperFile,

View File

@ -22,11 +22,12 @@ ReturnValue ReturnValue::expandTemplate(const TemplateSubstitution& ts) const {
} }
/* ************************************************************************* */ /* ************************************************************************* */
string ReturnValue::return_type(bool add_ptr) const { string ReturnValue::returnType() const {
if (isPair) if (isPair)
return "pair< " + type1.str(add_ptr) + ", " + type2.str(add_ptr) + " >"; return "pair< " + type1.qualifiedName("::") + ", " +
type2.qualifiedName("::") + " >";
else else
return type1.str(add_ptr); return type1.qualifiedName("::");
} }
/* ************************************************************************* */ /* ************************************************************************* */

View File

@ -63,7 +63,7 @@ struct ReturnValue {
/// Substitute template argument /// Substitute template argument
ReturnValue expandTemplate(const TemplateSubstitution& ts) const; ReturnValue expandTemplate(const TemplateSubstitution& ts) const;
std::string return_type(bool add_ptr) const; std::string returnType() const;
std::string matlab_returnType() const; std::string matlab_returnType() const;
@ -82,7 +82,7 @@ struct ReturnValue {
if (!r.isPair && r.type1.category == ReturnType::VOID) if (!r.isPair && r.type1.category == ReturnType::VOID)
os << "void"; os << "void";
else else
os << r.return_type(true); os << r.returnType();
return os; return os;
} }