| 
									
										
										
										
											2011-10-14 02:41:56 +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 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * -------------------------------------------------------------------------- */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2011-10-14 11:23:14 +08:00
										 |  |  |  * @file Argument.h | 
					
						
							|  |  |  |  * @brief arguments to constructors and methods | 
					
						
							|  |  |  |  * @author Frank Dellaert | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  |  **/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <string>
 | 
					
						
							| 
									
										
										
										
											2011-12-09 04:51:15 +08:00
										 |  |  | #include <vector>
 | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-16 05:42:41 +08:00
										 |  |  | #include "FileWriter.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-03 00:43:15 +08:00
										 |  |  | namespace wrap { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-14 12:43:06 +08:00
										 |  |  | /// Argument class
 | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  | struct Argument { | 
					
						
							| 
									
										
										
										
											2011-10-14 12:43:06 +08:00
										 |  |  | 	bool is_const, is_ref, is_ptr; | 
					
						
							|  |  |  | 	std::string type; | 
					
						
							|  |  |  | 	std::string name; | 
					
						
							| 
									
										
										
										
											2011-12-09 04:51:15 +08:00
										 |  |  | 	std::vector<std::string> namespaces; | 
					
						
							| 
									
										
										
										
											2012-01-10 13:06:46 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-14 12:43:06 +08:00
										 |  |  | 	Argument() : | 
					
						
							|  |  |  | 			is_const(false), is_ref(false), is_ptr(false) { | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-10 13:06:46 +08:00
										 |  |  | 	/// return MATLAB class for use in isa(x,class)
 | 
					
						
							|  |  |  | 	std::string matlabClass() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/// adds namespaces to type
 | 
					
						
							|  |  |  | 	std::string qualifiedType(const std::string& delim = "") const; | 
					
						
							| 
									
										
										
										
											2011-12-09 04:51:15 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-14 12:43:06 +08:00
										 |  |  | 	/// MATLAB code generation, MATLAB to C++
 | 
					
						
							| 
									
										
										
										
											2012-01-16 05:42:41 +08:00
										 |  |  | 	void matlab_unwrap(FileWriter& file, const std::string& matlabName) const; | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-10 13:06:46 +08:00
										 |  |  | /// Argument list is just a container with Arguments
 | 
					
						
							| 
									
										
										
										
											2011-12-09 04:51:15 +08:00
										 |  |  | struct ArgumentList: public std::vector<Argument> { | 
					
						
							| 
									
										
										
										
											2012-01-10 13:06:46 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/// create a comma-separated string listing all argument types (not used)
 | 
					
						
							| 
									
										
										
										
											2011-12-12 05:09:07 +08:00
										 |  |  | 	std::string types() const; | 
					
						
							| 
									
										
										
										
											2012-01-10 13:06:46 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/// create a short "signature" string
 | 
					
						
							| 
									
										
										
										
											2011-12-12 05:09:07 +08:00
										 |  |  | 	std::string signature() const; | 
					
						
							| 
									
										
										
										
											2012-01-10 13:06:46 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/// create a comma-separated string listing all argument names, used in m-files
 | 
					
						
							| 
									
										
										
										
											2011-12-12 05:09:07 +08:00
										 |  |  | 	std::string names() const; | 
					
						
							| 
									
										
										
										
											2011-10-14 12:43:06 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// MATLAB code generation:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/**
 | 
					
						
							|  |  |  | 	 * emit code to unwrap arguments | 
					
						
							| 
									
										
										
										
											2012-01-16 05:42:41 +08:00
										 |  |  | 	 * @param file output stream | 
					
						
							| 
									
										
										
										
											2011-10-14 12:43:06 +08:00
										 |  |  | 	 * @param start initial index for input array, set to 1 for method | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2012-01-16 05:42:41 +08:00
										 |  |  | 	void matlab_unwrap(FileWriter& file, int start = 0) const; // MATLAB to C++
 | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-03 00:43:15 +08:00
										 |  |  | } // \namespace wrap
 | 
					
						
							|  |  |  | 
 |