Fixed pointer issue

release/4.3a0
dellaert 2014-11-12 20:52:07 +01:00
parent 7d4f5a4820
commit e9a58ff225
2 changed files with 15 additions and 14 deletions

View File

@ -276,14 +276,14 @@ map<string, METHOD> expandMethodTemplate(const map<string, METHOD>& methods,
BOOST_FOREACH(const ReturnValue& retVal, method.returnVals) { BOOST_FOREACH(const ReturnValue& retVal, method.returnVals) {
ReturnValue instRetVal = retVal; ReturnValue instRetVal = retVal;
if (retVal.type1.name == templateArg) { if (retVal.type1.name == templateArg) {
instRetVal.type1 = qualifiedType; instRetVal.type1.rename(qualifiedType);
} else if (retVal.type1.name == "This") { } else if (retVal.type1.name == "This") {
instRetVal.type1 = expandedClass; instRetVal.type1.rename(expandedClass);
} }
if (retVal.type2.name == templateArg) { if (retVal.type2.name == templateArg) {
instRetVal.type2 = qualifiedType; instRetVal.type2.rename(qualifiedType);
} else if (retVal.type2.name == "This") { } else if (retVal.type2.name == "This") {
instRetVal.type2 = expandedClass; instRetVal.type2.rename(expandedClass);
} }
instMethod.returnVals.push_back(instRetVal); instMethod.returnVals.push_back(instRetVal);
} }
@ -309,10 +309,10 @@ Class Class::expandTemplate(const string& templateArg,
/* ************************************************************************* */ /* ************************************************************************* */
vector<Class> Class::expandTemplate(const string& templateArg, vector<Class> Class::expandTemplate(const string& templateArg,
const vector<Qualified >& instantiations) const { const vector<Qualified>& instantiations) const {
vector<Class> result; vector<Class> result;
BOOST_FOREACH(const Qualified& instName, instantiations) { BOOST_FOREACH(const Qualified& instName, instantiations) {
Qualified expandedClass = (Qualified)(*this); Qualified expandedClass = (Qualified) (*this);
expandedClass.name += instName.name; expandedClass.name += instName.name;
Class inst = expandTemplate(templateArg, instName, expandedClass); Class inst = expandTemplate(templateArg, instName, expandedClass);
inst.name = expandedClass.name; inst.name = expandedClass.name;
@ -359,8 +359,8 @@ void Class::comment_fragment(FileWriter& proxyFile) const {
BOOST_FOREACH(ArgumentList argList, m.argLists) { BOOST_FOREACH(ArgumentList argList, m.argLists) {
proxyFile.oss << "%"; proxyFile.oss << "%";
argList.emit_prototype(proxyFile, m.name); argList.emit_prototype(proxyFile, m.name);
proxyFile.oss << " : returns " proxyFile.oss << " : returns " << m.returnVals[0].return_type(false)
<< m.returnVals[0].return_type(false) << endl; << endl;
} }
} }
@ -371,8 +371,8 @@ void Class::comment_fragment(FileWriter& proxyFile) const {
BOOST_FOREACH(ArgumentList argList, m.argLists) { BOOST_FOREACH(ArgumentList argList, m.argLists) {
proxyFile.oss << "%"; proxyFile.oss << "%";
argList.emit_prototype(proxyFile, m.name); argList.emit_prototype(proxyFile, m.name);
proxyFile.oss << " : returns " proxyFile.oss << " : returns " << m.returnVals[0].return_type(false)
<< m.returnVals[0].return_type(false) << endl; << endl;
} }
} }

View File

@ -34,8 +34,9 @@ struct ReturnType: Qualified {
isPtr(false), category(CLASS) { isPtr(false), category(CLASS) {
} }
ReturnType(const Qualified& q) : void rename(const Qualified& q) {
Qualified(q), isPtr(false), category(CLASS) { name = q.name;
namespaces = q.namespaces;
} }
/// Check if this type is in a set of valid types /// Check if this type is in a set of valid types
@ -78,12 +79,12 @@ struct ReturnValue {
std::string matlab_returnType() const; std::string matlab_returnType() const;
void wrap_result(const std::string& result, FileWriter& file, void wrap_result(const std::string& result, FileWriter& wrapperFile,
const TypeAttributesTable& typeAttributes) const; const TypeAttributesTable& typeAttributes) const;
void wrapTypeUnwrap(FileWriter& wrapperFile) const; void wrapTypeUnwrap(FileWriter& wrapperFile) const;
void emit_matlab(FileWriter& file) const; void emit_matlab(FileWriter& proxyFile) const;
}; };
} // \namespace wrap } // \namespace wrap