Some additional cleanup in wrap
parent
5d008d43fa
commit
79c9bc99ff
5
gtsam.h
5
gtsam.h
|
@ -48,6 +48,10 @@
|
||||||
* - All includes will be collected and added in a single file
|
* - All includes will be collected and added in a single file
|
||||||
* - All namespaces must have angle brackets: <path>
|
* - All namespaces must have angle brackets: <path>
|
||||||
* - No default includes will be added
|
* - No default includes will be added
|
||||||
|
* Global/Namespace functions
|
||||||
|
* - Functions specified outside of a class are global
|
||||||
|
* - Can be overloaded with different arguments
|
||||||
|
* - Can have multiple functions of the same name in different namespaces
|
||||||
* Using classes defined in other modules
|
* Using classes defined in other modules
|
||||||
* - If you are using a class 'OtherClass' not wrapped in this definition file, add "class OtherClass;" to avoid a dependency error
|
* - If you are using a class 'OtherClass' not wrapped in this definition file, add "class OtherClass;" to avoid a dependency error
|
||||||
* Virtual inheritance
|
* Virtual inheritance
|
||||||
|
@ -74,7 +78,6 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Status:
|
* Status:
|
||||||
* - TODO: global functions
|
|
||||||
* - TODO: default values for arguments
|
* - TODO: default values for arguments
|
||||||
* - TODO: Handle gtsam::Rot3M conversions to quaternions
|
* - TODO: Handle gtsam::Rot3M conversions to quaternions
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -308,7 +308,7 @@ std::string Class::getTypedef() const {
|
||||||
result += ("namespace " + namesp + " { ");
|
result += ("namespace " + namesp + " { ");
|
||||||
}
|
}
|
||||||
result += ("typedef " + typedefName + " " + name + ";");
|
result += ("typedef " + typedefName + " " + name + ";");
|
||||||
BOOST_FOREACH(const string& namesp, namespaces) {
|
for (size_t i = 0; i<namespaces.size(); ++i) {
|
||||||
result += " }";
|
result += " }";
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -121,17 +121,7 @@ void GlobalFunction::generateSingleFunction(const std::string& toolboxPath, cons
|
||||||
// start
|
// start
|
||||||
wrapperFile.oss << "{\n";
|
wrapperFile.oss << "{\n";
|
||||||
|
|
||||||
if(returnVal.isPair)
|
returnVal.wrapTypeUnwrap(wrapperFile);
|
||||||
{
|
|
||||||
if(returnVal.category1 == ReturnValue::CLASS)
|
|
||||||
wrapperFile.oss << " typedef boost::shared_ptr<" << returnVal.qualifiedType1("::") << "> Shared" << returnVal.type1 << ";"<< endl;
|
|
||||||
if(returnVal.category2 == ReturnValue::CLASS)
|
|
||||||
wrapperFile.oss << " typedef boost::shared_ptr<" << returnVal.qualifiedType2("::") << "> Shared" << returnVal.type2 << ";"<< endl;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (returnVal.category1 == ReturnValue::CLASS)
|
|
||||||
wrapperFile.oss << " typedef boost::shared_ptr<" << returnVal.qualifiedType1("::") << "> Shared" << returnVal.type1 << ";"<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check arguments
|
// check arguments
|
||||||
// NOTE: for static functions, there is no object passed
|
// NOTE: for static functions, there is no object passed
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct GlobalFunction {
|
||||||
// each overload, regardless of namespace
|
// each overload, regardless of namespace
|
||||||
std::vector<ArgumentList> argLists; ///< arugments for each overload
|
std::vector<ArgumentList> argLists; ///< arugments for each overload
|
||||||
std::vector<ReturnValue> returnVals; ///< returnVals for each overload
|
std::vector<ReturnValue> returnVals; ///< returnVals for each overload
|
||||||
std::vector<StrVec> namespaces; ///< Stack of namespaces
|
std::vector<StrVec> namespaces; ///< Stack of namespaces
|
||||||
|
|
||||||
// Constructor only used in Module
|
// Constructor only used in Module
|
||||||
GlobalFunction(bool verbose = true) : verbose_(verbose) {}
|
GlobalFunction(bool verbose = true) : verbose_(verbose) {}
|
||||||
|
|
|
@ -40,7 +40,6 @@ struct Module {
|
||||||
std::vector<Class> classes; ///< list of classes
|
std::vector<Class> classes; ///< list of classes
|
||||||
std::vector<TemplateInstantiationTypedef> templateInstantiationTypedefs; ///< list of template instantiations
|
std::vector<TemplateInstantiationTypedef> templateInstantiationTypedefs; ///< list of template instantiations
|
||||||
bool verbose; ///< verbose flag
|
bool verbose; ///< verbose flag
|
||||||
// std::vector<std::string> using_namespaces; ///< all default namespaces
|
|
||||||
std::vector<ForwardDeclaration> forward_declarations;
|
std::vector<ForwardDeclaration> forward_declarations;
|
||||||
std::vector<std::string> includes; ///< Include statements
|
std::vector<std::string> includes; ///< Include statements
|
||||||
GlobalFunctions global_functions;
|
GlobalFunctions global_functions;
|
||||||
|
|
|
@ -122,5 +122,19 @@ void ReturnValue::wrap_result(const string& result, FileWriter& file, const Type
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
void ReturnValue::wrapTypeUnwrap(FileWriter& wrapperFile) const {
|
||||||
|
if(isPair)
|
||||||
|
{
|
||||||
|
if(category1 == ReturnValue::CLASS)
|
||||||
|
wrapperFile.oss << " typedef boost::shared_ptr<" << qualifiedType1("::") << "> Shared" << type1 << ";"<< endl;
|
||||||
|
if(category2 == ReturnValue::CLASS)
|
||||||
|
wrapperFile.oss << " typedef boost::shared_ptr<" << qualifiedType2("::") << "> Shared" << type2 << ";"<< endl;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (category1 == ReturnValue::CLASS)
|
||||||
|
wrapperFile.oss << " typedef boost::shared_ptr<" << qualifiedType1("::") << "> Shared" << type1 << ";"<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* ************************************************************************* */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,8 @@ struct ReturnValue {
|
||||||
|
|
||||||
void wrap_result(const std::string& result, FileWriter& file, const TypeAttributesTable& typeAttributes) const;
|
void wrap_result(const std::string& result, FileWriter& file, const TypeAttributesTable& typeAttributes) const;
|
||||||
|
|
||||||
|
void wrapTypeUnwrap(FileWriter& wrapperFile) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // \namespace wrap
|
} // \namespace wrap
|
||||||
|
|
|
@ -123,16 +123,7 @@ string StaticMethod::wrapper_fragment(FileWriter& file,
|
||||||
file.oss << "{\n";
|
file.oss << "{\n";
|
||||||
generateUsingNamespace(file, using_namespaces);
|
generateUsingNamespace(file, using_namespaces);
|
||||||
|
|
||||||
if(returnVal.isPair)
|
returnVal.wrapTypeUnwrap(file);
|
||||||
{
|
|
||||||
if(returnVal.category1 == ReturnValue::CLASS)
|
|
||||||
file.oss << " typedef boost::shared_ptr<" << returnVal.qualifiedType1("::") << "> Shared" << returnVal.type1 << ";"<< endl;
|
|
||||||
if(returnVal.category2 == ReturnValue::CLASS)
|
|
||||||
file.oss << " typedef boost::shared_ptr<" << returnVal.qualifiedType2("::") << "> Shared" << returnVal.type2 << ";"<< endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if(returnVal.category1 == ReturnValue::CLASS)
|
|
||||||
file.oss << " typedef boost::shared_ptr<" << returnVal.qualifiedType1("::") << "> Shared" << returnVal.type1 << ";"<< endl;
|
|
||||||
|
|
||||||
file.oss << " typedef boost::shared_ptr<" << cppClassName << "> Shared;" << endl;
|
file.oss << " typedef boost::shared_ptr<" << cppClassName << "> Shared;" << endl;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue