From fd5acb1362ae63ff7ef3bc840e0a58575add8e10 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 25 Nov 2025 01:05:59 -0500 Subject: [PATCH 01/12] small cleanup of GlobalFunction class --- gtwrap/interface_parser/function.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gtwrap/interface_parser/function.py b/gtwrap/interface_parser/function.py index 5385c74..76ad961 100644 --- a/gtwrap/interface_parser/function.py +++ b/gtwrap/interface_parser/function.py @@ -82,7 +82,7 @@ def from_parse_result(parse_result: ParseResults): return ArgumentList([]) def __repr__(self) -> str: - return ",".join([repr(x) for x in self.args_list]) + return ", ".join([repr(x) for x in self.args_list]) def __len__(self) -> int: return len(self.args_list) @@ -182,8 +182,7 @@ def __init__(self, self.args.parent = self def __repr__(self) -> str: - return "GlobalFunction: {}{}({})".format(self.return_type, self.name, - self.args) + return f"GlobalFunction: {self.name}({self.args}) -> {self.return_type}" def to_cpp(self) -> str: """Generate the C++ code for wrapping.""" From 509d9d963a513ac55bf3b2fcbe760d61fc23e208 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 25 Nov 2025 01:06:10 -0500 Subject: [PATCH 02/12] better documentation --- gtwrap/interface_parser/template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtwrap/interface_parser/template.py b/gtwrap/interface_parser/template.py index fd9de83..3523b2f 100644 --- a/gtwrap/interface_parser/template.py +++ b/gtwrap/interface_parser/template.py @@ -31,7 +31,7 @@ class TypenameAndInstantiations: """ Rule to parse the template parameters. - template // POSE is the Instantiation. + template // Pos2 and Pose3 are the `Instantiation`s. """ rule = ( IDENT("typename") # From 2a81d92609439bc4f4a4a8fcc369c43b3b5e5777 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 25 Nov 2025 02:35:52 -0500 Subject: [PATCH 03/12] added additional non-trivial functions to tests --- tests/expected/matlab/EliminateDiscrete.m | 7 ++ tests/expected/matlab/FindKarcherMeanPoint2.m | 7 ++ tests/expected/matlab/FindKarcherMeanPoint3.m | 7 ++ tests/expected/matlab/FindKarcherMeanPose2.m | 7 ++ tests/expected/matlab/FindKarcherMeanPose3.m | 7 ++ tests/expected/matlab/FindKarcherMeanRot2.m | 7 ++ tests/expected/matlab/FindKarcherMeanRot3.m | 7 ++ tests/expected/matlab/FindKarcherMeanSO3.m | 7 ++ tests/expected/matlab/FindKarcherMeanSO4.m | 7 ++ ...MultiTemplatedFunctionDoubleSize_tDouble.m | 2 +- ...MultiTemplatedFunctionStringSize_tDouble.m | 2 +- tests/expected/matlab/TemplatedFunctionRot3.m | 2 +- tests/expected/matlab/functions_wrapper.cpp | 77 +++++++++++++++++-- .../matlab/triangulatePoint3Cal3_S2.m | 9 +++ tests/expected/python/functions_pybind.cpp | 9 ++- tests/fixtures/functions.i | 14 +++- tests/test_matlab_wrapper.py | 6 ++ 17 files changed, 170 insertions(+), 14 deletions(-) create mode 100644 tests/expected/matlab/EliminateDiscrete.m create mode 100644 tests/expected/matlab/FindKarcherMeanPoint2.m create mode 100644 tests/expected/matlab/FindKarcherMeanPoint3.m create mode 100644 tests/expected/matlab/FindKarcherMeanPose2.m create mode 100644 tests/expected/matlab/FindKarcherMeanPose3.m create mode 100644 tests/expected/matlab/FindKarcherMeanRot2.m create mode 100644 tests/expected/matlab/FindKarcherMeanRot3.m create mode 100644 tests/expected/matlab/FindKarcherMeanSO3.m create mode 100644 tests/expected/matlab/FindKarcherMeanSO4.m create mode 100644 tests/expected/matlab/triangulatePoint3Cal3_S2.m diff --git a/tests/expected/matlab/EliminateDiscrete.m b/tests/expected/matlab/EliminateDiscrete.m new file mode 100644 index 0000000..e00bb04 --- /dev/null +++ b/tests/expected/matlab/EliminateDiscrete.m @@ -0,0 +1,7 @@ +function varargout = EliminateDiscrete(varargin) + if length(varargin) == 2 && isa(varargin{1},'gtsam.DiscreteFactorGraph') && isa(varargin{2},'gtsam.Ordering') + [ varargout{1} varargout{2} ] = functions_wrapper(25, varargin{:}); + else + error('Arguments do not match any overload of function EliminateDiscrete'); + end +end diff --git a/tests/expected/matlab/FindKarcherMeanPoint2.m b/tests/expected/matlab/FindKarcherMeanPoint2.m new file mode 100644 index 0000000..bb048d5 --- /dev/null +++ b/tests/expected/matlab/FindKarcherMeanPoint2.m @@ -0,0 +1,7 @@ +function varargout = FindKarcherMeanPoint2(varargin) + if length(varargin) == 1 && isa(varargin{1},'std.vectorgtsam::Point2') + varargout{1} = functions_wrapper(28, varargin{:}); + else + error('Arguments do not match any overload of function FindKarcherMeanPoint2'); + end +end diff --git a/tests/expected/matlab/FindKarcherMeanPoint3.m b/tests/expected/matlab/FindKarcherMeanPoint3.m new file mode 100644 index 0000000..a64a1c9 --- /dev/null +++ b/tests/expected/matlab/FindKarcherMeanPoint3.m @@ -0,0 +1,7 @@ +function varargout = FindKarcherMeanPoint3(varargin) + if length(varargin) == 1 && isa(varargin{1},'std.vectorgtsam::Point3') + varargout{1} = functions_wrapper(28, varargin{:}); + else + error('Arguments do not match any overload of function FindKarcherMeanPoint3'); + end +end diff --git a/tests/expected/matlab/FindKarcherMeanPose2.m b/tests/expected/matlab/FindKarcherMeanPose2.m new file mode 100644 index 0000000..e598b72 --- /dev/null +++ b/tests/expected/matlab/FindKarcherMeanPose2.m @@ -0,0 +1,7 @@ +function varargout = FindKarcherMeanPose2(varargin) + if length(varargin) == 1 && isa(varargin{1},'std.vectorgtsam::Pose2') + varargout{1} = functions_wrapper(30, varargin{:}); + else + error('Arguments do not match any overload of function FindKarcherMeanPose2'); + end +end diff --git a/tests/expected/matlab/FindKarcherMeanPose3.m b/tests/expected/matlab/FindKarcherMeanPose3.m new file mode 100644 index 0000000..ea988c0 --- /dev/null +++ b/tests/expected/matlab/FindKarcherMeanPose3.m @@ -0,0 +1,7 @@ +function varargout = FindKarcherMeanPose3(varargin) + if length(varargin) == 1 && isa(varargin{1},'std.vectorgtsam::Pose3') + varargout{1} = functions_wrapper(31, varargin{:}); + else + error('Arguments do not match any overload of function FindKarcherMeanPose3'); + end +end diff --git a/tests/expected/matlab/FindKarcherMeanRot2.m b/tests/expected/matlab/FindKarcherMeanRot2.m new file mode 100644 index 0000000..4734dcb --- /dev/null +++ b/tests/expected/matlab/FindKarcherMeanRot2.m @@ -0,0 +1,7 @@ +function varargout = FindKarcherMeanRot2(varargin) + if length(varargin) == 1 && isa(varargin{1},'std.vectorgtsam::Rot2') + varargout{1} = functions_wrapper(29, varargin{:}); + else + error('Arguments do not match any overload of function FindKarcherMeanRot2'); + end +end diff --git a/tests/expected/matlab/FindKarcherMeanRot3.m b/tests/expected/matlab/FindKarcherMeanRot3.m new file mode 100644 index 0000000..8ed9f15 --- /dev/null +++ b/tests/expected/matlab/FindKarcherMeanRot3.m @@ -0,0 +1,7 @@ +function varargout = FindKarcherMeanRot3(varargin) + if length(varargin) == 1 && isa(varargin{1},'std.vectorgtsam::Rot3') + varargout{1} = functions_wrapper(31, varargin{:}); + else + error('Arguments do not match any overload of function FindKarcherMeanRot3'); + end +end diff --git a/tests/expected/matlab/FindKarcherMeanSO3.m b/tests/expected/matlab/FindKarcherMeanSO3.m new file mode 100644 index 0000000..c02081a --- /dev/null +++ b/tests/expected/matlab/FindKarcherMeanSO3.m @@ -0,0 +1,7 @@ +function varargout = FindKarcherMeanSO3(varargin) + if length(varargin) == 1 && isa(varargin{1},'std.vectorgtsam::SO3') + varargout{1} = functions_wrapper(29, varargin{:}); + else + error('Arguments do not match any overload of function FindKarcherMeanSO3'); + end +end diff --git a/tests/expected/matlab/FindKarcherMeanSO4.m b/tests/expected/matlab/FindKarcherMeanSO4.m new file mode 100644 index 0000000..9b01976 --- /dev/null +++ b/tests/expected/matlab/FindKarcherMeanSO4.m @@ -0,0 +1,7 @@ +function varargout = FindKarcherMeanSO4(varargin) + if length(varargin) == 1 && isa(varargin{1},'std.vectorgtsam::SO4') + varargout{1} = functions_wrapper(30, varargin{:}); + else + error('Arguments do not match any overload of function FindKarcherMeanSO4'); + end +end diff --git a/tests/expected/matlab/MultiTemplatedFunctionDoubleSize_tDouble.m b/tests/expected/matlab/MultiTemplatedFunctionDoubleSize_tDouble.m index 11785c1..9980128 100644 --- a/tests/expected/matlab/MultiTemplatedFunctionDoubleSize_tDouble.m +++ b/tests/expected/matlab/MultiTemplatedFunctionDoubleSize_tDouble.m @@ -1,5 +1,5 @@ function varargout = MultiTemplatedFunctionDoubleSize_tDouble(varargin) - if length(varargin) == 2 && isa(varargin{1},'T') && isa(varargin{2},'numeric') + if length(varargin) == 2 && isa(varargin{1},'double') && isa(varargin{2},'numeric') varargout{1} = functions_wrapper(7, varargin{:}); else error('Arguments do not match any overload of function MultiTemplatedFunctionDoubleSize_tDouble'); diff --git a/tests/expected/matlab/MultiTemplatedFunctionStringSize_tDouble.m b/tests/expected/matlab/MultiTemplatedFunctionStringSize_tDouble.m index 1dae96c..50b4da6 100644 --- a/tests/expected/matlab/MultiTemplatedFunctionStringSize_tDouble.m +++ b/tests/expected/matlab/MultiTemplatedFunctionStringSize_tDouble.m @@ -1,5 +1,5 @@ function varargout = MultiTemplatedFunctionStringSize_tDouble(varargin) - if length(varargin) == 2 && isa(varargin{1},'T') && isa(varargin{2},'numeric') + if length(varargin) == 2 && isa(varargin{1},'char') && isa(varargin{2},'numeric') varargout{1} = functions_wrapper(6, varargin{:}); else error('Arguments do not match any overload of function MultiTemplatedFunctionStringSize_tDouble'); diff --git a/tests/expected/matlab/TemplatedFunctionRot3.m b/tests/expected/matlab/TemplatedFunctionRot3.m index 07dbd62..3dbe5c4 100644 --- a/tests/expected/matlab/TemplatedFunctionRot3.m +++ b/tests/expected/matlab/TemplatedFunctionRot3.m @@ -1,6 +1,6 @@ function varargout = TemplatedFunctionRot3(varargin) if length(varargin) == 1 && isa(varargin{1},'gtsam.Rot3') - functions_wrapper(26, varargin{:}); + functions_wrapper(32, varargin{:}); else error('Arguments do not match any overload of function TemplatedFunctionRot3'); end diff --git a/tests/expected/matlab/functions_wrapper.cpp b/tests/expected/matlab/functions_wrapper.cpp index 2e52120..7ec9638 100644 --- a/tests/expected/matlab/functions_wrapper.cpp +++ b/tests/expected/matlab/functions_wrapper.cpp @@ -108,16 +108,16 @@ void overloadedGlobalFunction_5(int nargout, mxArray *out[], int nargin, const m void MultiTemplatedFunctionStringSize_tDouble_6(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("MultiTemplatedFunctionStringSize_tDouble",nargout,nargin,2); - T& x = *unwrap_shared_ptr< T >(in[0], "ptr_T"); + string& x = *unwrap_shared_ptr< string >(in[0], "ptr_string"); size_t y = unwrap< size_t >(in[1]); - out[0] = wrap< double >(MultiTemplatedFunctionStringSize_tDouble(x,y)); + out[0] = wrap< double >(MultiTemplatedFunction(x,y)); } void MultiTemplatedFunctionDoubleSize_tDouble_7(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("MultiTemplatedFunctionDoubleSize_tDouble",nargout,nargin,2); - T& x = *unwrap_shared_ptr< T >(in[0], "ptr_T"); + double x = unwrap< double >(in[0]); size_t y = unwrap< size_t >(in[1]); - out[0] = wrap< double >(MultiTemplatedFunctionDoubleSize_tDouble(x,y)); + out[0] = wrap< double >(MultiTemplatedFunction(x,y)); } void DefaultFuncInt_8(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { @@ -238,11 +238,56 @@ void EliminateDiscrete_25(int nargout, mxArray *out[], int nargin, const mxArray out[0] = wrap_shared_ptr(pairResult.first,"gtsam.DiscreteConditional", false); out[1] = wrap_shared_ptr(pairResult.second,"gtsam.DecisionTreeFactor", false); } -void TemplatedFunctionRot3_26(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void triangulatePoint3Cal3_S2_26(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("triangulatePoint3Cal3_S2",nargout,nargin,6); + gtsam::Pose3Vector& poses = *unwrap_shared_ptr< gtsam::Pose3Vector >(in[0], "ptr_gtsamPose3Vector"); + std::shared_ptr sharedCal = unwrap_shared_ptr< gtsam::Cal3_S2 >(in[1], "ptr_gtsamCal3_S2"); + gtsam::Point2Vector& measurements = *unwrap_shared_ptr< gtsam::Point2Vector >(in[2], "ptr_gtsamPoint2Vector"); + double rank_tol = unwrap< double >(in[3]); + bool optimize = unwrap< bool >(in[4]); + gtsam::SharedNoiseModel& model = *unwrap_shared_ptr< gtsam::SharedNoiseModel >(in[5], "ptr_gtsamSharedNoiseModel"); + out[0] = wrap< Point3 >(triangulatePoint3(poses,sharedCal,measurements,rank_tol,optimize,model)); +} +void triangulatePoint3Cal3_S2_27(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("triangulatePoint3Cal3_S2",nargout,nargin,5); + gtsam::Pose3Vector& poses = *unwrap_shared_ptr< gtsam::Pose3Vector >(in[0], "ptr_gtsamPose3Vector"); + std::shared_ptr sharedCal = unwrap_shared_ptr< gtsam::Cal3_S2 >(in[1], "ptr_gtsamCal3_S2"); + gtsam::Point2Vector& measurements = *unwrap_shared_ptr< gtsam::Point2Vector >(in[2], "ptr_gtsamPoint2Vector"); + double rank_tol = unwrap< double >(in[3]); + bool optimize = unwrap< bool >(in[4]); + out[0] = wrap< Point3 >(triangulatePoint3(poses,sharedCal,measurements,rank_tol,optimize,nullptr)); +} +void FindKarcherMeanPoint3_28(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("FindKarcherMeanPoint3",nargout,nargin,1); + std::vector& elements = *unwrap_shared_ptr< std::vector >(in[0], "ptr_stdvectorgtsam::Point3"); + out[0] = wrap< Point3 >(FindKarcherMean(elements)); +} +void FindKarcherMeanSO3_29(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("FindKarcherMeanSO3",nargout,nargin,1); + std::vector& elements = *unwrap_shared_ptr< std::vector >(in[0], "ptr_stdvectorgtsam::SO3"); + out[0] = wrap_shared_ptr(std::make_shared(FindKarcherMean(elements)),"gtsam.SO3", false); +} +void FindKarcherMeanSO4_30(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("FindKarcherMeanSO4",nargout,nargin,1); + std::vector& elements = *unwrap_shared_ptr< std::vector >(in[0], "ptr_stdvectorgtsam::SO4"); + out[0] = wrap_shared_ptr(std::make_shared(FindKarcherMean(elements)),"gtsam.SO4", false); +} +void FindKarcherMeanPose3_31(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("FindKarcherMeanPose3",nargout,nargin,1); + std::vector& elements = *unwrap_shared_ptr< std::vector >(in[0], "ptr_stdvectorgtsam::Pose3"); + out[0] = wrap_shared_ptr(std::make_shared(FindKarcherMean(elements)),"gtsam.Pose3", false); +} +void TemplatedFunctionRot3_32(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("TemplatedFunctionRot3",nargout,nargin,1); gtsam::Rot3& t = *unwrap_shared_ptr< gtsam::Rot3 >(in[0], "ptr_gtsamRot3"); - TemplatedFunctionRot3(t); + TemplatedFunction(t); } void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) @@ -335,7 +380,25 @@ void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) EliminateDiscrete_25(nargout, out, nargin-1, in+1); break; case 26: - TemplatedFunctionRot3_26(nargout, out, nargin-1, in+1); + triangulatePoint3Cal3_S2_26(nargout, out, nargin-1, in+1); + break; + case 27: + triangulatePoint3Cal3_S2_27(nargout, out, nargin-1, in+1); + break; + case 28: + FindKarcherMeanPoint3_28(nargout, out, nargin-1, in+1); + break; + case 29: + FindKarcherMeanSO3_29(nargout, out, nargin-1, in+1); + break; + case 30: + FindKarcherMeanSO4_30(nargout, out, nargin-1, in+1); + break; + case 31: + FindKarcherMeanPose3_31(nargout, out, nargin-1, in+1); + break; + case 32: + TemplatedFunctionRot3_32(nargout, out, nargin-1, in+1); break; } } catch(const std::exception& e) { diff --git a/tests/expected/matlab/triangulatePoint3Cal3_S2.m b/tests/expected/matlab/triangulatePoint3Cal3_S2.m new file mode 100644 index 0000000..d4bb986 --- /dev/null +++ b/tests/expected/matlab/triangulatePoint3Cal3_S2.m @@ -0,0 +1,9 @@ +function varargout = triangulatePoint3Cal3_S2(varargin) + if length(varargin) == 6 && isa(varargin{1},'gtsam.Pose3Vector') && isa(varargin{2},'gtsam.Cal3_S2') && isa(varargin{3},'gtsam.Point2Vector') && isa(varargin{4},'double') && isa(varargin{5},'logical') && isa(varargin{6},'gtsam.SharedNoiseModel') + varargout{1} = functions_wrapper(26, varargin{:}); + elseif length(varargin) == 5 && isa(varargin{1},'gtsam.Pose3Vector') && isa(varargin{2},'gtsam.Cal3_S2') && isa(varargin{3},'gtsam.Point2Vector') && isa(varargin{4},'double') && isa(varargin{5},'logical') + varargout{1} = functions_wrapper(27, varargin{:}); + else + error('Arguments do not match any overload of function triangulatePoint3Cal3_S2'); + end +end diff --git a/tests/expected/python/functions_pybind.cpp b/tests/expected/python/functions_pybind.cpp index dcbd9ee..0b7772c 100644 --- a/tests/expected/python/functions_pybind.cpp +++ b/tests/expected/python/functions_pybind.cpp @@ -22,8 +22,8 @@ PYBIND11_MODULE(functions_py, m_) { m_.def("aGlobalFunction",[](){return ::aGlobalFunction();}); m_.def("overloadedGlobalFunction",[](int a){return ::overloadedGlobalFunction(a);}, py::arg("a")); m_.def("overloadedGlobalFunction",[](int a, double b){return ::overloadedGlobalFunction(a, b);}, py::arg("a"), py::arg("b")); - m_.def("MultiTemplatedFunctionStringSize_tDouble",[](const T& x, size_t y){return ::MultiTemplatedFunction(x, y);}, py::arg("x"), py::arg("y")); - m_.def("MultiTemplatedFunctionDoubleSize_tDouble",[](const T& x, size_t y){return ::MultiTemplatedFunction(x, y);}, py::arg("x"), py::arg("y")); + m_.def("MultiTemplatedFunctionStringSize_tDouble",[](const string& x, size_t y){return ::MultiTemplatedFunction(x, y);}, py::arg("x"), py::arg("y")); + m_.def("MultiTemplatedFunctionDoubleSize_tDouble",[](const double& x, size_t y){return ::MultiTemplatedFunction(x, y);}, py::arg("x"), py::arg("y")); m_.def("DefaultFuncInt",[](int a, int b){ ::DefaultFuncInt(a, b);}, py::arg("a") = 123, py::arg("b") = 0); m_.def("DefaultFuncString",[](const string& s, const string& name){ ::DefaultFuncString(s, name);}, py::arg("s") = "hello", py::arg("name") = ""); m_.def("DefaultFuncObj",[](const gtsam::KeyFormatter& keyFormatter){ ::DefaultFuncObj(keyFormatter);}, py::arg("keyFormatter") = gtsam::DefaultKeyFormatter); @@ -31,6 +31,11 @@ PYBIND11_MODULE(functions_py, m_) { m_.def("DefaultFuncVector",[](const std::vector& i, const std::vector& s){ ::DefaultFuncVector(i, s);}, py::arg("i") = {1, 2, 3}, py::arg("s") = {"borglab", "gtsam"}); m_.def("setPose",[](const gtsam::Pose3& pose){ ::setPose(pose);}, py::arg("pose") = gtsam::Pose3()); m_.def("EliminateDiscrete",[](const gtsam::DiscreteFactorGraph& factors, const gtsam::Ordering& frontalKeys){return ::EliminateDiscrete(factors, frontalKeys);}, py::arg("factors"), py::arg("frontalKeys")); + m_.def("triangulatePoint3Cal3_S2",[](const gtsam::Pose3Vector& poses, std::shared_ptr sharedCal, const gtsam::Point2Vector& measurements, double rank_tol, bool optimize, const gtsam::SharedNoiseModel& model){return ::triangulatePoint3(poses, sharedCal, measurements, rank_tol, optimize, model);}, py::arg("poses"), py::arg("sharedCal"), py::arg("measurements"), py::arg("rank_tol"), py::arg("optimize"), py::arg("model") = nullptr); + m_.def("FindKarcherMeanPoint3",[](const std::vector& elements){return ::FindKarcherMean(elements);}, py::arg("elements")); + m_.def("FindKarcherMeanSO3",[](const std::vector& elements){return ::FindKarcherMean(elements);}, py::arg("elements")); + m_.def("FindKarcherMeanSO4",[](const std::vector& elements){return ::FindKarcherMean(elements);}, py::arg("elements")); + m_.def("FindKarcherMeanPose3",[](const std::vector& elements){return ::FindKarcherMean(elements);}, py::arg("elements")); m_.def("TemplatedFunctionRot3",[](const gtsam::Rot3& t){ ::TemplatedFunction(t);}, py::arg("t")); #include "python/specializations.h" diff --git a/tests/fixtures/functions.i b/tests/fixtures/functions.i index 26978cd..ec901f7 100644 --- a/tests/fixtures/functions.i +++ b/tests/fixtures/functions.i @@ -19,12 +19,11 @@ gtsam::Vector overloadedGlobalFunction(int a, double b); // A templated free/global function. Multiple templates supported. template -R MultiTemplatedFunction(const T& x, T2 y); +R MultiTemplatedFunction(const T1& x, T2 y); // Check if we can typedef the templated function template void TemplatedFunction(const T& t); - typedef TemplatedFunction TemplatedFunctionRot3; // Check default arguments @@ -40,3 +39,14 @@ void setPose(const gtsam::Pose3& pose = gtsam::Pose3()); std::pair EliminateDiscrete(const gtsam::DiscreteFactorGraph& factors, const gtsam::Ordering& frontalKeys); + +// Example of function where template is a shared pointer +template +gtsam::Point3 triangulatePoint3(const gtsam::Pose3Vector& poses, CAL* sharedCal, + const gtsam::Point2Vector& measurements, + double rank_tol, bool optimize, + const gtsam::SharedNoiseModel& model = nullptr); + +// Function which takes vector as an argument +template +T FindKarcherMean(const std::vector& elements); diff --git a/tests/test_matlab_wrapper.py b/tests/test_matlab_wrapper.py index 0ca95b6..8f58026 100644 --- a/tests/test_matlab_wrapper.py +++ b/tests/test_matlab_wrapper.py @@ -105,6 +105,12 @@ def test_functions(self): 'DefaultFuncVector.m', 'DefaultFuncZero.m', 'setPose.m', + 'EliminateDiscrete.m', + 'triangulatePoint3Cal3_S2.m', + 'FindKarcherMeanPoint3.m', + 'FindKarcherMeanSO3.m', + 'FindKarcherMeanSO4.m', + 'FindKarcherMeanPose3.m', ] for file in files: From 055fee301ac7190684048c764e1a00ae50caa1eb Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 25 Nov 2025 02:36:12 -0500 Subject: [PATCH 04/12] get_typename helper method --- gtwrap/interface_parser/type.py | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/gtwrap/interface_parser/type.py b/gtwrap/interface_parser/type.py index 02fe886..a02b467 100644 --- a/gtwrap/interface_parser/type.py +++ b/gtwrap/interface_parser/type.py @@ -212,6 +212,13 @@ def __repr__(self) -> str: is_const="const " if self.is_const else "", is_ptr_or_ref=" " + is_ptr_or_ref if is_ptr_or_ref else "") + def get_typename(self): + """ + Get the typename of this type without any qualifiers. + E.g. for `const gtsam::Pose3& pose` this will return `gtsam::Pose3`. + """ + return self.typename.to_cpp() + def to_cpp(self) -> str: """ Generate the C++ code for wrapping. @@ -221,22 +228,18 @@ def to_cpp(self) -> str: if self.is_shared_ptr: typename = "std::shared_ptr<{typename}>".format( - typename=self.typename.to_cpp()) + typename=self.get_typename()) elif self.is_ptr: typename = "{typename}*".format(typename=self.typename.to_cpp()) elif self.is_ref: typename = typename = "{typename}&".format( - typename=self.typename.to_cpp()) + typename=self.get_typename()) else: - typename = self.typename.to_cpp() + typename = self.get_typename() return ("{const}{typename}".format( const="const " if self.is_const else "", typename=typename)) - def get_typename(self): - """Convenience method to get the typename of this type.""" - return self.typename.name - class TemplatedType: """ @@ -283,16 +286,21 @@ def __repr__(self): return "TemplatedType({typename.namespaces}::{typename.name})".format( typename=self.typename) - def to_cpp(self): + def get_typename(self): """ - Generate the C++ code for wrapping. + Get the typename of this type without any qualifiers. + E.g. for `const std::vector& indices` this will return `std::vector`. """ # Use Type.to_cpp to do the heavy lifting for the template parameters. template_args = ", ".join([t.to_cpp() for t in self.template_params]) - typename = "{typename}<{template_args}>".format( - typename=self.typename.qualified_name(), - template_args=template_args) + return f"{self.typename.qualified_name()}<{template_args}>" + + def to_cpp(self): + """ + Generate the C++ code for wrapping. + """ + typename = self.get_typename() if self.is_shared_ptr: typename = f"std::shared_ptr<{typename}>" From 8534beb534f491d5e8419144c4e6e7a4f568aabf Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 25 Nov 2025 02:36:34 -0500 Subject: [PATCH 05/12] small improvements to matlab wrapper main code --- gtwrap/matlab_wrapper/wrapper.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gtwrap/matlab_wrapper/wrapper.py b/gtwrap/matlab_wrapper/wrapper.py index 9cd367c..36367e4 100755 --- a/gtwrap/matlab_wrapper/wrapper.py +++ b/gtwrap/matlab_wrapper/wrapper.py @@ -108,7 +108,8 @@ def _update_wrapper_id(self, Args: collector_function: tuple storing info about the wrapper function - (namespace, class instance, function name, function object) + (namespace, class/function instance, + type of collector function, method object if class instance) id_diff: constant to add to the id in the map function_name: Optional custom function_name. @@ -578,6 +579,7 @@ def wrap_global_function(self, function): # Get all combinations of parameters param_wrap = '' + # Iterate through possible overloads of the function for i, overload in enumerate(function): param_wrap += ' if' if i == 0 else ' elseif' param_wrap += ' length(varargin) == ' @@ -1218,7 +1220,7 @@ def wrap_namespace(self, namespace, add_mex_file=True): if isinstance(func, parser.GlobalFunction) ] - self.wrap_methods(all_funcs, True, global_ns=namespace) + self.wrap_methods(all_funcs, global_funcs=True, global_ns=namespace) return wrapped @@ -1365,8 +1367,8 @@ def wrap_collector_function_return(self, method, instantiated_class=None): method_name += method.original.name elif isinstance(method, parser.GlobalFunction): - method_name = self._format_global_function(method, '::') - method_name += method.name + namespace = self._format_global_function(method, '::') + method_name = namespace + method.to_cpp() else: if isinstance(method.parent, instantiator.InstantiatedClass): @@ -1624,7 +1626,7 @@ def generate_collector_function(self, func_id): body += self._wrapper_unwrap_arguments(collector_func[1].args)[1] body += self.wrap_collector_function_return( - collector_func[1]) + '\n}\n' + collector_func[1]) + "\n}\n" collector_function += body From 30d2465b95b35a8ea8045c5d5f4d37b4a90e5b65 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 25 Nov 2025 02:36:58 -0500 Subject: [PATCH 06/12] use string version of name when formatting typename for use in dict --- gtwrap/matlab_wrapper/mixins.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtwrap/matlab_wrapper/mixins.py b/gtwrap/matlab_wrapper/mixins.py index df4de98..1bc7b0f 100644 --- a/gtwrap/matlab_wrapper/mixins.py +++ b/gtwrap/matlab_wrapper/mixins.py @@ -133,6 +133,9 @@ def _format_type_name(self, if name not in self.ignore_namespace and namespace != '': formatted_type_name += namespace + separator + # Get string representation so we can use as dict key. + name = str(name) + if is_constructor: formatted_type_name += self.data_type.get(name) or name elif is_method: From 227e0c6a725ead82dadbcfe9caac11cf152ac0fe Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 25 Nov 2025 02:37:12 -0500 Subject: [PATCH 07/12] more improvements --- gtwrap/template_instantiator/function.py | 9 ++++----- gtwrap/template_instantiator/helpers.py | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gtwrap/template_instantiator/function.py b/gtwrap/template_instantiator/function.py index 37c91f1..fe0e2bd 100644 --- a/gtwrap/template_instantiator/function.py +++ b/gtwrap/template_instantiator/function.py @@ -14,6 +14,7 @@ class InstantiatedGlobalFunction(parser.GlobalFunction): template T add(const T& x, const T& y); """ + def __init__(self, original, instantiations=(), new_name=''): self.original = original self.instantiations = instantiations @@ -54,16 +55,14 @@ def __init__(self, original, instantiations=(), new_name=''): def to_cpp(self): """Generate the C++ code for wrapping.""" if self.original.template: - instantiated_names = [ + instantiated_params = [ "::".join(inst.namespaces + [inst.instantiated_name()]) for inst in self.instantiations ] - ret = "{}<{}>".format(self.original.name, - ",".join(instantiated_names)) + ret = f"{self.original.name}<{','.join(instantiated_params)}>" else: ret = self.original.name return ret def __repr__(self): - return "Instantiated {}".format( - super(InstantiatedGlobalFunction, self).__repr__()) + return f"Instantiated {self.__repr__}" diff --git a/gtwrap/template_instantiator/helpers.py b/gtwrap/template_instantiator/helpers.py index 194c6f6..ddcfbc8 100644 --- a/gtwrap/template_instantiator/helpers.py +++ b/gtwrap/template_instantiator/helpers.py @@ -63,7 +63,6 @@ def instantiate_type( ctype.typename.instantiations[idx].name =\ instantiations[template_idx] - str_arg_typename = str(ctype.typename) # Check if template is a scoped template e.g. T::Value where T is the template @@ -88,6 +87,7 @@ def instantiate_type( is_ref=ctype.is_ref, is_basic=ctype.is_basic, ) + # Check for exact template match. elif str_arg_typename in template_typenames: idx = template_typenames.index(str_arg_typename) @@ -228,6 +228,7 @@ class InstantiationHelper: parent=parent) ``` """ + def __init__(self, instantiation_type: InstantiatedMembers): self.instantiation_type = instantiation_type From dcc2d15298570ca1ef8ddab3bbb40327a639eee9 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 25 Nov 2025 12:10:52 -0500 Subject: [PATCH 08/12] some minor refactor --- gtwrap/interface_parser/type.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gtwrap/interface_parser/type.py b/gtwrap/interface_parser/type.py index a02b467..6d2a2b8 100644 --- a/gtwrap/interface_parser/type.py +++ b/gtwrap/interface_parser/type.py @@ -40,7 +40,6 @@ class Typename: """ namespaces_name_rule = delimitedList(IDENT, "::") - instantiation_name_rule = delimitedList(IDENT, "::") rule = ( namespaces_name_rule("namespaces_and_name") # ).setParseAction(lambda t: Typename(t)) @@ -164,7 +163,7 @@ class Type: """ rule = ( Optional(CONST("is_const")) # - + (BasicType.rule("basic") | CustomType.rule("qualified")) # BR + + (BasicType.rule("basic") | CustomType.rule("custom")) # BR + Optional( SHARED_POINTER("is_shared_ptr") | RAW_POINTER("is_ptr") | REF("is_ref")) # @@ -192,9 +191,9 @@ def from_parse_result(t: ParseResults): is_ref=t.is_ref, is_basic=True, ) - elif t.qualified: + elif t.custom: return Type( - typename=t.qualified.typename, + typename=t.custom.typename, is_const=t.is_const, is_shared_ptr=t.is_shared_ptr, is_ptr=t.is_ptr, From f195602ecf4542e63f9176bb852ff2c2ba32e5c1 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Wed, 26 Nov 2025 01:30:10 -0500 Subject: [PATCH 09/12] fix repr --- gtwrap/template_instantiator/function.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtwrap/template_instantiator/function.py b/gtwrap/template_instantiator/function.py index fe0e2bd..1d304d6 100644 --- a/gtwrap/template_instantiator/function.py +++ b/gtwrap/template_instantiator/function.py @@ -65,4 +65,4 @@ def to_cpp(self): return ret def __repr__(self): - return f"Instantiated {self.__repr__}" + return f"Instantiated {super().__repr__}" From 86447d1d360f9239a06632d71fd043dc398db5db Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 28 Nov 2025 11:50:56 -0500 Subject: [PATCH 10/12] fixes to support gtsam::Key as an alias --- gtwrap/matlab_wrapper/mixins.py | 14 ++++++++++++-- gtwrap/matlab_wrapper/wrapper.py | 8 +++++--- matlab.h | 15 +++++++++++++++ 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/gtwrap/matlab_wrapper/mixins.py b/gtwrap/matlab_wrapper/mixins.py index 1bc7b0f..b0943ce 100644 --- a/gtwrap/matlab_wrapper/mixins.py +++ b/gtwrap/matlab_wrapper/mixins.py @@ -9,8 +9,15 @@ class CheckMixin: """Mixin to provide various checks.""" # Data types that are primitive types - not_ptr_type: Tuple = ('int', 'double', 'bool', 'char', 'unsigned char', - 'size_t') + not_ptr_type: Tuple = ( + "int", + "double", + "bool", + "char", + "unsigned char", + "size_t", + "Key", # This is an alias for a uint64_t + ) # Ignore the namespace for these datatypes ignore_namespace: Tuple = ('Matrix', 'Vector', 'Point2', 'Point3') # Methods that should be ignored @@ -111,6 +118,9 @@ def _format_type_name(self, is_constructor: bool = False, is_method: bool = False): """ + Helper method to get the string version of `type_name` which can go into the wrapper generated C++ code. + This is specific to the semantics of Matlab. + Args: type_name: an interface_parser.Typename to reformat separator: the statement to add between namespaces and typename diff --git a/gtwrap/matlab_wrapper/wrapper.py b/gtwrap/matlab_wrapper/wrapper.py index 36367e4..6bc354c 100755 --- a/gtwrap/matlab_wrapper/wrapper.py +++ b/gtwrap/matlab_wrapper/wrapper.py @@ -53,6 +53,7 @@ def __init__(self, 'Matrix': 'double', 'int': 'numeric', 'size_t': 'numeric', + 'Key': 'numeric', 'bool': 'logical' } # Map the data type into the type used in Matlab methods. @@ -68,6 +69,7 @@ def __init__(self, 'Point3': 'double', 'Vector': 'double', 'Matrix': 'double', + 'Key': 'numeric', 'bool': 'bool' } # The amount of times the wrapper has created a call to geometry_wrapper @@ -373,9 +375,9 @@ def _unwrap_argument(self, arg, arg_id=0, instantiated_class=None): ctype_sep=ctype_sep, ctype=ctype_camel, id=arg_id) else: - arg_type = "{ctype}".format(ctype=arg.ctype.typename.name) + arg_type = "{ctype}".format(ctype=self._format_type_name(arg.ctype.typename)) unwrap = 'unwrap< {ctype} >(in[{id}]);'.format( - ctype=arg.ctype.typename.name, id=arg_id) + ctype=self._format_type_name(arg.ctype.typename), id=arg_id) return arg_type, unwrap @@ -1335,7 +1337,7 @@ def _collector_return(self, prefix=' ') else: expanded += ' out[0] = wrap< {0} >({1});'.format( - ctype.typename.name, obj) + self._format_type_name(ctype.typename), obj) return expanded diff --git a/matlab.h b/matlab.h index f442947..5c7cf7a 100644 --- a/matlab.h +++ b/matlab.h @@ -175,6 +175,14 @@ mxArray* wrap(const int& value) { return result; } +// specialization to gtsam::Key which is an alias for uint64_t +template<> +mxArray* wrap(const uint64_t& value) { + mxArray *result = scalar(mxUINT32OR64_CLASS); + *(uint64_t*)mxGetData(result) = value; + return result; +} + // specialization to double -> just double template<> mxArray* wrap(const double& value) { @@ -330,6 +338,13 @@ int unwrap(const mxArray* array) { return myGetScalar(array); } +// specialization to gtsam::Key which is an alias for uint64_t +template<> +uint64_t unwrap(const mxArray* array) { + checkScalar(array,"unwrap"); + return myGetScalar(array); +} + // specialization to size_t template<> size_t unwrap(const mxArray* array) { From 3df0c29766312af1b1de124a0426ce0559704451 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 28 Nov 2025 12:09:16 -0500 Subject: [PATCH 11/12] added missing tests --- tests/expected/matlab/FindKarcherMeanPoint2.m | 7 - tests/expected/matlab/ForwardKinematics.m | 8 +- tests/expected/matlab/HessianFactor.m | 41 +++ .../matlab/MultipleTemplatesIntDouble.m | 4 +- .../matlab/MultipleTemplatesIntFloat.m | 4 +- tests/expected/matlab/MyFactorPosePoint2.m | 12 +- tests/expected/matlab/MyTemplateA.m | 182 ++++++++++++ tests/expected/matlab/MyVector12.m | 6 +- tests/expected/matlab/MyVector3.m | 6 +- .../expected/matlab/ParentHasTemplateDouble.m | 36 +++ tests/expected/matlab/Pet.m | 86 ++++++ tests/expected/matlab/PrimitiveRefDouble.m | 8 +- tests/expected/matlab/Test.m | 75 +++-- tests/expected/matlab/class_wrapper.cpp | 279 ++++++++++-------- tests/fixtures/class.i | 6 + tests/test_matlab_wrapper.py | 6 +- 16 files changed, 586 insertions(+), 180 deletions(-) delete mode 100644 tests/expected/matlab/FindKarcherMeanPoint2.m create mode 100644 tests/expected/matlab/HessianFactor.m create mode 100644 tests/expected/matlab/MyTemplateA.m create mode 100644 tests/expected/matlab/ParentHasTemplateDouble.m create mode 100644 tests/expected/matlab/Pet.m diff --git a/tests/expected/matlab/FindKarcherMeanPoint2.m b/tests/expected/matlab/FindKarcherMeanPoint2.m deleted file mode 100644 index bb048d5..0000000 --- a/tests/expected/matlab/FindKarcherMeanPoint2.m +++ /dev/null @@ -1,7 +0,0 @@ -function varargout = FindKarcherMeanPoint2(varargin) - if length(varargin) == 1 && isa(varargin{1},'std.vectorgtsam::Point2') - varargout{1} = functions_wrapper(28, varargin{:}); - else - error('Arguments do not match any overload of function FindKarcherMeanPoint2'); - end -end diff --git a/tests/expected/matlab/ForwardKinematics.m b/tests/expected/matlab/ForwardKinematics.m index 1554df3..fa41e53 100644 --- a/tests/expected/matlab/ForwardKinematics.m +++ b/tests/expected/matlab/ForwardKinematics.m @@ -12,11 +12,11 @@ function obj = ForwardKinematics(varargin) if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682) my_ptr = varargin{2}; - class_wrapper(63, my_ptr); + class_wrapper(66, my_ptr); elseif nargin == 5 && isa(varargin{1},'gtdynamics.Robot') && isa(varargin{2},'char') && isa(varargin{3},'char') && isa(varargin{4},'gtsam.Values') && isa(varargin{5},'gtsam.Pose3') - my_ptr = class_wrapper(64, varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); + my_ptr = class_wrapper(67, varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); elseif nargin == 4 && isa(varargin{1},'gtdynamics.Robot') && isa(varargin{2},'char') && isa(varargin{3},'char') && isa(varargin{4},'gtsam.Values') - my_ptr = class_wrapper(65, varargin{1}, varargin{2}, varargin{3}, varargin{4}); + my_ptr = class_wrapper(68, varargin{1}, varargin{2}, varargin{3}, varargin{4}); else error('Arguments do not match any overload of ForwardKinematics constructor'); end @@ -24,7 +24,7 @@ end function delete(obj) - class_wrapper(66, obj.ptr_ForwardKinematics); + class_wrapper(69, obj.ptr_ForwardKinematics); end function display(obj), obj.print(''); end diff --git a/tests/expected/matlab/HessianFactor.m b/tests/expected/matlab/HessianFactor.m new file mode 100644 index 0000000..9e189ab --- /dev/null +++ b/tests/expected/matlab/HessianFactor.m @@ -0,0 +1,41 @@ +%class HessianFactor, see Doxygen page for details +%at https://gtsam.org/doxygen/ +% +%-------Constructors------- +%HessianFactor(KeyVector js, vector Gs, vector gs, double f) +% +classdef HessianFactor < gtsam.GaussianFactor + properties + ptr_HessianFactor = 0 + end + methods + function obj = HessianFactor(varargin) + if (nargin == 2 || (nargin == 3 && strcmp(varargin{3}, 'void'))) && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682) + if nargin == 2 + my_ptr = varargin{2}; + else + my_ptr = class_wrapper(80, varargin{2}); + end + base_ptr = class_wrapper(79, my_ptr); + elseif nargin == 4 && isa(varargin{1},'gtsam.KeyVector') && isa(varargin{2},'std.vectordouble') && isa(varargin{3},'std.vectordouble') && isa(varargin{4},'double') + [ my_ptr, base_ptr ] = class_wrapper(81, varargin{1}, varargin{2}, varargin{3}, varargin{4}); + else + error('Arguments do not match any overload of HessianFactor constructor'); + end + obj = obj@gtsam.GaussianFactor(uint64(5139824614673773682), base_ptr); + obj.ptr_HessianFactor = my_ptr; + end + + function delete(obj) + class_wrapper(82, obj.ptr_HessianFactor); + end + + function display(obj), obj.print(''); end + %DISPLAY Calls print on the object + function disp(obj), obj.display; end + %DISP Calls print on the object + end + + methods(Static = true) + end +end diff --git a/tests/expected/matlab/MultipleTemplatesIntDouble.m b/tests/expected/matlab/MultipleTemplatesIntDouble.m index c726732..61fd990 100644 --- a/tests/expected/matlab/MultipleTemplatesIntDouble.m +++ b/tests/expected/matlab/MultipleTemplatesIntDouble.m @@ -9,7 +9,7 @@ function obj = MultipleTemplatesIntDouble(varargin) if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682) my_ptr = varargin{2}; - class_wrapper(59, my_ptr); + class_wrapper(62, my_ptr); else error('Arguments do not match any overload of MultipleTemplatesIntDouble constructor'); end @@ -17,7 +17,7 @@ end function delete(obj) - class_wrapper(60, obj.ptr_MultipleTemplatesIntDouble); + class_wrapper(63, obj.ptr_MultipleTemplatesIntDouble); end function display(obj), obj.print(''); end diff --git a/tests/expected/matlab/MultipleTemplatesIntFloat.m b/tests/expected/matlab/MultipleTemplatesIntFloat.m index f3c1188..aeb8141 100644 --- a/tests/expected/matlab/MultipleTemplatesIntFloat.m +++ b/tests/expected/matlab/MultipleTemplatesIntFloat.m @@ -9,7 +9,7 @@ function obj = MultipleTemplatesIntFloat(varargin) if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682) my_ptr = varargin{2}; - class_wrapper(61, my_ptr); + class_wrapper(64, my_ptr); else error('Arguments do not match any overload of MultipleTemplatesIntFloat constructor'); end @@ -17,7 +17,7 @@ end function delete(obj) - class_wrapper(62, obj.ptr_MultipleTemplatesIntFloat); + class_wrapper(65, obj.ptr_MultipleTemplatesIntFloat); end function display(obj), obj.print(''); end diff --git a/tests/expected/matlab/MyFactorPosePoint2.m b/tests/expected/matlab/MyFactorPosePoint2.m index 38d9d21..02016c6 100644 --- a/tests/expected/matlab/MyFactorPosePoint2.m +++ b/tests/expected/matlab/MyFactorPosePoint2.m @@ -15,9 +15,9 @@ function obj = MyFactorPosePoint2(varargin) if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682) my_ptr = varargin{2}; - class_wrapper(80, my_ptr); + class_wrapper(83, my_ptr); elseif nargin == 4 && isa(varargin{1},'numeric') && isa(varargin{2},'numeric') && isa(varargin{3},'double') && isa(varargin{4},'gtsam.noiseModel.Base') - my_ptr = class_wrapper(81, varargin{1}, varargin{2}, varargin{3}, varargin{4}); + my_ptr = class_wrapper(84, varargin{1}, varargin{2}, varargin{3}, varargin{4}); else error('Arguments do not match any overload of MyFactorPosePoint2 constructor'); end @@ -25,7 +25,7 @@ end function delete(obj) - class_wrapper(82, obj.ptr_MyFactorPosePoint2); + class_wrapper(85, obj.ptr_MyFactorPosePoint2); end function display(obj), obj.print(''); end @@ -36,19 +36,19 @@ function delete(obj) % PRINT usage: print(string s, KeyFormatter keyFormatter) : returns void % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 2 && isa(varargin{1},'char') && isa(varargin{2},'gtsam.KeyFormatter') - class_wrapper(83, this, varargin{:}); + class_wrapper(86, this, varargin{:}); return end % PRINT usage: print(string s) : returns void % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'char') - class_wrapper(84, this, varargin{:}); + class_wrapper(87, this, varargin{:}); return end % PRINT usage: print() : returns void % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 0 - class_wrapper(85, this, varargin{:}); + class_wrapper(88, this, varargin{:}); return end error('Arguments do not match any overload of function MyFactorPosePoint2.print'); diff --git a/tests/expected/matlab/MyTemplateA.m b/tests/expected/matlab/MyTemplateA.m new file mode 100644 index 0000000..dd0d9c6 --- /dev/null +++ b/tests/expected/matlab/MyTemplateA.m @@ -0,0 +1,182 @@ +%class MyTemplateA, see Doxygen page for details +%at https://gtsam.org/doxygen/ +% +%-------Constructors------- +%MyTemplateA() +% +%-------Methods------- +%accept_T(A value) : returns void +%accept_Tptr(A value) : returns void +%create_MixedPtrs() : returns pair< A, A > +%create_ptrs() : returns pair< A, A > +%return_T(A value) : returns A +%return_Tptr(A value) : returns A +%return_ptrs(A p1, A p2) : returns pair< A, A > +%templatedMethodMatrix(Matrix t) : returns Matrix +%templatedMethodPoint2(Point2 t) : returns Point2 +%templatedMethodPoint3(Point3 t) : returns Point3 +%templatedMethodVector(Vector t) : returns Vector +% +%-------Static Methods------- +%Level(A K) : returns MyTemplate +% +%-------Serialization Interface------- +%string_serialize() : returns string +%string_deserialize(string serialized) : returns MyTemplateA +% +classdef MyTemplateA < MyBase + properties + ptr_MyTemplateA = 0 + end + methods + function obj = MyTemplateA(varargin) + if (nargin == 2 || (nargin == 3 && strcmp(varargin{3}, 'void'))) && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682) + if nargin == 2 + my_ptr = varargin{2}; + else + my_ptr = inheritance_wrapper(36, varargin{2}); + end + base_ptr = inheritance_wrapper(35, my_ptr); + elseif nargin == 0 + [ my_ptr, base_ptr ] = inheritance_wrapper(37); + else + error('Arguments do not match any overload of MyTemplateA constructor'); + end + obj = obj@MyBase(uint64(5139824614673773682), base_ptr); + obj.ptr_MyTemplateA = my_ptr; + end + + function delete(obj) + inheritance_wrapper(38, obj.ptr_MyTemplateA); + end + + function display(obj), obj.print(''); end + %DISPLAY Calls print on the object + function disp(obj), obj.display; end + %DISP Calls print on the object + function varargout = accept_T(this, varargin) + % ACCEPT_T usage: accept_T(A value) : returns void + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 1 && isa(varargin{1},'A') + inheritance_wrapper(39, this, varargin{:}); + return + end + error('Arguments do not match any overload of function MyTemplateA.accept_T'); + end + + function varargout = accept_Tptr(this, varargin) + % ACCEPT_TPTR usage: accept_Tptr(A value) : returns void + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 1 && isa(varargin{1},'A') + inheritance_wrapper(40, this, varargin{:}); + return + end + error('Arguments do not match any overload of function MyTemplateA.accept_Tptr'); + end + + function varargout = create_MixedPtrs(this, varargin) + % CREATE_MIXEDPTRS usage: create_MixedPtrs() : returns pair< A, A > + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 0 + [ varargout{1} varargout{2} ] = inheritance_wrapper(41, this, varargin{:}); + return + end + error('Arguments do not match any overload of function MyTemplateA.create_MixedPtrs'); + end + + function varargout = create_ptrs(this, varargin) + % CREATE_PTRS usage: create_ptrs() : returns pair< A, A > + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 0 + [ varargout{1} varargout{2} ] = inheritance_wrapper(42, this, varargin{:}); + return + end + error('Arguments do not match any overload of function MyTemplateA.create_ptrs'); + end + + function varargout = return_T(this, varargin) + % RETURN_T usage: return_T(A value) : returns A + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 1 && isa(varargin{1},'A') + varargout{1} = inheritance_wrapper(43, this, varargin{:}); + return + end + error('Arguments do not match any overload of function MyTemplateA.return_T'); + end + + function varargout = return_Tptr(this, varargin) + % RETURN_TPTR usage: return_Tptr(A value) : returns A + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 1 && isa(varargin{1},'A') + varargout{1} = inheritance_wrapper(44, this, varargin{:}); + return + end + error('Arguments do not match any overload of function MyTemplateA.return_Tptr'); + end + + function varargout = return_ptrs(this, varargin) + % RETURN_PTRS usage: return_ptrs(A p1, A p2) : returns pair< A, A > + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 2 && isa(varargin{1},'A') && isa(varargin{2},'A') + [ varargout{1} varargout{2} ] = inheritance_wrapper(45, this, varargin{:}); + return + end + error('Arguments do not match any overload of function MyTemplateA.return_ptrs'); + end + + function varargout = templatedMethodMatrix(this, varargin) + % TEMPLATEDMETHODMATRIX usage: templatedMethodMatrix(Matrix t) : returns Matrix + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 1 && isa(varargin{1},'double') + varargout{1} = inheritance_wrapper(46, this, varargin{:}); + return + end + error('Arguments do not match any overload of function MyTemplateA.templatedMethodMatrix'); + end + + function varargout = templatedMethodPoint2(this, varargin) + % TEMPLATEDMETHODPOINT2 usage: templatedMethodPoint2(Point2 t) : returns Point2 + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},1)==2 && size(varargin{1},2)==1 + varargout{1} = inheritance_wrapper(47, this, varargin{:}); + return + end + error('Arguments do not match any overload of function MyTemplateA.templatedMethodPoint2'); + end + + function varargout = templatedMethodPoint3(this, varargin) + % TEMPLATEDMETHODPOINT3 usage: templatedMethodPoint3(Point3 t) : returns Point3 + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},1)==3 && size(varargin{1},2)==1 + varargout{1} = inheritance_wrapper(48, this, varargin{:}); + return + end + error('Arguments do not match any overload of function MyTemplateA.templatedMethodPoint3'); + end + + function varargout = templatedMethodVector(this, varargin) + % TEMPLATEDMETHODVECTOR usage: templatedMethodVector(Vector t) : returns Vector + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},2)==1 + varargout{1} = inheritance_wrapper(49, this, varargin{:}); + return + end + error('Arguments do not match any overload of function MyTemplateA.templatedMethodVector'); + end + + end + + methods(Static = true) + function varargout = Level(varargin) + % LEVEL usage: Level(A K) : returns MyTemplateA + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 1 && isa(varargin{1},'A') + varargout{1} = inheritance_wrapper(50, varargin{:}); + return + end + + error('Arguments do not match any overload of function MyTemplateA.Level'); + end + + end +end diff --git a/tests/expected/matlab/MyVector12.m b/tests/expected/matlab/MyVector12.m index 6b27e18..b3fc301 100644 --- a/tests/expected/matlab/MyVector12.m +++ b/tests/expected/matlab/MyVector12.m @@ -12,9 +12,9 @@ function obj = MyVector12(varargin) if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682) my_ptr = varargin{2}; - class_wrapper(56, my_ptr); + class_wrapper(59, my_ptr); elseif nargin == 0 - my_ptr = class_wrapper(57); + my_ptr = class_wrapper(60); else error('Arguments do not match any overload of MyVector12 constructor'); end @@ -22,7 +22,7 @@ end function delete(obj) - class_wrapper(58, obj.ptr_MyVector12); + class_wrapper(61, obj.ptr_MyVector12); end function display(obj), obj.print(''); end diff --git a/tests/expected/matlab/MyVector3.m b/tests/expected/matlab/MyVector3.m index 2c2f71c..b1c059c 100644 --- a/tests/expected/matlab/MyVector3.m +++ b/tests/expected/matlab/MyVector3.m @@ -12,9 +12,9 @@ function obj = MyVector3(varargin) if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682) my_ptr = varargin{2}; - class_wrapper(53, my_ptr); + class_wrapper(56, my_ptr); elseif nargin == 0 - my_ptr = class_wrapper(54); + my_ptr = class_wrapper(57); else error('Arguments do not match any overload of MyVector3 constructor'); end @@ -22,7 +22,7 @@ end function delete(obj) - class_wrapper(55, obj.ptr_MyVector3); + class_wrapper(58, obj.ptr_MyVector3); end function display(obj), obj.print(''); end diff --git a/tests/expected/matlab/ParentHasTemplateDouble.m b/tests/expected/matlab/ParentHasTemplateDouble.m new file mode 100644 index 0000000..caad16d --- /dev/null +++ b/tests/expected/matlab/ParentHasTemplateDouble.m @@ -0,0 +1,36 @@ +%class ParentHasTemplateDouble, see Doxygen page for details +%at https://gtsam.org/doxygen/ +% +classdef ParentHasTemplateDouble < MyTemplate + properties + ptr_ParentHasTemplateDouble = 0 + end + methods + function obj = ParentHasTemplateDouble(varargin) + if (nargin == 2 || (nargin == 3 && strcmp(varargin{3}, 'void'))) && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682) + if nargin == 2 + my_ptr = varargin{2}; + else + my_ptr = inheritance_wrapper(55, varargin{2}); + end + base_ptr = inheritance_wrapper(54, my_ptr); + else + error('Arguments do not match any overload of ParentHasTemplateDouble constructor'); + end + obj = obj@MyTemplatedouble(uint64(5139824614673773682), base_ptr); + obj.ptr_ParentHasTemplateDouble = my_ptr; + end + + function delete(obj) + inheritance_wrapper(56, obj.ptr_ParentHasTemplateDouble); + end + + function display(obj), obj.print(''); end + %DISPLAY Calls print on the object + function disp(obj), obj.display; end + %DISP Calls print on the object + end + + methods(Static = true) + end +end diff --git a/tests/expected/matlab/Pet.m b/tests/expected/matlab/Pet.m new file mode 100644 index 0000000..51a7589 --- /dev/null +++ b/tests/expected/matlab/Pet.m @@ -0,0 +1,86 @@ +%class Pet, see Doxygen page for details +%at https://gtsam.org/doxygen/ +% +%-------Constructors------- +%Pet(string name, Kind type) +% +%-------Properties------- +%name +%type +% +%-------Methods------- +%getColor() : returns Color +%setColor(Color color) : returns void +% +classdef Pet < handle + properties + ptr_Pet = 0 + name + type + end + methods + function obj = Pet(varargin) + if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682) + my_ptr = varargin{2}; + enum_wrapper(0, my_ptr); + elseif nargin == 2 && isa(varargin{1},'char') && isa(varargin{2},'Pet.Kind') + my_ptr = enum_wrapper(1, varargin{1}, varargin{2}); + else + error('Arguments do not match any overload of Pet constructor'); + end + obj.ptr_Pet = my_ptr; + end + + function delete(obj) + enum_wrapper(2, obj.ptr_Pet); + end + + function display(obj), obj.print(''); end + %DISPLAY Calls print on the object + function disp(obj), obj.display; end + %DISP Calls print on the object + function varargout = getColor(this, varargin) + % GETCOLOR usage: getColor() : returns Color + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 0 + varargout{1} = enum_wrapper(3, this, varargin{:}); + return + end + error('Arguments do not match any overload of function Pet.getColor'); + end + + function varargout = setColor(this, varargin) + % SETCOLOR usage: setColor(Color color) : returns void + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 1 && isa(varargin{1},'Color') + enum_wrapper(4, this, varargin{:}); + return + end + error('Arguments do not match any overload of function Pet.setColor'); + end + + + function varargout = get.name(this) + varargout{1} = enum_wrapper(5, this); + this.name = varargout{1}; + end + + function set.name(this, value) + obj.name = value; + enum_wrapper(6, this, value); + end + + function varargout = get.type(this) + varargout{1} = enum_wrapper(7, this); + this.type = varargout{1}; + end + + function set.type(this, value) + obj.type = value; + enum_wrapper(8, this, value); + end + end + + methods(Static = true) + end +end diff --git a/tests/expected/matlab/PrimitiveRefDouble.m b/tests/expected/matlab/PrimitiveRefDouble.m index 07810d1..c8e35a9 100644 --- a/tests/expected/matlab/PrimitiveRefDouble.m +++ b/tests/expected/matlab/PrimitiveRefDouble.m @@ -19,9 +19,9 @@ function obj = PrimitiveRefDouble(varargin) if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682) my_ptr = varargin{2}; - class_wrapper(49, my_ptr); + class_wrapper(52, my_ptr); elseif nargin == 0 - my_ptr = class_wrapper(50); + my_ptr = class_wrapper(53); else error('Arguments do not match any overload of PrimitiveRefDouble constructor'); end @@ -29,7 +29,7 @@ end function delete(obj) - class_wrapper(51, obj.ptr_PrimitiveRefDouble); + class_wrapper(54, obj.ptr_PrimitiveRefDouble); end function display(obj), obj.print(''); end @@ -43,7 +43,7 @@ function delete(obj) % BRUTAL usage: Brutal(double t) : returns PrimitiveRefdouble % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'double') - varargout{1} = class_wrapper(52, varargin{:}); + varargout{1} = class_wrapper(55, varargin{:}); return end diff --git a/tests/expected/matlab/Test.m b/tests/expected/matlab/Test.m index 947ff41..64ee934 100644 --- a/tests/expected/matlab/Test.m +++ b/tests/expected/matlab/Test.m @@ -18,6 +18,7 @@ %lambda() : returns void %markdown(KeyFormatter keyFormatter) : returns string %print() : returns void +%push_back(Key key) : returns void %return_Point2Ptr(bool value) : returns Point2 %return_Test(Test value) : returns Test %return_TestPtr(Test value) : returns Test @@ -27,6 +28,7 @@ %return_int(int value) : returns int %return_matrix1(Matrix value) : returns Matrix %return_matrix2(Matrix value) : returns Matrix +%return_matrix2(Matrix value) : returns Matrix %return_pair(Vector v, Matrix A) : returns pair< Vector, Matrix > %return_pair(Vector v) : returns pair< Vector, Matrix > %return_ptrs(Test p1, Test p2) : returns pair< Test, Test > @@ -34,6 +36,7 @@ %return_string(string value) : returns string %return_vector1(Vector value) : returns Vector %return_vector2(Vector value) : returns Vector +%return_vector2(Vector value) : returns Vector %set_container(vector container) : returns void %set_container(vector container) : returns void %set_container(vector container) : returns void @@ -144,11 +147,21 @@ function delete(obj) error('Arguments do not match any overload of function Test.print'); end + function varargout = push_back(this, varargin) + % PUSH_BACK usage: push_back(Key key) : returns void + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 1 && isa(varargin{1},'numeric') + class_wrapper(24, this, varargin{:}); + return + end + error('Arguments do not match any overload of function Test.push_back'); + end + function varargout = return_Point2Ptr(this, varargin) % RETURN_POINT2PTR usage: return_Point2Ptr(bool value) : returns Point2 % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'logical') - varargout{1} = class_wrapper(24, this, varargin{:}); + varargout{1} = class_wrapper(25, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_Point2Ptr'); @@ -158,7 +171,7 @@ function delete(obj) % RETURN_TEST usage: return_Test(Test value) : returns Test % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'Test') - varargout{1} = class_wrapper(25, this, varargin{:}); + varargout{1} = class_wrapper(26, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_Test'); @@ -168,7 +181,7 @@ function delete(obj) % RETURN_TESTPTR usage: return_TestPtr(Test value) : returns Test % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'Test') - varargout{1} = class_wrapper(26, this, varargin{:}); + varargout{1} = class_wrapper(27, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_TestPtr'); @@ -178,7 +191,7 @@ function delete(obj) % RETURN_BOOL usage: return_bool(bool value) : returns bool % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'logical') - varargout{1} = class_wrapper(27, this, varargin{:}); + varargout{1} = class_wrapper(28, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_bool'); @@ -188,7 +201,7 @@ function delete(obj) % RETURN_DOUBLE usage: return_double(double value) : returns double % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'double') - varargout{1} = class_wrapper(28, this, varargin{:}); + varargout{1} = class_wrapper(29, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_double'); @@ -198,7 +211,7 @@ function delete(obj) % RETURN_FIELD usage: return_field(Test t) : returns bool % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'Test') - varargout{1} = class_wrapper(29, this, varargin{:}); + varargout{1} = class_wrapper(30, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_field'); @@ -208,7 +221,7 @@ function delete(obj) % RETURN_INT usage: return_int(int value) : returns int % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'numeric') - varargout{1} = class_wrapper(30, this, varargin{:}); + varargout{1} = class_wrapper(31, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_int'); @@ -218,7 +231,7 @@ function delete(obj) % RETURN_MATRIX1 usage: return_matrix1(Matrix value) : returns Matrix % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'double') - varargout{1} = class_wrapper(31, this, varargin{:}); + varargout{1} = class_wrapper(32, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_matrix1'); @@ -228,7 +241,13 @@ function delete(obj) % RETURN_MATRIX2 usage: return_matrix2(Matrix value) : returns Matrix % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'double') - varargout{1} = class_wrapper(32, this, varargin{:}); + varargout{1} = class_wrapper(33, this, varargin{:}); + return + end + % RETURN_MATRIX2 usage: return_matrix2(Matrix value) : returns Matrix + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 1 && isa(varargin{1},'double') + varargout{1} = class_wrapper(34, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_matrix2'); @@ -238,13 +257,13 @@ function delete(obj) % RETURN_PAIR usage: return_pair(Vector v, Matrix A) : returns pair< Vector, Matrix > % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 2 && isa(varargin{1},'double') && size(varargin{1},2)==1 && isa(varargin{2},'double') - [ varargout{1} varargout{2} ] = class_wrapper(33, this, varargin{:}); + [ varargout{1} varargout{2} ] = class_wrapper(35, this, varargin{:}); return end % RETURN_PAIR usage: return_pair(Vector v) : returns pair< Vector, Matrix > % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},2)==1 - [ varargout{1} varargout{2} ] = class_wrapper(34, this, varargin{:}); + [ varargout{1} varargout{2} ] = class_wrapper(36, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_pair'); @@ -254,7 +273,7 @@ function delete(obj) % RETURN_PTRS usage: return_ptrs(Test p1, Test p2) : returns pair< Test, Test > % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 2 && isa(varargin{1},'Test') && isa(varargin{2},'Test') - [ varargout{1} varargout{2} ] = class_wrapper(35, this, varargin{:}); + [ varargout{1} varargout{2} ] = class_wrapper(37, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_ptrs'); @@ -264,7 +283,7 @@ function delete(obj) % RETURN_SIZE_T usage: return_size_t(size_t value) : returns size_t % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'numeric') - varargout{1} = class_wrapper(36, this, varargin{:}); + varargout{1} = class_wrapper(38, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_size_t'); @@ -274,7 +293,7 @@ function delete(obj) % RETURN_STRING usage: return_string(string value) : returns string % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'char') - varargout{1} = class_wrapper(37, this, varargin{:}); + varargout{1} = class_wrapper(39, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_string'); @@ -284,7 +303,7 @@ function delete(obj) % RETURN_VECTOR1 usage: return_vector1(Vector value) : returns Vector % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},2)==1 - varargout{1} = class_wrapper(38, this, varargin{:}); + varargout{1} = class_wrapper(40, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_vector1'); @@ -294,7 +313,13 @@ function delete(obj) % RETURN_VECTOR2 usage: return_vector2(Vector value) : returns Vector % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},2)==1 - varargout{1} = class_wrapper(39, this, varargin{:}); + varargout{1} = class_wrapper(41, this, varargin{:}); + return + end + % RETURN_VECTOR2 usage: return_vector2(Vector value) : returns Vector + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},2)==1 + varargout{1} = class_wrapper(42, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_vector2'); @@ -304,19 +329,19 @@ function delete(obj) % SET_CONTAINER usage: set_container(vector container) : returns void % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'std.vectorTest') - class_wrapper(40, this, varargin{:}); + class_wrapper(43, this, varargin{:}); return end % SET_CONTAINER usage: set_container(vector container) : returns void % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'std.vectorTest') - class_wrapper(41, this, varargin{:}); + class_wrapper(44, this, varargin{:}); return end % SET_CONTAINER usage: set_container(vector container) : returns void % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'std.vectorTest') - class_wrapper(42, this, varargin{:}); + class_wrapper(45, this, varargin{:}); return end error('Arguments do not match any overload of function Test.set_container'); @@ -324,33 +349,33 @@ function delete(obj) function varargout = get.model_ptr(this) - varargout{1} = class_wrapper(43, this); + varargout{1} = class_wrapper(46, this); this.model_ptr = varargout{1}; end function set.model_ptr(this, value) obj.model_ptr = value; - class_wrapper(44, this, value); + class_wrapper(47, this, value); end function varargout = get.value(this) - varargout{1} = class_wrapper(45, this); + varargout{1} = class_wrapper(48, this); this.value = varargout{1}; end function set.value(this, value) obj.value = value; - class_wrapper(46, this, value); + class_wrapper(49, this, value); end function varargout = get.name(this) - varargout{1} = class_wrapper(47, this); + varargout{1} = class_wrapper(50, this); this.name = varargout{1}; end function set.name(this, value) obj.name = value; - class_wrapper(48, this, value); + class_wrapper(51, this, value); end end diff --git a/tests/expected/matlab/class_wrapper.cpp b/tests/expected/matlab/class_wrapper.cpp index ee7084d..8462aa4 100644 --- a/tests/expected/matlab/class_wrapper.cpp +++ b/tests/expected/matlab/class_wrapper.cpp @@ -381,7 +381,15 @@ void Test_print_23(int nargout, mxArray *out[], int nargin, const mxArray *in[]) obj->print(); } -void Test_return_Point2Ptr_24(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_push_back_24(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("push_back",nargout,nargin-1,1); + auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); + gtsam::Key key = unwrap< gtsam::Key >(in[1]); + obj->push_back(key); +} + +void Test_return_Point2Ptr_25(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_Point2Ptr",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -392,7 +400,7 @@ void Test_return_Point2Ptr_24(int nargout, mxArray *out[], int nargin, const mxA } } -void Test_return_Test_25(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_Test_26(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_Test",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -400,7 +408,7 @@ void Test_return_Test_25(int nargout, mxArray *out[], int nargin, const mxArray out[0] = wrap_shared_ptr(std::make_shared(obj->return_Test(value)),"Test", false); } -void Test_return_TestPtr_26(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_TestPtr_27(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_TestPtr",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -408,7 +416,7 @@ void Test_return_TestPtr_26(int nargout, mxArray *out[], int nargin, const mxArr out[0] = wrap_shared_ptr(obj->return_TestPtr(value),"Test", false); } -void Test_return_bool_27(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_bool_28(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_bool",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -416,7 +424,7 @@ void Test_return_bool_27(int nargout, mxArray *out[], int nargin, const mxArray out[0] = wrap< bool >(obj->return_bool(value)); } -void Test_return_double_28(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_double_29(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_double",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -424,7 +432,7 @@ void Test_return_double_28(int nargout, mxArray *out[], int nargin, const mxArra out[0] = wrap< double >(obj->return_double(value)); } -void Test_return_field_29(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_field_30(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_field",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -432,7 +440,7 @@ void Test_return_field_29(int nargout, mxArray *out[], int nargin, const mxArray out[0] = wrap< bool >(obj->return_field(t)); } -void Test_return_int_30(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_int_31(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_int",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -440,7 +448,7 @@ void Test_return_int_30(int nargout, mxArray *out[], int nargin, const mxArray * out[0] = wrap< int >(obj->return_int(value)); } -void Test_return_matrix1_31(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_matrix1_32(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_matrix1",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -448,7 +456,15 @@ void Test_return_matrix1_31(int nargout, mxArray *out[], int nargin, const mxArr out[0] = wrap< Matrix >(obj->return_matrix1(value)); } -void Test_return_matrix2_32(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_matrix2_33(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_matrix2",nargout,nargin-1,1); + auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); + Matrix value = unwrap< Matrix >(in[1]); + out[0] = wrap< Matrix >(obj->return_matrix2(value)); +} + +void Test_return_matrix2_34(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_matrix2",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -456,7 +472,7 @@ void Test_return_matrix2_32(int nargout, mxArray *out[], int nargin, const mxArr out[0] = wrap< Matrix >(obj->return_matrix2(value)); } -void Test_return_pair_33(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_pair_35(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_pair",nargout,nargin-1,2); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -467,7 +483,7 @@ void Test_return_pair_33(int nargout, mxArray *out[], int nargin, const mxArray out[1] = wrap< Matrix >(pairResult.second); } -void Test_return_pair_34(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_pair_36(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_pair",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -477,7 +493,7 @@ void Test_return_pair_34(int nargout, mxArray *out[], int nargin, const mxArray out[1] = wrap< Matrix >(pairResult.second); } -void Test_return_ptrs_35(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_ptrs_37(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_ptrs",nargout,nargin-1,2); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -488,7 +504,7 @@ void Test_return_ptrs_35(int nargout, mxArray *out[], int nargin, const mxArray out[1] = wrap_shared_ptr(pairResult.second,"Test", false); } -void Test_return_size_t_36(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_size_t_38(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_size_t",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -496,7 +512,7 @@ void Test_return_size_t_36(int nargout, mxArray *out[], int nargin, const mxArra out[0] = wrap< size_t >(obj->return_size_t(value)); } -void Test_return_string_37(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_string_39(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_string",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -504,7 +520,7 @@ void Test_return_string_37(int nargout, mxArray *out[], int nargin, const mxArra out[0] = wrap< string >(obj->return_string(value)); } -void Test_return_vector1_38(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_vector1_40(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_vector1",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -512,7 +528,7 @@ void Test_return_vector1_38(int nargout, mxArray *out[], int nargin, const mxArr out[0] = wrap< Vector >(obj->return_vector1(value)); } -void Test_return_vector2_39(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_vector2_41(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_vector2",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -520,7 +536,15 @@ void Test_return_vector2_39(int nargout, mxArray *out[], int nargin, const mxArr out[0] = wrap< Vector >(obj->return_vector2(value)); } -void Test_set_container_40(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_vector2_42(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_vector2",nargout,nargin-1,1); + auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); + Vector value = unwrap< Vector >(in[1]); + out[0] = wrap< Vector >(obj->return_vector2(value)); +} + +void Test_set_container_43(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("set_container",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -528,7 +552,7 @@ void Test_set_container_40(int nargout, mxArray *out[], int nargin, const mxArra obj->set_container(*container); } -void Test_set_container_41(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_set_container_44(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("set_container",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -536,7 +560,7 @@ void Test_set_container_41(int nargout, mxArray *out[], int nargin, const mxArra obj->set_container(*container); } -void Test_set_container_42(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_set_container_45(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("set_container",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -544,14 +568,14 @@ void Test_set_container_42(int nargout, mxArray *out[], int nargin, const mxArra obj->set_container(*container); } -void Test_get_model_ptr_43(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_get_model_ptr_46(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("model_ptr",nargout,nargin-1,0); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); out[0] = wrap_shared_ptr(obj->model_ptr,"gtsam.noiseModel.Base", false); } -void Test_set_model_ptr_44(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_set_model_ptr_47(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("model_ptr",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -559,14 +583,14 @@ void Test_set_model_ptr_44(int nargout, mxArray *out[], int nargin, const mxArra obj->model_ptr = *model_ptr; } -void Test_get_value_45(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_get_value_48(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("value",nargout,nargin-1,0); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); out[0] = wrap< double >(obj->value); } -void Test_set_value_46(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_set_value_49(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("value",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -574,14 +598,14 @@ void Test_set_value_46(int nargout, mxArray *out[], int nargin, const mxArray *i obj->value = value; } -void Test_get_name_47(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_get_name_50(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("name",nargout,nargin-1,0); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); out[0] = wrap< string >(obj->name); } -void Test_set_name_48(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_set_name_51(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("name",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -589,7 +613,7 @@ void Test_set_name_48(int nargout, mxArray *out[], int nargin, const mxArray *in obj->name = name; } -void PrimitiveRefDouble_collectorInsertAndMakeBase_49(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void PrimitiveRefDouble_collectorInsertAndMakeBase_52(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr> Shared; @@ -598,7 +622,7 @@ void PrimitiveRefDouble_collectorInsertAndMakeBase_49(int nargout, mxArray *out[ collector_PrimitiveRefDouble.insert(self); } -void PrimitiveRefDouble_constructor_50(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void PrimitiveRefDouble_constructor_53(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr> Shared; @@ -609,7 +633,7 @@ void PrimitiveRefDouble_constructor_50(int nargout, mxArray *out[], int nargin, *reinterpret_cast (mxGetData(out[0])) = self; } -void PrimitiveRefDouble_deconstructor_51(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void PrimitiveRefDouble_deconstructor_54(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef std::shared_ptr> Shared; checkArguments("delete_PrimitiveRefDouble",nargout,nargin,1); @@ -622,14 +646,14 @@ void PrimitiveRefDouble_deconstructor_51(int nargout, mxArray *out[], int nargin delete self; } -void PrimitiveRefDouble_Brutal_52(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void PrimitiveRefDouble_Brutal_55(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("PrimitiveRef.Brutal",nargout,nargin,1); double t = unwrap< double >(in[0]); out[0] = wrap_shared_ptr(std::make_shared>(PrimitiveRef::Brutal(t)),"PrimitiveRefdouble", false); } -void MyVector3_collectorInsertAndMakeBase_53(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyVector3_collectorInsertAndMakeBase_56(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr> Shared; @@ -638,7 +662,7 @@ void MyVector3_collectorInsertAndMakeBase_53(int nargout, mxArray *out[], int na collector_MyVector3.insert(self); } -void MyVector3_constructor_54(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyVector3_constructor_57(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr> Shared; @@ -649,7 +673,7 @@ void MyVector3_constructor_54(int nargout, mxArray *out[], int nargin, const mxA *reinterpret_cast (mxGetData(out[0])) = self; } -void MyVector3_deconstructor_55(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyVector3_deconstructor_58(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef std::shared_ptr> Shared; checkArguments("delete_MyVector3",nargout,nargin,1); @@ -662,7 +686,7 @@ void MyVector3_deconstructor_55(int nargout, mxArray *out[], int nargin, const m delete self; } -void MyVector12_collectorInsertAndMakeBase_56(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyVector12_collectorInsertAndMakeBase_59(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr> Shared; @@ -671,7 +695,7 @@ void MyVector12_collectorInsertAndMakeBase_56(int nargout, mxArray *out[], int n collector_MyVector12.insert(self); } -void MyVector12_constructor_57(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyVector12_constructor_60(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr> Shared; @@ -682,7 +706,7 @@ void MyVector12_constructor_57(int nargout, mxArray *out[], int nargin, const mx *reinterpret_cast (mxGetData(out[0])) = self; } -void MyVector12_deconstructor_58(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyVector12_deconstructor_61(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef std::shared_ptr> Shared; checkArguments("delete_MyVector12",nargout,nargin,1); @@ -695,7 +719,7 @@ void MyVector12_deconstructor_58(int nargout, mxArray *out[], int nargin, const delete self; } -void MultipleTemplatesIntDouble_collectorInsertAndMakeBase_59(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MultipleTemplatesIntDouble_collectorInsertAndMakeBase_62(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr> Shared; @@ -704,7 +728,7 @@ void MultipleTemplatesIntDouble_collectorInsertAndMakeBase_59(int nargout, mxArr collector_MultipleTemplatesIntDouble.insert(self); } -void MultipleTemplatesIntDouble_deconstructor_60(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MultipleTemplatesIntDouble_deconstructor_63(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef std::shared_ptr> Shared; checkArguments("delete_MultipleTemplatesIntDouble",nargout,nargin,1); @@ -717,7 +741,7 @@ void MultipleTemplatesIntDouble_deconstructor_60(int nargout, mxArray *out[], in delete self; } -void MultipleTemplatesIntFloat_collectorInsertAndMakeBase_61(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MultipleTemplatesIntFloat_collectorInsertAndMakeBase_64(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr> Shared; @@ -726,7 +750,7 @@ void MultipleTemplatesIntFloat_collectorInsertAndMakeBase_61(int nargout, mxArra collector_MultipleTemplatesIntFloat.insert(self); } -void MultipleTemplatesIntFloat_deconstructor_62(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MultipleTemplatesIntFloat_deconstructor_65(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef std::shared_ptr> Shared; checkArguments("delete_MultipleTemplatesIntFloat",nargout,nargin,1); @@ -739,7 +763,7 @@ void MultipleTemplatesIntFloat_deconstructor_62(int nargout, mxArray *out[], int delete self; } -void ForwardKinematics_collectorInsertAndMakeBase_63(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void ForwardKinematics_collectorInsertAndMakeBase_66(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr Shared; @@ -748,7 +772,7 @@ void ForwardKinematics_collectorInsertAndMakeBase_63(int nargout, mxArray *out[] collector_ForwardKinematics.insert(self); } -void ForwardKinematics_constructor_64(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void ForwardKinematics_constructor_67(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr Shared; @@ -764,7 +788,7 @@ void ForwardKinematics_constructor_64(int nargout, mxArray *out[], int nargin, c *reinterpret_cast (mxGetData(out[0])) = self; } -void ForwardKinematics_constructor_65(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void ForwardKinematics_constructor_68(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr Shared; @@ -779,7 +803,7 @@ void ForwardKinematics_constructor_65(int nargout, mxArray *out[], int nargin, c *reinterpret_cast (mxGetData(out[0])) = self; } -void ForwardKinematics_deconstructor_66(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void ForwardKinematics_deconstructor_69(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef std::shared_ptr Shared; checkArguments("delete_ForwardKinematics",nargout,nargin,1); @@ -792,7 +816,7 @@ void ForwardKinematics_deconstructor_66(int nargout, mxArray *out[], int nargin, delete self; } -void TemplatedConstructor_collectorInsertAndMakeBase_67(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void TemplatedConstructor_collectorInsertAndMakeBase_70(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr Shared; @@ -801,7 +825,7 @@ void TemplatedConstructor_collectorInsertAndMakeBase_67(int nargout, mxArray *ou collector_TemplatedConstructor.insert(self); } -void TemplatedConstructor_constructor_68(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void TemplatedConstructor_constructor_71(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr Shared; @@ -812,7 +836,7 @@ void TemplatedConstructor_constructor_68(int nargout, mxArray *out[], int nargin *reinterpret_cast (mxGetData(out[0])) = self; } -void TemplatedConstructor_constructor_69(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void TemplatedConstructor_constructor_72(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr Shared; @@ -824,7 +848,7 @@ void TemplatedConstructor_constructor_69(int nargout, mxArray *out[], int nargin *reinterpret_cast (mxGetData(out[0])) = self; } -void TemplatedConstructor_constructor_70(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void TemplatedConstructor_constructor_73(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr Shared; @@ -836,7 +860,7 @@ void TemplatedConstructor_constructor_70(int nargout, mxArray *out[], int nargin *reinterpret_cast (mxGetData(out[0])) = self; } -void TemplatedConstructor_constructor_71(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void TemplatedConstructor_constructor_74(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr Shared; @@ -848,7 +872,7 @@ void TemplatedConstructor_constructor_71(int nargout, mxArray *out[], int nargin *reinterpret_cast (mxGetData(out[0])) = self; } -void TemplatedConstructor_deconstructor_72(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void TemplatedConstructor_deconstructor_75(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef std::shared_ptr Shared; checkArguments("delete_TemplatedConstructor",nargout,nargin,1); @@ -861,7 +885,7 @@ void TemplatedConstructor_deconstructor_72(int nargout, mxArray *out[], int narg delete self; } -void FastSet_collectorInsertAndMakeBase_73(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void FastSet_collectorInsertAndMakeBase_76(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr Shared; @@ -870,7 +894,7 @@ void FastSet_collectorInsertAndMakeBase_73(int nargout, mxArray *out[], int narg collector_FastSet.insert(self); } -void FastSet_constructor_74(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void FastSet_constructor_77(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr Shared; @@ -881,7 +905,7 @@ void FastSet_constructor_74(int nargout, mxArray *out[], int nargin, const mxArr *reinterpret_cast (mxGetData(out[0])) = self; } -void FastSet_deconstructor_75(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void FastSet_deconstructor_78(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef std::shared_ptr Shared; checkArguments("delete_FastSet",nargout,nargin,1); @@ -894,7 +918,7 @@ void FastSet_deconstructor_75(int nargout, mxArray *out[], int nargin, const mxA delete self; } -void HessianFactor_collectorInsertAndMakeBase_76(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void HessianFactor_collectorInsertAndMakeBase_79(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr Shared; @@ -907,7 +931,7 @@ void HessianFactor_collectorInsertAndMakeBase_76(int nargout, mxArray *out[], in *reinterpret_cast(mxGetData(out[0])) = new SharedBase(*self); } -void HessianFactor_upcastFromVoid_77(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { +void HessianFactor_upcastFromVoid_80(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr Shared; std::shared_ptr *asVoid = *reinterpret_cast**> (mxGetData(in[0])); @@ -916,7 +940,7 @@ void HessianFactor_upcastFromVoid_77(int nargout, mxArray *out[], int nargin, co *reinterpret_cast(mxGetData(out[0])) = self; } -void HessianFactor_constructor_78(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void HessianFactor_constructor_81(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr Shared; @@ -935,7 +959,7 @@ void HessianFactor_constructor_78(int nargout, mxArray *out[], int nargin, const *reinterpret_cast(mxGetData(out[1])) = new SharedBase(*self); } -void HessianFactor_deconstructor_79(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void HessianFactor_deconstructor_82(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef std::shared_ptr Shared; checkArguments("delete_HessianFactor",nargout,nargin,1); @@ -948,7 +972,7 @@ void HessianFactor_deconstructor_79(int nargout, mxArray *out[], int nargin, con delete self; } -void MyFactorPosePoint2_collectorInsertAndMakeBase_80(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyFactorPosePoint2_collectorInsertAndMakeBase_83(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr> Shared; @@ -957,7 +981,7 @@ void MyFactorPosePoint2_collectorInsertAndMakeBase_80(int nargout, mxArray *out[ collector_MyFactorPosePoint2.insert(self); } -void MyFactorPosePoint2_constructor_81(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyFactorPosePoint2_constructor_84(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef std::shared_ptr> Shared; @@ -972,7 +996,7 @@ void MyFactorPosePoint2_constructor_81(int nargout, mxArray *out[], int nargin, *reinterpret_cast (mxGetData(out[0])) = self; } -void MyFactorPosePoint2_deconstructor_82(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyFactorPosePoint2_deconstructor_85(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef std::shared_ptr> Shared; checkArguments("delete_MyFactorPosePoint2",nargout,nargin,1); @@ -985,7 +1009,7 @@ void MyFactorPosePoint2_deconstructor_82(int nargout, mxArray *out[], int nargin delete self; } -void MyFactorPosePoint2_print_83(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyFactorPosePoint2_print_86(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("print",nargout,nargin-1,2); auto obj = unwrap_shared_ptr>(in[0], "ptr_MyFactorPosePoint2"); @@ -994,7 +1018,7 @@ void MyFactorPosePoint2_print_83(int nargout, mxArray *out[], int nargin, const obj->print(s,keyFormatter); } -void MyFactorPosePoint2_print_84(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyFactorPosePoint2_print_87(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("print",nargout,nargin-1,1); auto obj = unwrap_shared_ptr>(in[0], "ptr_MyFactorPosePoint2"); @@ -1002,7 +1026,7 @@ void MyFactorPosePoint2_print_84(int nargout, mxArray *out[], int nargin, const obj->print(s,gtsam::DefaultKeyFormatter); } -void MyFactorPosePoint2_print_85(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyFactorPosePoint2_print_88(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("print",nargout,nargin-1,0); auto obj = unwrap_shared_ptr>(in[0], "ptr_MyFactorPosePoint2"); @@ -1094,190 +1118,199 @@ void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) Test_print_23(nargout, out, nargin-1, in+1); break; case 24: - Test_return_Point2Ptr_24(nargout, out, nargin-1, in+1); + Test_push_back_24(nargout, out, nargin-1, in+1); break; case 25: - Test_return_Test_25(nargout, out, nargin-1, in+1); + Test_return_Point2Ptr_25(nargout, out, nargin-1, in+1); break; case 26: - Test_return_TestPtr_26(nargout, out, nargin-1, in+1); + Test_return_Test_26(nargout, out, nargin-1, in+1); break; case 27: - Test_return_bool_27(nargout, out, nargin-1, in+1); + Test_return_TestPtr_27(nargout, out, nargin-1, in+1); break; case 28: - Test_return_double_28(nargout, out, nargin-1, in+1); + Test_return_bool_28(nargout, out, nargin-1, in+1); break; case 29: - Test_return_field_29(nargout, out, nargin-1, in+1); + Test_return_double_29(nargout, out, nargin-1, in+1); break; case 30: - Test_return_int_30(nargout, out, nargin-1, in+1); + Test_return_field_30(nargout, out, nargin-1, in+1); break; case 31: - Test_return_matrix1_31(nargout, out, nargin-1, in+1); + Test_return_int_31(nargout, out, nargin-1, in+1); break; case 32: - Test_return_matrix2_32(nargout, out, nargin-1, in+1); + Test_return_matrix1_32(nargout, out, nargin-1, in+1); break; case 33: - Test_return_pair_33(nargout, out, nargin-1, in+1); + Test_return_matrix2_33(nargout, out, nargin-1, in+1); break; case 34: - Test_return_pair_34(nargout, out, nargin-1, in+1); + Test_return_matrix2_34(nargout, out, nargin-1, in+1); break; case 35: - Test_return_ptrs_35(nargout, out, nargin-1, in+1); + Test_return_pair_35(nargout, out, nargin-1, in+1); break; case 36: - Test_return_size_t_36(nargout, out, nargin-1, in+1); + Test_return_pair_36(nargout, out, nargin-1, in+1); break; case 37: - Test_return_string_37(nargout, out, nargin-1, in+1); + Test_return_ptrs_37(nargout, out, nargin-1, in+1); break; case 38: - Test_return_vector1_38(nargout, out, nargin-1, in+1); + Test_return_size_t_38(nargout, out, nargin-1, in+1); break; case 39: - Test_return_vector2_39(nargout, out, nargin-1, in+1); + Test_return_string_39(nargout, out, nargin-1, in+1); break; case 40: - Test_set_container_40(nargout, out, nargin-1, in+1); + Test_return_vector1_40(nargout, out, nargin-1, in+1); break; case 41: - Test_set_container_41(nargout, out, nargin-1, in+1); + Test_return_vector2_41(nargout, out, nargin-1, in+1); break; case 42: - Test_set_container_42(nargout, out, nargin-1, in+1); + Test_return_vector2_42(nargout, out, nargin-1, in+1); break; case 43: - Test_get_model_ptr_43(nargout, out, nargin-1, in+1); + Test_set_container_43(nargout, out, nargin-1, in+1); break; case 44: - Test_set_model_ptr_44(nargout, out, nargin-1, in+1); + Test_set_container_44(nargout, out, nargin-1, in+1); break; case 45: - Test_get_value_45(nargout, out, nargin-1, in+1); + Test_set_container_45(nargout, out, nargin-1, in+1); break; case 46: - Test_set_value_46(nargout, out, nargin-1, in+1); + Test_get_model_ptr_46(nargout, out, nargin-1, in+1); break; case 47: - Test_get_name_47(nargout, out, nargin-1, in+1); + Test_set_model_ptr_47(nargout, out, nargin-1, in+1); break; case 48: - Test_set_name_48(nargout, out, nargin-1, in+1); + Test_get_value_48(nargout, out, nargin-1, in+1); break; case 49: - PrimitiveRefDouble_collectorInsertAndMakeBase_49(nargout, out, nargin-1, in+1); + Test_set_value_49(nargout, out, nargin-1, in+1); break; case 50: - PrimitiveRefDouble_constructor_50(nargout, out, nargin-1, in+1); + Test_get_name_50(nargout, out, nargin-1, in+1); break; case 51: - PrimitiveRefDouble_deconstructor_51(nargout, out, nargin-1, in+1); + Test_set_name_51(nargout, out, nargin-1, in+1); break; case 52: - PrimitiveRefDouble_Brutal_52(nargout, out, nargin-1, in+1); + PrimitiveRefDouble_collectorInsertAndMakeBase_52(nargout, out, nargin-1, in+1); break; case 53: - MyVector3_collectorInsertAndMakeBase_53(nargout, out, nargin-1, in+1); + PrimitiveRefDouble_constructor_53(nargout, out, nargin-1, in+1); break; case 54: - MyVector3_constructor_54(nargout, out, nargin-1, in+1); + PrimitiveRefDouble_deconstructor_54(nargout, out, nargin-1, in+1); break; case 55: - MyVector3_deconstructor_55(nargout, out, nargin-1, in+1); + PrimitiveRefDouble_Brutal_55(nargout, out, nargin-1, in+1); break; case 56: - MyVector12_collectorInsertAndMakeBase_56(nargout, out, nargin-1, in+1); + MyVector3_collectorInsertAndMakeBase_56(nargout, out, nargin-1, in+1); break; case 57: - MyVector12_constructor_57(nargout, out, nargin-1, in+1); + MyVector3_constructor_57(nargout, out, nargin-1, in+1); break; case 58: - MyVector12_deconstructor_58(nargout, out, nargin-1, in+1); + MyVector3_deconstructor_58(nargout, out, nargin-1, in+1); break; case 59: - MultipleTemplatesIntDouble_collectorInsertAndMakeBase_59(nargout, out, nargin-1, in+1); + MyVector12_collectorInsertAndMakeBase_59(nargout, out, nargin-1, in+1); break; case 60: - MultipleTemplatesIntDouble_deconstructor_60(nargout, out, nargin-1, in+1); + MyVector12_constructor_60(nargout, out, nargin-1, in+1); break; case 61: - MultipleTemplatesIntFloat_collectorInsertAndMakeBase_61(nargout, out, nargin-1, in+1); + MyVector12_deconstructor_61(nargout, out, nargin-1, in+1); break; case 62: - MultipleTemplatesIntFloat_deconstructor_62(nargout, out, nargin-1, in+1); + MultipleTemplatesIntDouble_collectorInsertAndMakeBase_62(nargout, out, nargin-1, in+1); break; case 63: - ForwardKinematics_collectorInsertAndMakeBase_63(nargout, out, nargin-1, in+1); + MultipleTemplatesIntDouble_deconstructor_63(nargout, out, nargin-1, in+1); break; case 64: - ForwardKinematics_constructor_64(nargout, out, nargin-1, in+1); + MultipleTemplatesIntFloat_collectorInsertAndMakeBase_64(nargout, out, nargin-1, in+1); break; case 65: - ForwardKinematics_constructor_65(nargout, out, nargin-1, in+1); + MultipleTemplatesIntFloat_deconstructor_65(nargout, out, nargin-1, in+1); break; case 66: - ForwardKinematics_deconstructor_66(nargout, out, nargin-1, in+1); + ForwardKinematics_collectorInsertAndMakeBase_66(nargout, out, nargin-1, in+1); break; case 67: - TemplatedConstructor_collectorInsertAndMakeBase_67(nargout, out, nargin-1, in+1); + ForwardKinematics_constructor_67(nargout, out, nargin-1, in+1); break; case 68: - TemplatedConstructor_constructor_68(nargout, out, nargin-1, in+1); + ForwardKinematics_constructor_68(nargout, out, nargin-1, in+1); break; case 69: - TemplatedConstructor_constructor_69(nargout, out, nargin-1, in+1); + ForwardKinematics_deconstructor_69(nargout, out, nargin-1, in+1); break; case 70: - TemplatedConstructor_constructor_70(nargout, out, nargin-1, in+1); + TemplatedConstructor_collectorInsertAndMakeBase_70(nargout, out, nargin-1, in+1); break; case 71: TemplatedConstructor_constructor_71(nargout, out, nargin-1, in+1); break; case 72: - TemplatedConstructor_deconstructor_72(nargout, out, nargin-1, in+1); + TemplatedConstructor_constructor_72(nargout, out, nargin-1, in+1); break; case 73: - FastSet_collectorInsertAndMakeBase_73(nargout, out, nargin-1, in+1); + TemplatedConstructor_constructor_73(nargout, out, nargin-1, in+1); break; case 74: - FastSet_constructor_74(nargout, out, nargin-1, in+1); + TemplatedConstructor_constructor_74(nargout, out, nargin-1, in+1); break; case 75: - FastSet_deconstructor_75(nargout, out, nargin-1, in+1); + TemplatedConstructor_deconstructor_75(nargout, out, nargin-1, in+1); break; case 76: - HessianFactor_collectorInsertAndMakeBase_76(nargout, out, nargin-1, in+1); + FastSet_collectorInsertAndMakeBase_76(nargout, out, nargin-1, in+1); break; case 77: - HessianFactor_upcastFromVoid_77(nargout, out, nargin-1, in+1); + FastSet_constructor_77(nargout, out, nargin-1, in+1); break; case 78: - HessianFactor_constructor_78(nargout, out, nargin-1, in+1); + FastSet_deconstructor_78(nargout, out, nargin-1, in+1); break; case 79: - HessianFactor_deconstructor_79(nargout, out, nargin-1, in+1); + HessianFactor_collectorInsertAndMakeBase_79(nargout, out, nargin-1, in+1); break; case 80: - MyFactorPosePoint2_collectorInsertAndMakeBase_80(nargout, out, nargin-1, in+1); + HessianFactor_upcastFromVoid_80(nargout, out, nargin-1, in+1); break; case 81: - MyFactorPosePoint2_constructor_81(nargout, out, nargin-1, in+1); + HessianFactor_constructor_81(nargout, out, nargin-1, in+1); break; case 82: - MyFactorPosePoint2_deconstructor_82(nargout, out, nargin-1, in+1); + HessianFactor_deconstructor_82(nargout, out, nargin-1, in+1); break; case 83: - MyFactorPosePoint2_print_83(nargout, out, nargin-1, in+1); + MyFactorPosePoint2_collectorInsertAndMakeBase_83(nargout, out, nargin-1, in+1); break; case 84: - MyFactorPosePoint2_print_84(nargout, out, nargin-1, in+1); + MyFactorPosePoint2_constructor_84(nargout, out, nargin-1, in+1); break; case 85: - MyFactorPosePoint2_print_85(nargout, out, nargin-1, in+1); + MyFactorPosePoint2_deconstructor_85(nargout, out, nargin-1, in+1); + break; + case 86: + MyFactorPosePoint2_print_86(nargout, out, nargin-1, in+1); + break; + case 87: + MyFactorPosePoint2_print_87(nargout, out, nargin-1, in+1); + break; + case 88: + MyFactorPosePoint2_print_88(nargout, out, nargin-1, in+1); break; } } catch(const std::exception& e) { diff --git a/tests/fixtures/class.i b/tests/fixtures/class.i index 2cc426a..6cc0de5 100644 --- a/tests/fixtures/class.i +++ b/tests/fixtures/class.i @@ -61,8 +61,14 @@ class Test { gtsam::Matrix return_matrix1(const gtsam::Matrix& value) const; gtsam::Vector return_vector2(const gtsam::Vector& value) const; gtsam::Matrix return_matrix2(const gtsam::Matrix& value) const; + // Return types as const references + const gtsam::Vector& return_vector2(const gtsam::Vector& value) const; + const gtsam::Matrix& return_matrix2(const gtsam::Matrix& value) const; void arg_EigenConstRef(const gtsam::Matrix& value) const; + // Use gtsam::Key which is an alias for uint64_t which is a numeric in MATLAB + void push_back(gtsam::Key key); + bool return_field(const Test& t) const; Test* return_TestPtr(const Test* value) const; diff --git a/tests/test_matlab_wrapper.py b/tests/test_matlab_wrapper.py index 8f58026..34bee7d 100644 --- a/tests/test_matlab_wrapper.py +++ b/tests/test_matlab_wrapper.py @@ -131,8 +131,10 @@ def test_class(self): files = [ 'class_wrapper.cpp', + 'ForwardKinematics.m', 'FunDouble.m', 'FunRange.m', + 'HessianFactor.m', 'MultipleTemplatesIntDouble.m', 'MultipleTemplatesIntFloat.m', 'MyFactorPosePoint2.m', @@ -140,7 +142,6 @@ def test_class(self): 'MyVector12.m', 'PrimitiveRefDouble.m', 'Test.m', - 'ForwardKinematics.m', ] for file in files: @@ -162,6 +163,7 @@ def test_enum(self): files = [ 'enum_wrapper.cpp', 'Color.m', + 'Pet.m', '+Pet/Kind.m', '+gtsam/VerbosityLM.m', '+gtsam/+MCU/Avengers.m', @@ -208,9 +210,11 @@ def test_inheritance(self): files = [ 'inheritance_wrapper.cpp', 'MyBase.m', + 'MyTemplateA.m', 'MyTemplateMatrix.m', 'MyTemplatePoint2.m', 'ForwardKinematicsFactor.m', + 'ParentHasTemplateDouble.m', ] for file in files: From cb1fcdf6dba54eb598613cb93e0bdaed9cebd322 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 28 Nov 2025 12:10:35 -0500 Subject: [PATCH 12/12] fix class pybind test --- tests/expected/python/class_pybind.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/expected/python/class_pybind.cpp b/tests/expected/python/class_pybind.cpp index 17c0567..38915d1 100644 --- a/tests/expected/python/class_pybind.cpp +++ b/tests/expected/python/class_pybind.cpp @@ -43,7 +43,10 @@ PYBIND11_MODULE(class_py, m_) { .def("return_matrix1",[](Test* self, const gtsam::Matrix& value){return self->return_matrix1(value);}, py::arg("value")) .def("return_vector2",[](Test* self, const gtsam::Vector& value){return self->return_vector2(value);}, py::arg("value")) .def("return_matrix2",[](Test* self, const gtsam::Matrix& value){return self->return_matrix2(value);}, py::arg("value")) + .def("return_vector2",[](Test* self, const gtsam::Vector& value){return self->return_vector2(value);}, py::arg("value")) + .def("return_matrix2",[](Test* self, const gtsam::Matrix& value){return self->return_matrix2(value);}, py::arg("value")) .def("arg_EigenConstRef",[](Test* self, const gtsam::Matrix& value){ self->arg_EigenConstRef(value);}, py::arg("value")) + .def("push_back",[](Test* self, gtsam::Key key){ self->push_back(key);}, py::arg("key")) .def("return_field",[](Test* self, const Test& t){return self->return_field(t);}, py::arg("t")) .def("return_TestPtr",[](Test* self, const std::shared_ptr value){return self->return_TestPtr(value);}, py::arg("value")) .def("return_Test",[](Test* self, std::shared_ptr value){return self->return_Test(value);}, py::arg("value"))