| 
									
										
										
										
											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 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * -------------------------------------------------------------------------- */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2012-06-27 02:52:27 +08:00
										 |  |  |  * @file StaticMethod.ccp | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  |  * @author Frank Dellaert | 
					
						
							| 
									
										
										
										
											2012-06-27 02:52:27 +08:00
										 |  |  |  * @author Andrew Melim | 
					
						
							| 
									
										
										
										
											2012-07-13 06:28:28 +08:00
										 |  |  |  * @author Richard Roberts | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  |  **/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-29 22:31:29 +08:00
										 |  |  | #include "StaticMethod.h"
 | 
					
						
							| 
									
										
										
										
											2014-05-26 01:22:10 +08:00
										 |  |  | #include "utilities.h"
 | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <boost/foreach.hpp>
 | 
					
						
							| 
									
										
										
										
											2012-07-05 22:04:36 +08:00
										 |  |  | #include <boost/lexical_cast.hpp>
 | 
					
						
							| 
									
										
										
										
											2014-05-26 01:22:10 +08:00
										 |  |  | #include <boost/algorithm/string.hpp>
 | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-26 01:22:10 +08:00
										 |  |  | #include <iostream>
 | 
					
						
							|  |  |  | #include <fstream>
 | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | using namespace std; | 
					
						
							| 
									
										
										
										
											2011-12-03 00:43:15 +08:00
										 |  |  | using namespace wrap; | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-14 00:28:05 +08:00
										 |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | void StaticMethod::proxy_header(FileWriter& proxyFile) const { | 
					
						
							| 
									
										
										
										
											2014-11-14 05:43:29 +08:00
										 |  |  |   string upperName = matlabName(); | 
					
						
							| 
									
										
										
										
											2014-11-14 00:34:33 +08:00
										 |  |  |   upperName[0] = toupper(upperName[0], locale()); | 
					
						
							| 
									
										
										
										
											2014-11-14 00:28:05 +08:00
										 |  |  |   proxyFile.oss << "    function varargout = " << upperName << "(varargin)\n"; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  | /* ************************************************************************* */ | 
					
						
							| 
									
										
										
										
											2014-11-14 00:34:33 +08:00
										 |  |  | string StaticMethod::wrapper_call(FileWriter& wrapperFile, Str cppClassName, | 
					
						
							| 
									
										
										
										
											2014-11-30 17:38:24 +08:00
										 |  |  |     Str matlabUniqueName, const ArgumentList& args) const { | 
					
						
							| 
									
										
										
										
											2014-11-14 00:28:05 +08:00
										 |  |  |   // check arguments
 | 
					
						
							|  |  |  |   // NOTE: for static functions, there is no object passed
 | 
					
						
							|  |  |  |   wrapperFile.oss << "  checkArguments(\"" << matlabUniqueName << "." << name_ | 
					
						
							|  |  |  |       << "\",nargout,nargin," << args.size() << ");\n"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // unwrap arguments, see Argument.cpp
 | 
					
						
							|  |  |  |   args.matlab_unwrap(wrapperFile, 0); // We start at 0 because there is no self object
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // call method and wrap result
 | 
					
						
							|  |  |  |   // example: out[0]=wrap<bool>(staticMethod(t));
 | 
					
						
							|  |  |  |   string expanded = cppClassName + "::" + name_; | 
					
						
							| 
									
										
										
										
											2014-11-30 17:38:24 +08:00
										 |  |  |   if (templateArgValue_) | 
					
						
							|  |  |  |     expanded += ("<" + templateArgValue_->qualifiedName("::") + ">"); | 
					
						
							| 
									
										
										
										
											2014-11-14 00:28:05 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   return expanded; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ |