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)
proxyFile.oss << ", ";
else
proxyFile.oss << " : returns " << returnValue(0).return_type(false)
<< std::endl;
proxyFile.oss << " : returns " << returnValue(0).returnType()
<< std::endl;
argLCount++;
}
}
@ -91,8 +91,8 @@ public:
for(ArgumentList argList: argLists_) {
proxyFile.oss << "%";
argList.emit_prototype(proxyFile, name);
proxyFile.oss << " : returns " << returnVals_[i++].return_type(false)
<< std::endl;
proxyFile.oss << " : returns " << returnVals_[i++].returnType()
<< std::endl;
}
}

View File

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

View File

@ -54,8 +54,6 @@ struct ReturnType : public Qualified {
private:
friend struct ReturnValue;
std::string str(bool add_ptr) const;
/// Example: out[1] = wrap_shared_ptr(pairResult.second,"Test", false);
void wrap_result(const std::string& out, const std::string& result,
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)
return "pair< " + type1.str(add_ptr) + ", " + type2.str(add_ptr) + " >";
return "pair< " + type1.qualifiedName("::") + ", " +
type2.qualifiedName("::") + " >";
else
return type1.str(add_ptr);
return type1.qualifiedName("::");
}
/* ************************************************************************* */

View File

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