From 34aae4f72ae20c683b9082a1ad1485af3271090e Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 25 Mar 2021 13:32:38 -0400 Subject: [PATCH] Squashed 'wrap/' changes from 29628426d..9a467794e 9a467794e Merge pull request #61 from borglab/fix/python-variables 6bae7af99 added more status messages and set the PYBIND11_PYTHON_VERSION each time 5129cf3b9 set both sets of Python variables and find python version when including PybindWrap 5a67b526c Merge pull request #60 from borglab/fix/multi-template-methods 4a73b29ef better method names for testing templated methods 989fdf946 added unit test for multi-template methods a56908c21 add namespace qualification to instantiations a25d9631e graceful handling of templated method instantiations 0baa5ab5d multiple templates in methods git-subtree-dir: wrap git-subtree-split: 9a467794e8542872b2782cdaec338aaa30a92e33 --- cmake/GtwrapUtils.cmake | 22 +- cmake/PybindWrap.cmake | 10 +- gtwrap/matlab_wrapper.py | 6 +- gtwrap/template_instantiator.py | 79 ++++---- tests/expected/matlab/FunDouble.m | 31 ++- .../matlab/MultipleTemplatesIntDouble.m | 4 +- .../matlab/MultipleTemplatesIntFloat.m | 4 +- tests/expected/matlab/MyFactorPosePoint2.m | 6 +- tests/expected/matlab/MyVector12.m | 6 +- tests/expected/matlab/MyVector3.m | 6 +- tests/expected/matlab/PrimitiveRefDouble.m | 8 +- tests/expected/matlab/Test.m | 48 ++--- tests/expected/matlab/class_wrapper.cpp | 189 ++++++++++-------- tests/expected/python/class_pybind.cpp | 5 +- tests/fixtures/class.i | 8 +- 15 files changed, 240 insertions(+), 192 deletions(-) diff --git a/cmake/GtwrapUtils.cmake b/cmake/GtwrapUtils.cmake index acf075c5b3..01cdd32b98 100644 --- a/cmake/GtwrapUtils.cmake +++ b/cmake/GtwrapUtils.cmake @@ -15,16 +15,16 @@ macro(get_python_version) set(Python_VERSION_MAJOR ${PYTHON_VERSION_MAJOR} - PARENT_SCOPE) + CACHE INTERNAL "") set(Python_VERSION_MINOR ${PYTHON_VERSION_MINOR} - PARENT_SCOPE) + CACHE INTERNAL "") set(Python_VERSION_PATCH ${PYTHON_VERSION_PATCH} - PARENT_SCOPE) + CACHE INTERNAL "") set(Python_EXECUTABLE ${PYTHON_EXECUTABLE} - PARENT_SCOPE) + CACHE INTERNAL "") else() # Get info about the Python interpreter @@ -37,6 +37,20 @@ macro(get_python_version) "Cannot find Python interpreter. Please install Python>=3.5.") endif() + # Set both sets of variables + set(PYTHON_VERSION_MAJOR + ${Python_VERSION_MAJOR} + CACHE INTERNAL "") + set(PYTHON_VERSION_MINOR + ${Python_VERSION_MINOR} + CACHE INTERNAL "") + set(PYTHON_VERSION_PATCH + ${Python_VERSION_PATCH} + CACHE INTERNAL "") + set(PYTHON_EXECUTABLE + ${Python_EXECUTABLE} + CACHE INTERNAL "") + endif() endmacro() diff --git a/cmake/PybindWrap.cmake b/cmake/PybindWrap.cmake index c7c47a662e..2c07e2b509 100644 --- a/cmake/PybindWrap.cmake +++ b/cmake/PybindWrap.cmake @@ -1,5 +1,3 @@ -set(PYBIND11_PYTHON_VERSION ${WRAP_PYTHON_VERSION}) - if(GTWRAP_PYTHON_PACKAGE_DIR) # packaged set(GTWRAP_PACKAGE_DIR "${GTWRAP_PYTHON_PACKAGE_DIR}") @@ -7,6 +5,14 @@ else() set(GTWRAP_PACKAGE_DIR ${CMAKE_CURRENT_LIST_DIR}/..) endif() +# Get the Python version +include(GtwrapUtils) +message(status "Checking Python Version") +gtwrap_get_python_version(${WRAP_PYTHON_VERSION}) + +message(status "Setting Python version for wrapper") +set(PYBIND11_PYTHON_VERSION ${WRAP_PYTHON_VERSION}) + # User-friendly Pybind11 wrapping and installing function. # Builds a Pybind11 module from the provided interface_header. # For example, for the interface header gtsam.h, this will diff --git a/gtwrap/matlab_wrapper.py b/gtwrap/matlab_wrapper.py index 0c5a6a4bc7..1f9f3146fd 100755 --- a/gtwrap/matlab_wrapper.py +++ b/gtwrap/matlab_wrapper.py @@ -348,7 +348,7 @@ def _format_instance_method(self, instance_method, separator=''): method += instance_method.parent.name + separator method += instance_method.original.name - method += "<" + instance_method.instantiation.to_cpp() + ">" + method += "<" + instance_method.instantiations.to_cpp() + ">" return method[2 * len(separator):] @@ -1337,9 +1337,9 @@ def wrap_collector_function_return(self, method): method_name = method.to_cpp() obj_start = 'obj->' - if method.instantiation: + if method.instantiations: # method_name += '<{}>'.format( - # self._format_type_name(method.instantiation)) + # self._format_type_name(method.instantiations)) # method_name = self._format_instance_method(method, '::') method = method.to_cpp() diff --git a/gtwrap/template_instantiator.py b/gtwrap/template_instantiator.py index 65a1e72273..7ae79e2176 100644 --- a/gtwrap/template_instantiator.py +++ b/gtwrap/template_instantiator.py @@ -206,40 +206,35 @@ class InstantiatedMethod(parser.Method): """ We can only instantiate template methods with a single template parameter. """ - def __init__(self, original, instantiation=''): + def __init__(self, original, instantiations=''): self.original = original - self.instantiation = instantiation + self.instantiations = instantiations self.template = '' self.is_const = original.is_const self.parent = original.parent - if not original.template: - self.name = original.name - self.return_type = original.return_type - self.args = original.args - else: - #TODO(Varun) enable multiple templates for methods - if len(self.original.template.typenames) > 1: - raise ValueError("Can only instantiate template method with " - "single template parameter.") - self.name = instantiate_name(original.name, [self.instantiation]) - self.return_type = instantiate_return_type( - original.return_type, - [self.original.template.typenames[0]], - [self.instantiation], - # Keyword type name `This` should already be replaced in the - # previous class template instantiation round. - cpp_typename='', - ) - instantiated_args = instantiate_args_list( - original.args.args_list, - [self.original.template.typenames[0]], - [self.instantiation], - # Keyword type name `This` should already be replaced in the - # previous class template instantiation round. - cpp_typename='', - ) - self.args = parser.ArgumentList(instantiated_args) + # Check for typenames if templated. + # This way, we can gracefully handle bot templated and non-templated methois. + typenames = self.original.template.typenames if self.original.template else [] + self.name = instantiate_name(original.name, self.instantiations) + self.return_type = instantiate_return_type( + original.return_type, + typenames, + self.instantiations, + # Keyword type name `This` should already be replaced in the + # previous class template instantiation round. + cpp_typename='', + ) + + instantiated_args = instantiate_args_list( + original.args.args_list, + typenames, + self.instantiations, + # Keyword type name `This` should already be replaced in the + # previous class template instantiation round. + cpp_typename='', + ) + self.args = parser.ArgumentList(instantiated_args) super().__init__(self.template, self.name, @@ -251,7 +246,13 @@ def __init__(self, original, instantiation=''): def to_cpp(self): """Generate the C++ code for wrapping.""" if self.original.template: - ret = "{}<{}>".format(self.original.name, self.instantiation) + instantiation_list = [ + # Get the fully qualified name + "::".join(x.namespaces + [x.name]) + for x in self.instantiations + ] + ret = "{}<{}>".format(self.original.name, + ",".join(instantiation_list)) else: ret = self.original.name return ret @@ -293,12 +294,13 @@ def __init__(self, original, instantiations=(), new_name=''): # This will allow the `This` keyword to be used in both templated and non-templated classes. typenames = self.original.template.typenames if self.original.template else [] - # Instantiate the constructors, static methods, properties and instance methods, respectively. + # Instantiate the constructors, static methods, properties + # and instance methods, respectively. self.ctors = self.instantiate_ctors(typenames) self.static_methods = self.instantiate_static_methods(typenames) self.properties = self.instantiate_properties(typenames) - instantiated_methods = self.instantiate_class_templates_in_methods( - typenames) + instantiated_methods = \ + self.instantiate_class_templates_in_methods(typenames) # Second instantiation round to instantiate templated methods. # This is done in case both the class and the method are templated. @@ -307,11 +309,12 @@ def __init__(self, original, instantiations=(), new_name=''): if not method.template: self.methods.append(InstantiatedMethod(method, '')) else: - assert len( - method.template.typenames) == 1, ""\ - "Can only instantiate single template methods" - for inst in method.template.instantiations[0]: - self.methods.append(InstantiatedMethod(method, inst)) + instantiations = [] + # Get all combinations of template parameters + for instantiations in itertools.product( + *method.template.instantiations): + self.methods.append( + InstantiatedMethod(method, instantiations)) super().__init__( self.template, diff --git a/tests/expected/matlab/FunDouble.m b/tests/expected/matlab/FunDouble.m index b6c57cd0c4..ca0efcacf9 100644 --- a/tests/expected/matlab/FunDouble.m +++ b/tests/expected/matlab/FunDouble.m @@ -2,10 +2,11 @@ %at https://gtsam.org/doxygen/ % %-------Methods------- -%dhamaalString(double d, string t) : returns Fun +%multiTemplatedMethodStringSize_t(double d, string t, size_t u) : returns Fun +%templatedMethodString(double d, string t) : returns Fun % %-------Static Methods------- -%divertido() : returns Fun +%staticMethodWithThis() : returns Fun % %-------Serialization Interface------- %string_serialize() : returns string @@ -34,28 +35,38 @@ function delete(obj) %DISPLAY Calls print on the object function disp(obj), obj.display; end %DISP Calls print on the object - function varargout = dhamaalString(this, varargin) - % DHAMAALSTRING usage: dhamaalString(double d, string t) : returns Fun + function varargout = multiTemplatedMethodStringSize_t(this, varargin) + % MULTITEMPLATEDMETHODSTRINGSIZE_T usage: multiTemplatedMethodStringSize_t(double d, string t, size_t u) : returns Fun % Doxygen can be found at https://gtsam.org/doxygen/ - if length(varargin) == 2 && isa(varargin{1},'double') && isa(varargin{2},'char') + if length(varargin) == 3 && isa(varargin{1},'double') && isa(varargin{2},'char') && isa(varargin{3},'numeric') varargout{1} = class_wrapper(7, this, varargin{:}); return end - error('Arguments do not match any overload of function FunDouble.dhamaalString'); + error('Arguments do not match any overload of function FunDouble.multiTemplatedMethodStringSize_t'); + end + + function varargout = templatedMethodString(this, varargin) + % TEMPLATEDMETHODSTRING usage: templatedMethodString(double d, string t) : returns Fun + % Doxygen can be found at https://gtsam.org/doxygen/ + if length(varargin) == 2 && isa(varargin{1},'double') && isa(varargin{2},'char') + varargout{1} = class_wrapper(8, this, varargin{:}); + return + end + error('Arguments do not match any overload of function FunDouble.templatedMethodString'); end end methods(Static = true) - function varargout = Divertido(varargin) - % DIVERTIDO usage: divertido() : returns Fundouble + function varargout = StaticMethodWithThis(varargin) + % STATICMETHODWITHTHIS usage: staticMethodWithThis() : returns Fundouble % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 0 - varargout{1} = class_wrapper(8, varargin{:}); + varargout{1} = class_wrapper(9, varargin{:}); return end - error('Arguments do not match any overload of function FunDouble.divertido'); + error('Arguments do not match any overload of function FunDouble.staticMethodWithThis'); end end diff --git a/tests/expected/matlab/MultipleTemplatesIntDouble.m b/tests/expected/matlab/MultipleTemplatesIntDouble.m index bea6a3e6c0..9218657d90 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(43, my_ptr); + class_wrapper(44, my_ptr); else error('Arguments do not match any overload of MultipleTemplatesIntDouble constructor'); end @@ -17,7 +17,7 @@ end function delete(obj) - class_wrapper(44, obj.ptr_MultipleTemplatesIntDouble); + class_wrapper(45, 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 8c09e16858..6a6c4cb0ae 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(45, my_ptr); + class_wrapper(46, my_ptr); else error('Arguments do not match any overload of MultipleTemplatesIntFloat constructor'); end @@ -17,7 +17,7 @@ end function delete(obj) - class_wrapper(46, obj.ptr_MultipleTemplatesIntFloat); + class_wrapper(47, 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 22eb3aaa98..50bd775fa0 100644 --- a/tests/expected/matlab/MyFactorPosePoint2.m +++ b/tests/expected/matlab/MyFactorPosePoint2.m @@ -12,9 +12,9 @@ function obj = MyFactorPosePoint2(varargin) if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682) my_ptr = varargin{2}; - class_wrapper(47, my_ptr); + class_wrapper(48, 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(48, varargin{1}, varargin{2}, varargin{3}, varargin{4}); + my_ptr = class_wrapper(49, varargin{1}, varargin{2}, varargin{3}, varargin{4}); else error('Arguments do not match any overload of MyFactorPosePoint2 constructor'); end @@ -22,7 +22,7 @@ end function delete(obj) - class_wrapper(49, obj.ptr_MyFactorPosePoint2); + class_wrapper(50, obj.ptr_MyFactorPosePoint2); end function display(obj), obj.print(''); end diff --git a/tests/expected/matlab/MyVector12.m b/tests/expected/matlab/MyVector12.m index df7e73250e..7d8dd69e7c 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(40, my_ptr); + class_wrapper(41, my_ptr); elseif nargin == 0 - my_ptr = class_wrapper(41); + my_ptr = class_wrapper(42); else error('Arguments do not match any overload of MyVector12 constructor'); end @@ -22,7 +22,7 @@ end function delete(obj) - class_wrapper(42, obj.ptr_MyVector12); + class_wrapper(43, 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 10c7ad2036..6253a73470 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(37, my_ptr); + class_wrapper(38, my_ptr); elseif nargin == 0 - my_ptr = class_wrapper(38); + my_ptr = class_wrapper(39); else error('Arguments do not match any overload of MyVector3 constructor'); end @@ -22,7 +22,7 @@ end function delete(obj) - class_wrapper(39, obj.ptr_MyVector3); + class_wrapper(40, obj.ptr_MyVector3); end function display(obj), obj.print(''); end diff --git a/tests/expected/matlab/PrimitiveRefDouble.m b/tests/expected/matlab/PrimitiveRefDouble.m index 8a6aca56cb..15743b60ae 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(33, my_ptr); + class_wrapper(34, my_ptr); elseif nargin == 0 - my_ptr = class_wrapper(34); + my_ptr = class_wrapper(35); else error('Arguments do not match any overload of PrimitiveRefDouble constructor'); end @@ -29,7 +29,7 @@ end function delete(obj) - class_wrapper(35, obj.ptr_PrimitiveRefDouble); + class_wrapper(36, 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(36, varargin{:}); + varargout{1} = class_wrapper(37, varargin{:}); return end diff --git a/tests/expected/matlab/Test.m b/tests/expected/matlab/Test.m index 62a3636441..1942fbd2e0 100644 --- a/tests/expected/matlab/Test.m +++ b/tests/expected/matlab/Test.m @@ -35,11 +35,11 @@ function obj = Test(varargin) if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682) my_ptr = varargin{2}; - class_wrapper(9, my_ptr); + class_wrapper(10, my_ptr); elseif nargin == 0 - my_ptr = class_wrapper(10); + my_ptr = class_wrapper(11); elseif nargin == 2 && isa(varargin{1},'double') && isa(varargin{2},'double') - my_ptr = class_wrapper(11, varargin{1}, varargin{2}); + my_ptr = class_wrapper(12, varargin{1}, varargin{2}); else error('Arguments do not match any overload of Test constructor'); end @@ -47,7 +47,7 @@ end function delete(obj) - class_wrapper(12, obj.ptr_Test); + class_wrapper(13, obj.ptr_Test); end function display(obj), obj.print(''); end @@ -58,7 +58,7 @@ function delete(obj) % ARG_EIGENCONSTREF usage: arg_EigenConstRef(Matrix value) : returns void % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 1 && isa(varargin{1},'double') - class_wrapper(13, this, varargin{:}); + class_wrapper(14, this, varargin{:}); return end error('Arguments do not match any overload of function Test.arg_EigenConstRef'); @@ -68,7 +68,7 @@ function delete(obj) % CREATE_MIXEDPTRS usage: create_MixedPtrs() : returns pair< Test, Test > % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 0 - [ varargout{1} varargout{2} ] = class_wrapper(14, this, varargin{:}); + [ varargout{1} varargout{2} ] = class_wrapper(15, this, varargin{:}); return end error('Arguments do not match any overload of function Test.create_MixedPtrs'); @@ -78,7 +78,7 @@ function delete(obj) % CREATE_PTRS usage: create_ptrs() : returns pair< Test, Test > % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 0 - [ varargout{1} varargout{2} ] = class_wrapper(15, this, varargin{:}); + [ varargout{1} varargout{2} ] = class_wrapper(16, this, varargin{:}); return end error('Arguments do not match any overload of function Test.create_ptrs'); @@ -88,7 +88,7 @@ function delete(obj) % PRINT usage: print() : returns void % Doxygen can be found at https://gtsam.org/doxygen/ if length(varargin) == 0 - class_wrapper(16, this, varargin{:}); + class_wrapper(17, this, varargin{:}); return end error('Arguments do not match any overload of function Test.print'); @@ -98,7 +98,7 @@ function delete(obj) % 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(17, this, varargin{:}); + varargout{1} = class_wrapper(18, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_Point2Ptr'); @@ -108,7 +108,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(18, this, varargin{:}); + varargout{1} = class_wrapper(19, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_Test'); @@ -118,7 +118,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(19, this, varargin{:}); + varargout{1} = class_wrapper(20, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_TestPtr'); @@ -128,7 +128,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(20, this, varargin{:}); + varargout{1} = class_wrapper(21, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_bool'); @@ -138,7 +138,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(21, this, varargin{:}); + varargout{1} = class_wrapper(22, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_double'); @@ -148,7 +148,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(22, this, varargin{:}); + varargout{1} = class_wrapper(23, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_field'); @@ -158,7 +158,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(23, this, varargin{:}); + varargout{1} = class_wrapper(24, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_int'); @@ -168,7 +168,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(24, this, varargin{:}); + varargout{1} = class_wrapper(25, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_matrix1'); @@ -178,7 +178,7 @@ 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(25, this, varargin{:}); + varargout{1} = class_wrapper(26, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_matrix2'); @@ -188,13 +188,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(26, this, varargin{:}); + [ varargout{1} varargout{2} ] = class_wrapper(27, 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(27, this, varargin{:}); + [ varargout{1} varargout{2} ] = class_wrapper(28, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_pair'); @@ -204,7 +204,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(28, this, varargin{:}); + [ varargout{1} varargout{2} ] = class_wrapper(29, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_ptrs'); @@ -214,7 +214,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(29, this, varargin{:}); + varargout{1} = class_wrapper(30, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_size_t'); @@ -224,7 +224,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(30, this, varargin{:}); + varargout{1} = class_wrapper(31, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_string'); @@ -234,7 +234,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(31, this, varargin{:}); + varargout{1} = class_wrapper(32, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_vector1'); @@ -244,7 +244,7 @@ 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(32, this, varargin{:}); + varargout{1} = class_wrapper(33, this, varargin{:}); return end error('Arguments do not match any overload of function Test.return_vector2'); diff --git a/tests/expected/matlab/class_wrapper.cpp b/tests/expected/matlab/class_wrapper.cpp index a743066755..f4c7c6af09 100644 --- a/tests/expected/matlab/class_wrapper.cpp +++ b/tests/expected/matlab/class_wrapper.cpp @@ -200,22 +200,32 @@ void FunDouble_deconstructor_6(int nargout, mxArray *out[], int nargin, const mx } } -void FunDouble_dhamaal_7(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void FunDouble_multiTemplatedMethod_7(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { - checkArguments("dhamaalString",nargout,nargin-1,2); + checkArguments("multiTemplatedMethodStringSize_t",nargout,nargin-1,3); auto obj = unwrap_shared_ptr>(in[0], "ptr_FunDouble"); double d = unwrap< double >(in[1]); string t = unwrap< string >(in[2]); - out[0] = wrap_shared_ptr(boost::make_shared>(obj->dhamaal(d,t)),"Fun", false); + size_t u = unwrap< size_t >(in[3]); + out[0] = wrap_shared_ptr(boost::make_shared>(obj->multiTemplatedMethod(d,t,u)),"Fun", false); } -void FunDouble_divertido_8(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void FunDouble_templatedMethod_8(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { - checkArguments("FunDouble.divertido",nargout,nargin,0); - out[0] = wrap_shared_ptr(boost::make_shared>(Fun::divertido()),"Fundouble", false); + checkArguments("templatedMethodString",nargout,nargin-1,2); + auto obj = unwrap_shared_ptr>(in[0], "ptr_FunDouble"); + double d = unwrap< double >(in[1]); + string t = unwrap< string >(in[2]); + out[0] = wrap_shared_ptr(boost::make_shared>(obj->templatedMethod(d,t)),"Fun", false); +} + +void FunDouble_staticMethodWithThis_9(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("FunDouble.staticMethodWithThis",nargout,nargin,0); + out[0] = wrap_shared_ptr(boost::make_shared>(Fun::staticMethodWithThis()),"Fundouble", false); } -void Test_collectorInsertAndMakeBase_9(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_collectorInsertAndMakeBase_10(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef boost::shared_ptr Shared; @@ -224,7 +234,7 @@ void Test_collectorInsertAndMakeBase_9(int nargout, mxArray *out[], int nargin, collector_Test.insert(self); } -void Test_constructor_10(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_constructor_11(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef boost::shared_ptr Shared; @@ -235,7 +245,7 @@ void Test_constructor_10(int nargout, mxArray *out[], int nargin, const mxArray *reinterpret_cast (mxGetData(out[0])) = self; } -void Test_constructor_11(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_constructor_12(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef boost::shared_ptr Shared; @@ -248,7 +258,7 @@ void Test_constructor_11(int nargout, mxArray *out[], int nargin, const mxArray *reinterpret_cast (mxGetData(out[0])) = self; } -void Test_deconstructor_12(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_deconstructor_13(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef boost::shared_ptr Shared; checkArguments("delete_Test",nargout,nargin,1); @@ -261,7 +271,7 @@ void Test_deconstructor_12(int nargout, mxArray *out[], int nargin, const mxArra } } -void Test_arg_EigenConstRef_13(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_arg_EigenConstRef_14(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("arg_EigenConstRef",nargout,nargin-1,1); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -269,7 +279,7 @@ void Test_arg_EigenConstRef_13(int nargout, mxArray *out[], int nargin, const mx obj->arg_EigenConstRef(value); } -void Test_create_MixedPtrs_14(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_create_MixedPtrs_15(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("create_MixedPtrs",nargout,nargin-1,0); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -278,7 +288,7 @@ void Test_create_MixedPtrs_14(int nargout, mxArray *out[], int nargin, const mxA out[1] = wrap_shared_ptr(pairResult.second,"Test", false); } -void Test_create_ptrs_15(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_create_ptrs_16(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("create_ptrs",nargout,nargin-1,0); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -287,14 +297,14 @@ void Test_create_ptrs_15(int nargout, mxArray *out[], int nargin, const mxArray out[1] = wrap_shared_ptr(pairResult.second,"Test", false); } -void Test_print_16(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_print_17(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("print",nargout,nargin-1,0); auto obj = unwrap_shared_ptr(in[0], "ptr_Test"); obj->print(); } -void Test_return_Point2Ptr_17(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_Point2Ptr_18(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"); @@ -305,7 +315,7 @@ void Test_return_Point2Ptr_17(int nargout, mxArray *out[], int nargin, const mxA } } -void Test_return_Test_18(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_Test_19(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"); @@ -313,7 +323,7 @@ void Test_return_Test_18(int nargout, mxArray *out[], int nargin, const mxArray out[0] = wrap_shared_ptr(boost::make_shared(obj->return_Test(value)),"Test", false); } -void Test_return_TestPtr_19(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_TestPtr_20(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"); @@ -321,7 +331,7 @@ void Test_return_TestPtr_19(int nargout, mxArray *out[], int nargin, const mxArr out[0] = wrap_shared_ptr(obj->return_TestPtr(value),"Test", false); } -void Test_return_bool_20(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_bool_21(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"); @@ -329,7 +339,7 @@ void Test_return_bool_20(int nargout, mxArray *out[], int nargin, const mxArray out[0] = wrap< bool >(obj->return_bool(value)); } -void Test_return_double_21(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_double_22(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"); @@ -337,7 +347,7 @@ void Test_return_double_21(int nargout, mxArray *out[], int nargin, const mxArra out[0] = wrap< double >(obj->return_double(value)); } -void Test_return_field_22(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_field_23(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"); @@ -345,7 +355,7 @@ void Test_return_field_22(int nargout, mxArray *out[], int nargin, const mxArray out[0] = wrap< bool >(obj->return_field(t)); } -void Test_return_int_23(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_int_24(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"); @@ -353,7 +363,7 @@ void Test_return_int_23(int nargout, mxArray *out[], int nargin, const mxArray * out[0] = wrap< int >(obj->return_int(value)); } -void Test_return_matrix1_24(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_matrix1_25(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"); @@ -361,7 +371,7 @@ void Test_return_matrix1_24(int nargout, mxArray *out[], int nargin, const mxArr out[0] = wrap< Matrix >(obj->return_matrix1(value)); } -void Test_return_matrix2_25(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_matrix2_26(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"); @@ -369,7 +379,7 @@ void Test_return_matrix2_25(int nargout, mxArray *out[], int nargin, const mxArr out[0] = wrap< Matrix >(obj->return_matrix2(value)); } -void Test_return_pair_26(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_pair_27(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"); @@ -380,7 +390,7 @@ void Test_return_pair_26(int nargout, mxArray *out[], int nargin, const mxArray out[1] = wrap< Matrix >(pairResult.second); } -void Test_return_pair_27(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_pair_28(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"); @@ -390,7 +400,7 @@ void Test_return_pair_27(int nargout, mxArray *out[], int nargin, const mxArray out[1] = wrap< Matrix >(pairResult.second); } -void Test_return_ptrs_28(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_ptrs_29(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"); @@ -401,7 +411,7 @@ void Test_return_ptrs_28(int nargout, mxArray *out[], int nargin, const mxArray out[1] = wrap_shared_ptr(pairResult.second,"Test", false); } -void Test_return_size_t_29(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_size_t_30(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"); @@ -409,7 +419,7 @@ void Test_return_size_t_29(int nargout, mxArray *out[], int nargin, const mxArra out[0] = wrap< size_t >(obj->return_size_t(value)); } -void Test_return_string_30(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_string_31(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"); @@ -417,7 +427,7 @@ void Test_return_string_30(int nargout, mxArray *out[], int nargin, const mxArra out[0] = wrap< string >(obj->return_string(value)); } -void Test_return_vector1_31(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_vector1_32(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"); @@ -425,7 +435,7 @@ void Test_return_vector1_31(int nargout, mxArray *out[], int nargin, const mxArr out[0] = wrap< Vector >(obj->return_vector1(value)); } -void Test_return_vector2_32(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void Test_return_vector2_33(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"); @@ -433,7 +443,7 @@ void Test_return_vector2_32(int nargout, mxArray *out[], int nargin, const mxArr out[0] = wrap< Vector >(obj->return_vector2(value)); } -void PrimitiveRefDouble_collectorInsertAndMakeBase_33(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void PrimitiveRefDouble_collectorInsertAndMakeBase_34(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef boost::shared_ptr> Shared; @@ -442,7 +452,7 @@ void PrimitiveRefDouble_collectorInsertAndMakeBase_33(int nargout, mxArray *out[ collector_PrimitiveRefDouble.insert(self); } -void PrimitiveRefDouble_constructor_34(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void PrimitiveRefDouble_constructor_35(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef boost::shared_ptr> Shared; @@ -453,7 +463,7 @@ void PrimitiveRefDouble_constructor_34(int nargout, mxArray *out[], int nargin, *reinterpret_cast (mxGetData(out[0])) = self; } -void PrimitiveRefDouble_deconstructor_35(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void PrimitiveRefDouble_deconstructor_36(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef boost::shared_ptr> Shared; checkArguments("delete_PrimitiveRefDouble",nargout,nargin,1); @@ -466,14 +476,14 @@ void PrimitiveRefDouble_deconstructor_35(int nargout, mxArray *out[], int nargin } } -void PrimitiveRefDouble_Brutal_36(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void PrimitiveRefDouble_Brutal_37(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("PrimitiveRefDouble.Brutal",nargout,nargin,1); double t = unwrap< double >(in[0]); out[0] = wrap_shared_ptr(boost::make_shared>(PrimitiveRef::Brutal(t)),"PrimitiveRefdouble", false); } -void MyVector3_collectorInsertAndMakeBase_37(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyVector3_collectorInsertAndMakeBase_38(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef boost::shared_ptr> Shared; @@ -482,7 +492,7 @@ void MyVector3_collectorInsertAndMakeBase_37(int nargout, mxArray *out[], int na collector_MyVector3.insert(self); } -void MyVector3_constructor_38(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyVector3_constructor_39(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef boost::shared_ptr> Shared; @@ -493,7 +503,7 @@ void MyVector3_constructor_38(int nargout, mxArray *out[], int nargin, const mxA *reinterpret_cast (mxGetData(out[0])) = self; } -void MyVector3_deconstructor_39(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyVector3_deconstructor_40(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef boost::shared_ptr> Shared; checkArguments("delete_MyVector3",nargout,nargin,1); @@ -506,7 +516,7 @@ void MyVector3_deconstructor_39(int nargout, mxArray *out[], int nargin, const m } } -void MyVector12_collectorInsertAndMakeBase_40(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyVector12_collectorInsertAndMakeBase_41(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef boost::shared_ptr> Shared; @@ -515,7 +525,7 @@ void MyVector12_collectorInsertAndMakeBase_40(int nargout, mxArray *out[], int n collector_MyVector12.insert(self); } -void MyVector12_constructor_41(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyVector12_constructor_42(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef boost::shared_ptr> Shared; @@ -526,7 +536,7 @@ void MyVector12_constructor_41(int nargout, mxArray *out[], int nargin, const mx *reinterpret_cast (mxGetData(out[0])) = self; } -void MyVector12_deconstructor_42(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyVector12_deconstructor_43(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef boost::shared_ptr> Shared; checkArguments("delete_MyVector12",nargout,nargin,1); @@ -539,7 +549,7 @@ void MyVector12_deconstructor_42(int nargout, mxArray *out[], int nargin, const } } -void MultipleTemplatesIntDouble_collectorInsertAndMakeBase_43(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MultipleTemplatesIntDouble_collectorInsertAndMakeBase_44(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef boost::shared_ptr> Shared; @@ -548,7 +558,7 @@ void MultipleTemplatesIntDouble_collectorInsertAndMakeBase_43(int nargout, mxArr collector_MultipleTemplatesIntDouble.insert(self); } -void MultipleTemplatesIntDouble_deconstructor_44(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MultipleTemplatesIntDouble_deconstructor_45(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef boost::shared_ptr> Shared; checkArguments("delete_MultipleTemplatesIntDouble",nargout,nargin,1); @@ -561,7 +571,7 @@ void MultipleTemplatesIntDouble_deconstructor_44(int nargout, mxArray *out[], in } } -void MultipleTemplatesIntFloat_collectorInsertAndMakeBase_45(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MultipleTemplatesIntFloat_collectorInsertAndMakeBase_46(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef boost::shared_ptr> Shared; @@ -570,7 +580,7 @@ void MultipleTemplatesIntFloat_collectorInsertAndMakeBase_45(int nargout, mxArra collector_MultipleTemplatesIntFloat.insert(self); } -void MultipleTemplatesIntFloat_deconstructor_46(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MultipleTemplatesIntFloat_deconstructor_47(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef boost::shared_ptr> Shared; checkArguments("delete_MultipleTemplatesIntFloat",nargout,nargin,1); @@ -583,7 +593,7 @@ void MultipleTemplatesIntFloat_deconstructor_46(int nargout, mxArray *out[], int } } -void MyFactorPosePoint2_collectorInsertAndMakeBase_47(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyFactorPosePoint2_collectorInsertAndMakeBase_48(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef boost::shared_ptr> Shared; @@ -592,7 +602,7 @@ void MyFactorPosePoint2_collectorInsertAndMakeBase_47(int nargout, mxArray *out[ collector_MyFactorPosePoint2.insert(self); } -void MyFactorPosePoint2_constructor_48(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyFactorPosePoint2_constructor_49(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); typedef boost::shared_ptr> Shared; @@ -607,7 +617,7 @@ void MyFactorPosePoint2_constructor_48(int nargout, mxArray *out[], int nargin, *reinterpret_cast (mxGetData(out[0])) = self; } -void MyFactorPosePoint2_deconstructor_49(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +void MyFactorPosePoint2_deconstructor_50(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { typedef boost::shared_ptr> Shared; checkArguments("delete_MyFactorPosePoint2",nargout,nargin,1); @@ -654,133 +664,136 @@ void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) FunDouble_deconstructor_6(nargout, out, nargin-1, in+1); break; case 7: - FunDouble_dhamaal_7(nargout, out, nargin-1, in+1); + FunDouble_multiTemplatedMethod_7(nargout, out, nargin-1, in+1); break; case 8: - FunDouble_divertido_8(nargout, out, nargin-1, in+1); + FunDouble_templatedMethod_8(nargout, out, nargin-1, in+1); break; case 9: - Test_collectorInsertAndMakeBase_9(nargout, out, nargin-1, in+1); + FunDouble_staticMethodWithThis_9(nargout, out, nargin-1, in+1); break; case 10: - Test_constructor_10(nargout, out, nargin-1, in+1); + Test_collectorInsertAndMakeBase_10(nargout, out, nargin-1, in+1); break; case 11: Test_constructor_11(nargout, out, nargin-1, in+1); break; case 12: - Test_deconstructor_12(nargout, out, nargin-1, in+1); + Test_constructor_12(nargout, out, nargin-1, in+1); break; case 13: - Test_arg_EigenConstRef_13(nargout, out, nargin-1, in+1); + Test_deconstructor_13(nargout, out, nargin-1, in+1); break; case 14: - Test_create_MixedPtrs_14(nargout, out, nargin-1, in+1); + Test_arg_EigenConstRef_14(nargout, out, nargin-1, in+1); break; case 15: - Test_create_ptrs_15(nargout, out, nargin-1, in+1); + Test_create_MixedPtrs_15(nargout, out, nargin-1, in+1); break; case 16: - Test_print_16(nargout, out, nargin-1, in+1); + Test_create_ptrs_16(nargout, out, nargin-1, in+1); break; case 17: - Test_return_Point2Ptr_17(nargout, out, nargin-1, in+1); + Test_print_17(nargout, out, nargin-1, in+1); break; case 18: - Test_return_Test_18(nargout, out, nargin-1, in+1); + Test_return_Point2Ptr_18(nargout, out, nargin-1, in+1); break; case 19: - Test_return_TestPtr_19(nargout, out, nargin-1, in+1); + Test_return_Test_19(nargout, out, nargin-1, in+1); break; case 20: - Test_return_bool_20(nargout, out, nargin-1, in+1); + Test_return_TestPtr_20(nargout, out, nargin-1, in+1); break; case 21: - Test_return_double_21(nargout, out, nargin-1, in+1); + Test_return_bool_21(nargout, out, nargin-1, in+1); break; case 22: - Test_return_field_22(nargout, out, nargin-1, in+1); + Test_return_double_22(nargout, out, nargin-1, in+1); break; case 23: - Test_return_int_23(nargout, out, nargin-1, in+1); + Test_return_field_23(nargout, out, nargin-1, in+1); break; case 24: - Test_return_matrix1_24(nargout, out, nargin-1, in+1); + Test_return_int_24(nargout, out, nargin-1, in+1); break; case 25: - Test_return_matrix2_25(nargout, out, nargin-1, in+1); + Test_return_matrix1_25(nargout, out, nargin-1, in+1); break; case 26: - Test_return_pair_26(nargout, out, nargin-1, in+1); + Test_return_matrix2_26(nargout, out, nargin-1, in+1); break; case 27: Test_return_pair_27(nargout, out, nargin-1, in+1); break; case 28: - Test_return_ptrs_28(nargout, out, nargin-1, in+1); + Test_return_pair_28(nargout, out, nargin-1, in+1); break; case 29: - Test_return_size_t_29(nargout, out, nargin-1, in+1); + Test_return_ptrs_29(nargout, out, nargin-1, in+1); break; case 30: - Test_return_string_30(nargout, out, nargin-1, in+1); + Test_return_size_t_30(nargout, out, nargin-1, in+1); break; case 31: - Test_return_vector1_31(nargout, out, nargin-1, in+1); + Test_return_string_31(nargout, out, nargin-1, in+1); break; case 32: - Test_return_vector2_32(nargout, out, nargin-1, in+1); + Test_return_vector1_32(nargout, out, nargin-1, in+1); break; case 33: - PrimitiveRefDouble_collectorInsertAndMakeBase_33(nargout, out, nargin-1, in+1); + Test_return_vector2_33(nargout, out, nargin-1, in+1); break; case 34: - PrimitiveRefDouble_constructor_34(nargout, out, nargin-1, in+1); + PrimitiveRefDouble_collectorInsertAndMakeBase_34(nargout, out, nargin-1, in+1); break; case 35: - PrimitiveRefDouble_deconstructor_35(nargout, out, nargin-1, in+1); + PrimitiveRefDouble_constructor_35(nargout, out, nargin-1, in+1); break; case 36: - PrimitiveRefDouble_Brutal_36(nargout, out, nargin-1, in+1); + PrimitiveRefDouble_deconstructor_36(nargout, out, nargin-1, in+1); break; case 37: - MyVector3_collectorInsertAndMakeBase_37(nargout, out, nargin-1, in+1); + PrimitiveRefDouble_Brutal_37(nargout, out, nargin-1, in+1); break; case 38: - MyVector3_constructor_38(nargout, out, nargin-1, in+1); + MyVector3_collectorInsertAndMakeBase_38(nargout, out, nargin-1, in+1); break; case 39: - MyVector3_deconstructor_39(nargout, out, nargin-1, in+1); + MyVector3_constructor_39(nargout, out, nargin-1, in+1); break; case 40: - MyVector12_collectorInsertAndMakeBase_40(nargout, out, nargin-1, in+1); + MyVector3_deconstructor_40(nargout, out, nargin-1, in+1); break; case 41: - MyVector12_constructor_41(nargout, out, nargin-1, in+1); + MyVector12_collectorInsertAndMakeBase_41(nargout, out, nargin-1, in+1); break; case 42: - MyVector12_deconstructor_42(nargout, out, nargin-1, in+1); + MyVector12_constructor_42(nargout, out, nargin-1, in+1); break; case 43: - MultipleTemplatesIntDouble_collectorInsertAndMakeBase_43(nargout, out, nargin-1, in+1); + MyVector12_deconstructor_43(nargout, out, nargin-1, in+1); break; case 44: - MultipleTemplatesIntDouble_deconstructor_44(nargout, out, nargin-1, in+1); + MultipleTemplatesIntDouble_collectorInsertAndMakeBase_44(nargout, out, nargin-1, in+1); break; case 45: - MultipleTemplatesIntFloat_collectorInsertAndMakeBase_45(nargout, out, nargin-1, in+1); + MultipleTemplatesIntDouble_deconstructor_45(nargout, out, nargin-1, in+1); break; case 46: - MultipleTemplatesIntFloat_deconstructor_46(nargout, out, nargin-1, in+1); + MultipleTemplatesIntFloat_collectorInsertAndMakeBase_46(nargout, out, nargin-1, in+1); break; case 47: - MyFactorPosePoint2_collectorInsertAndMakeBase_47(nargout, out, nargin-1, in+1); + MultipleTemplatesIntFloat_deconstructor_47(nargout, out, nargin-1, in+1); break; case 48: - MyFactorPosePoint2_constructor_48(nargout, out, nargin-1, in+1); + MyFactorPosePoint2_collectorInsertAndMakeBase_48(nargout, out, nargin-1, in+1); break; case 49: - MyFactorPosePoint2_deconstructor_49(nargout, out, nargin-1, in+1); + MyFactorPosePoint2_constructor_49(nargout, out, nargin-1, in+1); + break; + case 50: + MyFactorPosePoint2_deconstructor_50(nargout, out, nargin-1, in+1); break; } } catch(const std::exception& e) { diff --git a/tests/expected/python/class_pybind.cpp b/tests/expected/python/class_pybind.cpp index d6cbd91c57..a996f35ae1 100644 --- a/tests/expected/python/class_pybind.cpp +++ b/tests/expected/python/class_pybind.cpp @@ -28,8 +28,9 @@ PYBIND11_MODULE(class_py, m_) { .def_static("create",[](){return FunRange::create();}); py::class_, std::shared_ptr>>(m_, "FunDouble") - .def("dhamaalString",[](Fun* self, double d, string t){return self->dhamaal(d, t);}, py::arg("d"), py::arg("t")) - .def_static("divertido",[](){return Fun::divertido();}); + .def("templatedMethodString",[](Fun* self, double d, string t){return self->templatedMethod(d, t);}, py::arg("d"), py::arg("t")) + .def("multiTemplatedMethodStringSize_t",[](Fun* self, double d, string t, size_t u){return self->multiTemplatedMethod(d, t, u);}, py::arg("d"), py::arg("t"), py::arg("u")) + .def_static("staticMethodWithThis",[](){return Fun::staticMethodWithThis();}); py::class_>(m_, "Test") .def(py::init<>()) diff --git a/tests/fixtures/class.i b/tests/fixtures/class.i index aca2567ce3..1e2fce338c 100644 --- a/tests/fixtures/class.i +++ b/tests/fixtures/class.i @@ -7,13 +7,13 @@ class FunRange { template class Fun { - static This divertido(); + static This staticMethodWithThis(); template - This dhamaal(double d, T t); + This templatedMethod(double d, T t); - // template - // This pret(double d, T t, U u); + template + This multiTemplatedMethod(double d, T t, U u); };