| 
									
										
										
										
											2014-11-29 22:31:29 +08:00
										 |  |  | /* ----------------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-20 22:24:43 +08:00
										 |  |  |  * GTSAM Copyright 2010, Georgia Tech Research Corporation, | 
					
						
							| 
									
										
										
										
											2014-11-29 22:31:29 +08:00
										 |  |  |  * 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 MethodBase.h | 
					
						
							|  |  |  |  * @brief describes and generates code for static methods | 
					
						
							|  |  |  |  * @author Frank Dellaert | 
					
						
							|  |  |  |  * @author Alex Cunningham | 
					
						
							|  |  |  |  * @author Richard Roberts | 
					
						
							|  |  |  |  **/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "FullyOverloadedFunction.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace wrap { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-12 05:14:06 +08:00
										 |  |  | // Forward declaration
 | 
					
						
							|  |  |  | class Class; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-29 22:31:29 +08:00
										 |  |  | /// MethodBase class
 | 
					
						
							| 
									
										
										
										
											2016-11-20 22:24:43 +08:00
										 |  |  | struct MethodBase : public FullyOverloadedFunction { | 
					
						
							| 
									
										
										
										
											2014-11-29 22:31:29 +08:00
										 |  |  |   typedef const std::string& Str; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // emit a list of comments, one for each overload
 | 
					
						
							|  |  |  |   void comment_fragment(FileWriter& proxyFile) const { | 
					
						
							|  |  |  |     SignatureOverloads::comment_fragment(proxyFile, matlabName()); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   void verifyArguments(const std::vector<std::string>& validArgs) const { | 
					
						
							|  |  |  |     SignatureOverloads::verifyArguments(validArgs, name_); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   void verifyReturnTypes(const std::vector<std::string>& validtypes) const { | 
					
						
							|  |  |  |     SignatureOverloads::verifyReturnTypes(validtypes, name_); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // MATLAB code generation
 | 
					
						
							|  |  |  |   // classPath is class directory, e.g., ../matlab/@Point2
 | 
					
						
							|  |  |  |   void proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wrapperFile, | 
					
						
							| 
									
										
										
										
											2016-11-20 22:24:43 +08:00
										 |  |  |                                Str cppClassName, Str matlabQualName, | 
					
						
							|  |  |  |                                Str matlabUniqueName, Str wrapperName, | 
					
						
							|  |  |  |                                const TypeAttributesTable& typeAttributes, | 
					
						
							|  |  |  |                                std::vector<std::string>& functionNames) const; | 
					
						
							| 
									
										
										
										
											2014-11-29 22:31:29 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // emit python wrapper
 | 
					
						
							|  |  |  |   void python_wrapper(FileWriter& wrapperFile, Str className) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |   virtual void proxy_header(FileWriter& proxyFile) const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-20 22:24:43 +08:00
										 |  |  |   std::string wrapper_fragment( | 
					
						
							|  |  |  |       FileWriter& wrapperFile, Str cppClassName, Str matlabUniqueName, | 
					
						
							|  |  |  |       int overload, int id, | 
					
						
							|  |  |  |       const TypeAttributesTable& typeAttributes) const;  ///< cpp wrapper
 | 
					
						
							| 
									
										
										
										
											2014-11-29 22:31:29 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   virtual std::string wrapper_call(FileWriter& wrapperFile, Str cppClassName, | 
					
						
							| 
									
										
										
										
											2016-11-20 22:24:43 +08:00
										 |  |  |                                    Str matlabUniqueName, | 
					
						
							|  |  |  |                                    const ArgumentList& args) const = 0; | 
					
						
							| 
									
										
										
										
											2014-11-29 22:31:29 +08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-20 22:24:43 +08:00
										 |  |  | }  // \namespace wrap
 |