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 namespaces must have angle brackets: <path> | ||||
|  *     - 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 | ||||
|  *     - If you are using a class 'OtherClass' not wrapped in this definition file, add "class OtherClass;" to avoid a dependency error | ||||
|  *   Virtual inheritance | ||||
|  | @ -74,7 +78,6 @@ | |||
| 
 | ||||
| /**
 | ||||
|  * Status: | ||||
|  *  - TODO: global functions | ||||
|  *  - TODO: default values for arguments | ||||
|  *  - TODO: Handle gtsam::Rot3M conversions to quaternions | ||||
|  */ | ||||
|  |  | |||
|  | @ -308,7 +308,7 @@ std::string Class::getTypedef() const { | |||
| 		result += ("namespace " + namesp + " { "); | ||||
| 	} | ||||
| 	result += ("typedef " + typedefName + " " + name + ";"); | ||||
| 	BOOST_FOREACH(const string& namesp, namespaces) { | ||||
| 	for (size_t i = 0; i<namespaces.size(); ++i) { | ||||
| 		result += " }"; | ||||
| 	} | ||||
| 	return result; | ||||
|  |  | |||
|  | @ -121,17 +121,7 @@ void GlobalFunction::generateSingleFunction(const std::string& toolboxPath, cons | |||
| 		// start
 | ||||
| 		wrapperFile.oss << "{\n"; | ||||
| 
 | ||||
| 		if(returnVal.isPair) | ||||
| 		{ | ||||
| 			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; | ||||
| 		} | ||||
| 		returnVal.wrapTypeUnwrap(wrapperFile); | ||||
| 
 | ||||
| 		// check arguments
 | ||||
| 		// NOTE: for static functions, there is no object passed
 | ||||
|  |  | |||
|  | @ -24,7 +24,7 @@ struct GlobalFunction { | |||
| 	// each overload, regardless of namespace
 | ||||
| 	std::vector<ArgumentList> argLists;       ///< arugments 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
 | ||||
| 	GlobalFunction(bool verbose = true) : verbose_(verbose) {} | ||||
|  |  | |||
|  | @ -40,7 +40,6 @@ struct Module { | |||
|   std::vector<Class> classes; ///< list of classes
 | ||||
| 	std::vector<TemplateInstantiationTypedef> templateInstantiationTypedefs; ///< list of template instantiations
 | ||||
|   bool verbose;            ///< verbose flag
 | ||||
| //  std::vector<std::string> using_namespaces; ///< all default namespaces
 | ||||
|   std::vector<ForwardDeclaration> forward_declarations; | ||||
| 	std::vector<std::string> includes;        ///< Include statements
 | ||||
| 	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 wrapTypeUnwrap(FileWriter& wrapperFile) const; | ||||
| 
 | ||||
| }; | ||||
| 
 | ||||
| } // \namespace wrap
 | ||||
|  |  | |||
|  | @ -123,16 +123,7 @@ string StaticMethod::wrapper_fragment(FileWriter& file, | |||
| 	file.oss << "{\n"; | ||||
| 	generateUsingNamespace(file, using_namespaces); | ||||
| 
 | ||||
|   if(returnVal.isPair) | ||||
|   { | ||||
|       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; | ||||
| 	returnVal.wrapTypeUnwrap(file); | ||||
| 
 | ||||
|   file.oss << "  typedef boost::shared_ptr<"  << cppClassName  << "> Shared;" << endl; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue