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 Constructor.h
|
|
|
|
* @brief class describing a constructor + code generation
|
|
|
|
* @author Frank Dellaert
|
2011-10-14 02:41:56 +08:00
|
|
|
**/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
2011-12-09 23:44:35 +08:00
|
|
|
#include <vector>
|
2011-10-14 02:41:56 +08:00
|
|
|
|
|
|
|
#include "Argument.h"
|
|
|
|
|
2011-12-03 00:43:15 +08:00
|
|
|
namespace wrap {
|
|
|
|
|
2011-10-14 02:41:56 +08:00
|
|
|
// Constructor class
|
|
|
|
struct Constructor {
|
|
|
|
|
2011-10-14 12:43:06 +08:00
|
|
|
/// Constructor creates an empty class
|
|
|
|
Constructor(bool verbose = true) :
|
|
|
|
verbose_(verbose) {
|
|
|
|
}
|
2011-10-14 02:41:56 +08:00
|
|
|
|
2011-10-14 12:43:06 +08:00
|
|
|
// Then the instance variables are set directly by the Module constructor
|
2012-06-27 02:52:27 +08:00
|
|
|
// TODO:Vector of argument lists?
|
|
|
|
std::vector<ArgumentList> args_list;
|
2011-12-09 04:51:13 +08:00
|
|
|
std::string name;
|
2011-10-14 12:43:06 +08:00
|
|
|
bool verbose_;
|
2011-10-14 02:41:56 +08:00
|
|
|
|
2011-10-14 12:43:06 +08:00
|
|
|
// MATLAB code generation
|
|
|
|
// toolboxPath is main toolbox directory, e.g., ../matlab
|
|
|
|
// classFile is class proxy file, e.g., ../matlab/@Point2/Point2.m
|
|
|
|
|
|
|
|
/// wrapper name
|
2011-12-12 05:09:07 +08:00
|
|
|
std::string matlab_wrapper_name(const std::string& className) const;
|
2011-10-14 12:43:06 +08:00
|
|
|
|
2012-01-10 13:06:46 +08:00
|
|
|
/**
|
|
|
|
* Create fragment to select constructor in proxy class, e.g.,
|
|
|
|
* if nargin == 2, obj.self = new_Pose3_RP(varargin{1},varargin{2}); end
|
|
|
|
*/
|
2012-06-27 02:52:27 +08:00
|
|
|
void matlab_proxy_fragment(FileWriter& file,
|
|
|
|
const std::string& className, const int i,
|
|
|
|
const ArgumentList args) const;
|
2011-10-14 12:43:06 +08:00
|
|
|
|
|
|
|
/// m-file
|
|
|
|
void matlab_mfile(const std::string& toolboxPath,
|
2012-06-27 02:52:27 +08:00
|
|
|
const std::string& qualifiedMatlabName,
|
|
|
|
const ArgumentList args) const;
|
2011-10-14 12:43:06 +08:00
|
|
|
|
2011-12-09 23:44:35 +08:00
|
|
|
/// cpp wrapper
|
2011-10-14 12:43:06 +08:00
|
|
|
void matlab_wrapper(const std::string& toolboxPath,
|
2011-12-09 04:51:13 +08:00
|
|
|
const std::string& cppClassName,
|
|
|
|
const std::string& matlabClassName,
|
2011-12-10 04:29:47 +08:00
|
|
|
const std::vector<std::string>& using_namespaces,
|
2011-12-12 05:09:07 +08:00
|
|
|
const std::vector<std::string>& includes) const;
|
2012-06-27 02:52:27 +08:00
|
|
|
|
|
|
|
/// constructor function
|
|
|
|
void generate_construct(FileWriter& file, const std::string& cppClassName,
|
|
|
|
std::vector<ArgumentList>& args_list) const;
|
|
|
|
|
2011-10-14 02:41:56 +08:00
|
|
|
};
|
|
|
|
|
2011-12-03 00:43:15 +08:00
|
|
|
|
2012-06-27 02:52:27 +08:00
|
|
|
} // \namespace wrap
|