| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  | /* ----------------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * GTSAM Copyright 2010, Georgia Tech Research Corporation,  | 
					
						
							|  |  |  |  * Atlanta, Georgia 30332-0415 | 
					
						
							|  |  |  |  * All Rights Reserved | 
					
						
							|  |  |  |  * Authors: Frank Dellaert, et al. (see THANKS for the full author list) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * See LICENSE for the license information | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * -------------------------------------------------------------------------- */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @file StaticMethod.h | 
					
						
							|  |  |  |  * @brief describes and generates code for static methods | 
					
						
							|  |  |  |  * @author Frank Dellaert | 
					
						
							|  |  |  |  * @author Alex Cunningham | 
					
						
							| 
									
										
										
										
											2012-07-13 06:28:28 +08:00
										 |  |  |  * @author Richard Roberts | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  |  **/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <string>
 | 
					
						
							|  |  |  | #include <list>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "Argument.h"
 | 
					
						
							|  |  |  | #include "ReturnValue.h"
 | 
					
						
							| 
									
										
										
										
											2012-07-13 06:28:28 +08:00
										 |  |  | #include "TypeAttributesTable.h"
 | 
					
						
							| 
									
										
										
										
											2012-08-29 05:44:45 +08:00
										 |  |  | #include <boost/algorithm/string.hpp>
 | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-03 00:43:15 +08:00
										 |  |  | namespace wrap { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  | /// StaticMethod class
 | 
					
						
							|  |  |  | struct StaticMethod { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/// Constructor creates empty object
 | 
					
						
							| 
									
										
										
										
											2011-12-07 11:05:37 +08:00
										 |  |  | 	StaticMethod(bool verbosity = true) : | 
					
						
							|  |  |  | 			verbose(verbosity) {} | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Then the instance variables are set directly by the Module constructor
 | 
					
						
							| 
									
										
										
										
											2011-12-07 11:05:37 +08:00
										 |  |  | 	bool verbose; | 
					
						
							|  |  |  | 	std::string name; | 
					
						
							| 
									
										
										
										
											2012-07-05 22:05:00 +08:00
										 |  |  | 	std::vector<ArgumentList> argLists; | 
					
						
							|  |  |  | 	std::vector<ReturnValue> returnVals; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// The first time this function is called, it initializes the class members
 | 
					
						
							|  |  |  | 	// with those in rhs, but in subsequent calls it adds additional argument
 | 
					
						
							|  |  |  | 	// lists as function overloads.
 | 
					
						
							|  |  |  | 	void addOverload(bool verbose, const std::string& name, | 
					
						
							|  |  |  | 		const ArgumentList& args, const ReturnValue& retVal); | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// MATLAB code generation
 | 
					
						
							| 
									
										
										
										
											2012-07-05 22:05:00 +08:00
										 |  |  | 	// classPath is class directory, e.g., ../matlab/@Point2
 | 
					
						
							|  |  |  | 	void proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wrapperFile, | 
					
						
							| 
									
										
										
										
											2012-07-18 23:47:06 +08:00
										 |  |  | 		const std::string& cppClassName, const std::string& matlabQualName, const std::string& matlabUniqueName, | 
					
						
							| 
									
										
										
										
											2012-07-24 02:24:43 +08:00
										 |  |  | 		const std::string& wrapperName, const TypeAttributesTable& typeAttributes, | 
					
						
							| 
									
										
										
										
											2012-07-05 22:05:00 +08:00
										 |  |  | 		std::vector<std::string>& functionNames) const; | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-05 22:05:00 +08:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2012-07-05 22:04:36 +08:00
										 |  |  | 	std::string wrapper_fragment(FileWriter& file, | 
					
						
							| 
									
										
										
										
											2012-07-05 22:05:00 +08:00
										 |  |  | 	    const std::string& cppClassName, | 
					
						
							| 
									
										
										
										
											2012-07-18 23:47:06 +08:00
										 |  |  | 	    const std::string& matlabUniqueName, | 
					
						
							| 
									
										
										
										
											2012-07-05 22:05:00 +08:00
										 |  |  | 			int overload, | 
					
						
							| 
									
										
										
										
											2012-07-05 22:04:36 +08:00
										 |  |  | 			int id, | 
					
						
							| 
									
										
										
										
											2012-07-13 06:28:28 +08:00
										 |  |  | 			const TypeAttributesTable& typeAttributes) const; ///< cpp wrapper
 | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-03 00:43:15 +08:00
										 |  |  | } // \namespace wrap
 | 
					
						
							|  |  |  | 
 |