From 3a8e7de5e39af7ed627a5930a49fda8055dbf591 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Tue, 23 Feb 2010 14:59:30 +0000 Subject: [PATCH] fixed testWrap unit test --- wrap/Makefile.am | 12 ++++++- wrap/expected/@Point2/Point2.m | 15 +++++++++ wrap/expected/@Point2/dim.cpp | 10 ++++++ wrap/expected/@Point2/dim.m | 5 +++ wrap/expected/@Point2/x.cpp | 10 ++++++ wrap/expected/@Point2/x.m | 5 +++ wrap/expected/@Point2/y.cpp | 10 ++++++ wrap/expected/@Point2/y.m | 5 +++ wrap/expected/@Point3/Point3.m | 14 ++++++++ wrap/expected/@Point3/norm.cpp | 10 ++++++ wrap/expected/@Point3/norm.m | 5 +++ wrap/expected/@Test/Test.m | 14 ++++++++ wrap/expected/@Test/create_ptrs.cpp | 11 +++++++ wrap/expected/@Test/create_ptrs.m | 5 +++ wrap/expected/@Test/print.cpp | 9 ++++++ wrap/expected/@Test/print.m | 5 +++ wrap/expected/@Test/return_TestPtr.cpp | 11 +++++++ wrap/expected/@Test/return_TestPtr.m | 5 +++ wrap/expected/@Test/return_bool.cpp | 11 +++++++ wrap/expected/@Test/return_bool.m | 5 +++ wrap/expected/@Test/return_double.cpp | 11 +++++++ wrap/expected/@Test/return_double.m | 5 +++ wrap/expected/@Test/return_field.cpp | 11 +++++++ wrap/expected/@Test/return_field.m | 5 +++ wrap/expected/@Test/return_int.cpp | 11 +++++++ wrap/expected/@Test/return_int.m | 5 +++ wrap/expected/@Test/return_matrix1.cpp | 11 +++++++ wrap/expected/@Test/return_matrix1.m | 5 +++ wrap/expected/@Test/return_matrix2.cpp | 11 +++++++ wrap/expected/@Test/return_matrix2.m | 5 +++ wrap/expected/@Test/return_pair.cpp | 13 ++++++++ wrap/expected/@Test/return_pair.m | 5 +++ wrap/expected/@Test/return_ptrs.cpp | 13 ++++++++ wrap/expected/@Test/return_ptrs.m | 5 +++ wrap/expected/@Test/return_size_t.cpp | 11 +++++++ wrap/expected/@Test/return_size_t.m | 5 +++ wrap/expected/@Test/return_string.cpp | 11 +++++++ wrap/expected/@Test/return_string.m | 5 +++ wrap/expected/@Test/return_vector1.cpp | 11 +++++++ wrap/expected/@Test/return_vector1.m | 5 +++ wrap/expected/@Test/return_vector2.cpp | 11 +++++++ wrap/expected/@Test/return_vector2.m | 5 +++ wrap/expected/make_geometry.m | 44 ++++++++++++++++++++++++++ wrap/expected/new_Point2_.cpp | 9 ++++++ wrap/expected/new_Point2_.m | 4 +++ wrap/expected/new_Point2_dd.cpp | 11 +++++++ wrap/expected/new_Point2_dd.m | 4 +++ wrap/expected/new_Point3_ddd.cpp | 12 +++++++ wrap/expected/new_Point3_ddd.m | 4 +++ wrap/expected/new_Test_.cpp | 9 ++++++ wrap/expected/new_Test_.m | 4 +++ wrap/geometry.h | 39 +++++++++++++++++++++++ wrap/testWrap.cpp | 40 +++++++++++------------ 53 files changed, 516 insertions(+), 21 deletions(-) create mode 100644 wrap/expected/@Point2/Point2.m create mode 100644 wrap/expected/@Point2/dim.cpp create mode 100644 wrap/expected/@Point2/dim.m create mode 100644 wrap/expected/@Point2/x.cpp create mode 100644 wrap/expected/@Point2/x.m create mode 100644 wrap/expected/@Point2/y.cpp create mode 100644 wrap/expected/@Point2/y.m create mode 100644 wrap/expected/@Point3/Point3.m create mode 100644 wrap/expected/@Point3/norm.cpp create mode 100644 wrap/expected/@Point3/norm.m create mode 100644 wrap/expected/@Test/Test.m create mode 100644 wrap/expected/@Test/create_ptrs.cpp create mode 100644 wrap/expected/@Test/create_ptrs.m create mode 100644 wrap/expected/@Test/print.cpp create mode 100644 wrap/expected/@Test/print.m create mode 100644 wrap/expected/@Test/return_TestPtr.cpp create mode 100644 wrap/expected/@Test/return_TestPtr.m create mode 100644 wrap/expected/@Test/return_bool.cpp create mode 100644 wrap/expected/@Test/return_bool.m create mode 100644 wrap/expected/@Test/return_double.cpp create mode 100644 wrap/expected/@Test/return_double.m create mode 100644 wrap/expected/@Test/return_field.cpp create mode 100644 wrap/expected/@Test/return_field.m create mode 100644 wrap/expected/@Test/return_int.cpp create mode 100644 wrap/expected/@Test/return_int.m create mode 100644 wrap/expected/@Test/return_matrix1.cpp create mode 100644 wrap/expected/@Test/return_matrix1.m create mode 100644 wrap/expected/@Test/return_matrix2.cpp create mode 100644 wrap/expected/@Test/return_matrix2.m create mode 100644 wrap/expected/@Test/return_pair.cpp create mode 100644 wrap/expected/@Test/return_pair.m create mode 100644 wrap/expected/@Test/return_ptrs.cpp create mode 100644 wrap/expected/@Test/return_ptrs.m create mode 100644 wrap/expected/@Test/return_size_t.cpp create mode 100644 wrap/expected/@Test/return_size_t.m create mode 100644 wrap/expected/@Test/return_string.cpp create mode 100644 wrap/expected/@Test/return_string.m create mode 100644 wrap/expected/@Test/return_vector1.cpp create mode 100644 wrap/expected/@Test/return_vector1.m create mode 100644 wrap/expected/@Test/return_vector2.cpp create mode 100644 wrap/expected/@Test/return_vector2.m create mode 100644 wrap/expected/make_geometry.m create mode 100644 wrap/expected/new_Point2_.cpp create mode 100644 wrap/expected/new_Point2_.m create mode 100644 wrap/expected/new_Point2_dd.cpp create mode 100644 wrap/expected/new_Point2_dd.m create mode 100644 wrap/expected/new_Point3_ddd.cpp create mode 100644 wrap/expected/new_Point3_ddd.m create mode 100644 wrap/expected/new_Test_.cpp create mode 100644 wrap/expected/new_Test_.m create mode 100644 wrap/geometry.h diff --git a/wrap/Makefile.am b/wrap/Makefile.am index d02676fed..7748dad3a 100644 --- a/wrap/Makefile.am +++ b/wrap/Makefile.am @@ -3,7 +3,12 @@ INSTALL = install AM_CXXFLAGS = -MMD -I$(boost) -I.. -O5 noinst_PROGRAMS = wrap -wrap_SOURCES = utilities.cpp Argument.cpp Constructor.cpp Method.cpp Class.cpp Module.cpp wrap.cpp +common = utilities.cpp Argument.cpp Constructor.cpp Method.cpp Class.cpp Module.cpp +wrap_SOURCES = ${common} wrap.cpp + +check_PROGRAMS = testSpirit testWrap +testSpirit_SOURCES = testSpirit.cpp +testWrap_SOURCES = testWrap.cpp ${common} # generate local toolbox dir interfacePath = ../cpp @@ -19,6 +24,11 @@ include_HEADERS = utilities.h Argument.h Constructor.h Method.h Class.h Module.h install: all +AM_CXXFLAGS += -I.. +AM_LDFLAGS = -L../CppUnitLite -lCppUnitLite $(BOOST_LDFLAGS) + +TESTS = $(check_PROGRAMS) + # clean local toolbox dir clean: @test -z "wrap" || rm -f wrap diff --git a/wrap/expected/@Point2/Point2.m b/wrap/expected/@Point2/Point2.m new file mode 100644 index 000000000..9cdfd6fd5 --- /dev/null +++ b/wrap/expected/@Point2/Point2.m @@ -0,0 +1,15 @@ +% automatically generated by wrap on 2010-Feb-23 +classdef Point2 + properties + self = 0 + end + methods + function obj = Point2(varargin) + if nargin == 0, obj.self = new_Point2_(); end + if nargin == 2, obj.self = new_Point2_dd(varargin{1},varargin{2}); end + if nargin ~= 13 && obj.self == 0, error('Point2 constructor failed'); end + end + function display(obj), obj.print(''); end + function disp(obj), obj.display; end + end +end diff --git a/wrap/expected/@Point2/dim.cpp b/wrap/expected/@Point2/dim.cpp new file mode 100644 index 000000000..2955d58c3 --- /dev/null +++ b/wrap/expected/@Point2/dim.cpp @@ -0,0 +1,10 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("dim",nargout,nargin-1,0); + shared_ptr self = unwrap_shared_ptr< Point2 >(in[0],"Point2"); + int result = self->dim(); + out[0] = wrap< int >(result); +} diff --git a/wrap/expected/@Point2/dim.m b/wrap/expected/@Point2/dim.m new file mode 100644 index 000000000..93caab12f --- /dev/null +++ b/wrap/expected/@Point2/dim.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.dim() +function result = dim(obj) + error('need to compile dim.cpp'); +end diff --git a/wrap/expected/@Point2/x.cpp b/wrap/expected/@Point2/x.cpp new file mode 100644 index 000000000..5f98d17c6 --- /dev/null +++ b/wrap/expected/@Point2/x.cpp @@ -0,0 +1,10 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("x",nargout,nargin-1,0); + shared_ptr self = unwrap_shared_ptr< Point2 >(in[0],"Point2"); + double result = self->x(); + out[0] = wrap< double >(result); +} diff --git a/wrap/expected/@Point2/x.m b/wrap/expected/@Point2/x.m new file mode 100644 index 000000000..4dae83bf5 --- /dev/null +++ b/wrap/expected/@Point2/x.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.x() +function result = x(obj) + error('need to compile x.cpp'); +end diff --git a/wrap/expected/@Point2/y.cpp b/wrap/expected/@Point2/y.cpp new file mode 100644 index 000000000..835aa8a1e --- /dev/null +++ b/wrap/expected/@Point2/y.cpp @@ -0,0 +1,10 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("y",nargout,nargin-1,0); + shared_ptr self = unwrap_shared_ptr< Point2 >(in[0],"Point2"); + double result = self->y(); + out[0] = wrap< double >(result); +} diff --git a/wrap/expected/@Point2/y.m b/wrap/expected/@Point2/y.m new file mode 100644 index 000000000..9e2897114 --- /dev/null +++ b/wrap/expected/@Point2/y.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.y() +function result = y(obj) + error('need to compile y.cpp'); +end diff --git a/wrap/expected/@Point3/Point3.m b/wrap/expected/@Point3/Point3.m new file mode 100644 index 000000000..139c7d079 --- /dev/null +++ b/wrap/expected/@Point3/Point3.m @@ -0,0 +1,14 @@ +% automatically generated by wrap on 2010-Feb-23 +classdef Point3 + properties + self = 0 + end + methods + function obj = Point3(varargin) + if nargin == 3, obj.self = new_Point3_ddd(varargin{1},varargin{2},varargin{3}); end + if nargin ~= 13 && obj.self == 0, error('Point3 constructor failed'); end + end + function display(obj), obj.print(''); end + function disp(obj), obj.display; end + end +end diff --git a/wrap/expected/@Point3/norm.cpp b/wrap/expected/@Point3/norm.cpp new file mode 100644 index 000000000..37ad329ce --- /dev/null +++ b/wrap/expected/@Point3/norm.cpp @@ -0,0 +1,10 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("norm",nargout,nargin-1,0); + shared_ptr self = unwrap_shared_ptr< Point3 >(in[0],"Point3"); + double result = self->norm(); + out[0] = wrap< double >(result); +} diff --git a/wrap/expected/@Point3/norm.m b/wrap/expected/@Point3/norm.m new file mode 100644 index 000000000..02943303f --- /dev/null +++ b/wrap/expected/@Point3/norm.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.norm() +function result = norm(obj) + error('need to compile norm.cpp'); +end diff --git a/wrap/expected/@Test/Test.m b/wrap/expected/@Test/Test.m new file mode 100644 index 000000000..31e5e35b2 --- /dev/null +++ b/wrap/expected/@Test/Test.m @@ -0,0 +1,14 @@ +% automatically generated by wrap on 2010-Feb-23 +classdef Test + properties + self = 0 + end + methods + function obj = Test(varargin) + if nargin == 0, obj.self = new_Test_(); end + if nargin ~= 13 && obj.self == 0, error('Test constructor failed'); end + end + function display(obj), obj.print(''); end + function disp(obj), obj.display; end + end +end diff --git a/wrap/expected/@Test/create_ptrs.cpp b/wrap/expected/@Test/create_ptrs.cpp new file mode 100644 index 000000000..9a7215a60 --- /dev/null +++ b/wrap/expected/@Test/create_ptrs.cpp @@ -0,0 +1,11 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("create_ptrs",nargout,nargin-1,0); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + pair< shared_ptr, shared_ptr > result = self->create_ptrs(); + out[0] = wrap_shared_ptr(result.first,"Test"); + out[1] = wrap_shared_ptr(result.second,"Test"); +} diff --git a/wrap/expected/@Test/create_ptrs.m b/wrap/expected/@Test/create_ptrs.m new file mode 100644 index 000000000..0fbbd9be5 --- /dev/null +++ b/wrap/expected/@Test/create_ptrs.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.create_ptrs() +function [first,second] = create_ptrs(obj) + error('need to compile create_ptrs.cpp'); +end diff --git a/wrap/expected/@Test/print.cpp b/wrap/expected/@Test/print.cpp new file mode 100644 index 000000000..5db55477c --- /dev/null +++ b/wrap/expected/@Test/print.cpp @@ -0,0 +1,9 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("print",nargout,nargin-1,0); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + self->print(); +} diff --git a/wrap/expected/@Test/print.m b/wrap/expected/@Test/print.m new file mode 100644 index 000000000..91e8ff31a --- /dev/null +++ b/wrap/expected/@Test/print.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.print() +function result = print(obj) + error('need to compile print.cpp'); +end diff --git a/wrap/expected/@Test/return_TestPtr.cpp b/wrap/expected/@Test/return_TestPtr.cpp new file mode 100644 index 000000000..0c22621a6 --- /dev/null +++ b/wrap/expected/@Test/return_TestPtr.cpp @@ -0,0 +1,11 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_TestPtr",nargout,nargin-1,1); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + shared_ptr value = unwrap_shared_ptr< Test >(in[1], "Test"); + shared_ptr result = self->return_TestPtr(value); + out[0] = wrap_shared_ptr(result,"Test"); +} diff --git a/wrap/expected/@Test/return_TestPtr.m b/wrap/expected/@Test/return_TestPtr.m new file mode 100644 index 000000000..0753c283b --- /dev/null +++ b/wrap/expected/@Test/return_TestPtr.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.return_TestPtr(value) +function result = return_TestPtr(obj,value) + error('need to compile return_TestPtr.cpp'); +end diff --git a/wrap/expected/@Test/return_bool.cpp b/wrap/expected/@Test/return_bool.cpp new file mode 100644 index 000000000..d05f5c3b7 --- /dev/null +++ b/wrap/expected/@Test/return_bool.cpp @@ -0,0 +1,11 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_bool",nargout,nargin-1,1); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + bool value = unwrap< bool >(in[1]); + bool result = self->return_bool(value); + out[0] = wrap< bool >(result); +} diff --git a/wrap/expected/@Test/return_bool.m b/wrap/expected/@Test/return_bool.m new file mode 100644 index 000000000..3ef97ad8f --- /dev/null +++ b/wrap/expected/@Test/return_bool.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.return_bool(value) +function result = return_bool(obj,value) + error('need to compile return_bool.cpp'); +end diff --git a/wrap/expected/@Test/return_double.cpp b/wrap/expected/@Test/return_double.cpp new file mode 100644 index 000000000..edbffb889 --- /dev/null +++ b/wrap/expected/@Test/return_double.cpp @@ -0,0 +1,11 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_double",nargout,nargin-1,1); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + double value = unwrap< double >(in[1]); + double result = self->return_double(value); + out[0] = wrap< double >(result); +} diff --git a/wrap/expected/@Test/return_double.m b/wrap/expected/@Test/return_double.m new file mode 100644 index 000000000..87e2929da --- /dev/null +++ b/wrap/expected/@Test/return_double.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.return_double(value) +function result = return_double(obj,value) + error('need to compile return_double.cpp'); +end diff --git a/wrap/expected/@Test/return_field.cpp b/wrap/expected/@Test/return_field.cpp new file mode 100644 index 000000000..727f6faa0 --- /dev/null +++ b/wrap/expected/@Test/return_field.cpp @@ -0,0 +1,11 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_field",nargout,nargin-1,1); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + Test& t = *unwrap_shared_ptr< Test >(in[1], "Test"); + bool result = self->return_field(t); + out[0] = wrap< bool >(result); +} diff --git a/wrap/expected/@Test/return_field.m b/wrap/expected/@Test/return_field.m new file mode 100644 index 000000000..7e63e32e2 --- /dev/null +++ b/wrap/expected/@Test/return_field.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.return_field(t) +function result = return_field(obj,t) + error('need to compile return_field.cpp'); +end diff --git a/wrap/expected/@Test/return_int.cpp b/wrap/expected/@Test/return_int.cpp new file mode 100644 index 000000000..61b53f4ce --- /dev/null +++ b/wrap/expected/@Test/return_int.cpp @@ -0,0 +1,11 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_int",nargout,nargin-1,1); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + int value = unwrap< int >(in[1]); + int result = self->return_int(value); + out[0] = wrap< int >(result); +} diff --git a/wrap/expected/@Test/return_int.m b/wrap/expected/@Test/return_int.m new file mode 100644 index 000000000..df5502203 --- /dev/null +++ b/wrap/expected/@Test/return_int.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.return_int(value) +function result = return_int(obj,value) + error('need to compile return_int.cpp'); +end diff --git a/wrap/expected/@Test/return_matrix1.cpp b/wrap/expected/@Test/return_matrix1.cpp new file mode 100644 index 000000000..c7b12ddad --- /dev/null +++ b/wrap/expected/@Test/return_matrix1.cpp @@ -0,0 +1,11 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_matrix1",nargout,nargin-1,1); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + Matrix value = unwrap< Matrix >(in[1]); + Matrix result = self->return_matrix1(value); + out[0] = wrap< Matrix >(result); +} diff --git a/wrap/expected/@Test/return_matrix1.m b/wrap/expected/@Test/return_matrix1.m new file mode 100644 index 000000000..bb71670db --- /dev/null +++ b/wrap/expected/@Test/return_matrix1.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.return_matrix1(value) +function result = return_matrix1(obj,value) + error('need to compile return_matrix1.cpp'); +end diff --git a/wrap/expected/@Test/return_matrix2.cpp b/wrap/expected/@Test/return_matrix2.cpp new file mode 100644 index 000000000..e41cf5f96 --- /dev/null +++ b/wrap/expected/@Test/return_matrix2.cpp @@ -0,0 +1,11 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_matrix2",nargout,nargin-1,1); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + Matrix value = unwrap< Matrix >(in[1]); + Matrix result = self->return_matrix2(value); + out[0] = wrap< Matrix >(result); +} diff --git a/wrap/expected/@Test/return_matrix2.m b/wrap/expected/@Test/return_matrix2.m new file mode 100644 index 000000000..b8b74dd03 --- /dev/null +++ b/wrap/expected/@Test/return_matrix2.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.return_matrix2(value) +function result = return_matrix2(obj,value) + error('need to compile return_matrix2.cpp'); +end diff --git a/wrap/expected/@Test/return_pair.cpp b/wrap/expected/@Test/return_pair.cpp new file mode 100644 index 000000000..0e274049e --- /dev/null +++ b/wrap/expected/@Test/return_pair.cpp @@ -0,0 +1,13 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_pair",nargout,nargin-1,2); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + Vector v = unwrap< Vector >(in[1]); + Matrix A = unwrap< Matrix >(in[2]); + pair< Vector, Matrix > result = self->return_pair(v,A); + out[0] = wrap< Vector >(result.first); + out[1] = wrap< Matrix >(result.second); +} diff --git a/wrap/expected/@Test/return_pair.m b/wrap/expected/@Test/return_pair.m new file mode 100644 index 000000000..35348fd9b --- /dev/null +++ b/wrap/expected/@Test/return_pair.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.return_pair(v,A) +function [first,second] = return_pair(obj,v,A) + error('need to compile return_pair.cpp'); +end diff --git a/wrap/expected/@Test/return_ptrs.cpp b/wrap/expected/@Test/return_ptrs.cpp new file mode 100644 index 000000000..4ad4c4fd4 --- /dev/null +++ b/wrap/expected/@Test/return_ptrs.cpp @@ -0,0 +1,13 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_ptrs",nargout,nargin-1,2); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + shared_ptr p1 = unwrap_shared_ptr< Test >(in[1], "Test"); + shared_ptr p2 = unwrap_shared_ptr< Test >(in[2], "Test"); + pair< shared_ptr, shared_ptr > result = self->return_ptrs(p1,p2); + out[0] = wrap_shared_ptr(result.first,"Test"); + out[1] = wrap_shared_ptr(result.second,"Test"); +} diff --git a/wrap/expected/@Test/return_ptrs.m b/wrap/expected/@Test/return_ptrs.m new file mode 100644 index 000000000..ba1a16659 --- /dev/null +++ b/wrap/expected/@Test/return_ptrs.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.return_ptrs(p1,p2) +function [first,second] = return_ptrs(obj,p1,p2) + error('need to compile return_ptrs.cpp'); +end diff --git a/wrap/expected/@Test/return_size_t.cpp b/wrap/expected/@Test/return_size_t.cpp new file mode 100644 index 000000000..ce5a1a9e4 --- /dev/null +++ b/wrap/expected/@Test/return_size_t.cpp @@ -0,0 +1,11 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_size_t",nargout,nargin-1,1); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + size_t value = unwrap< size_t >(in[1]); + size_t result = self->return_size_t(value); + out[0] = wrap< size_t >(result); +} diff --git a/wrap/expected/@Test/return_size_t.m b/wrap/expected/@Test/return_size_t.m new file mode 100644 index 000000000..ad4500fd1 --- /dev/null +++ b/wrap/expected/@Test/return_size_t.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.return_size_t(value) +function result = return_size_t(obj,value) + error('need to compile return_size_t.cpp'); +end diff --git a/wrap/expected/@Test/return_string.cpp b/wrap/expected/@Test/return_string.cpp new file mode 100644 index 000000000..d09e8fb31 --- /dev/null +++ b/wrap/expected/@Test/return_string.cpp @@ -0,0 +1,11 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_string",nargout,nargin-1,1); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + string value = unwrap< string >(in[1]); + string result = self->return_string(value); + out[0] = wrap< string >(result); +} diff --git a/wrap/expected/@Test/return_string.m b/wrap/expected/@Test/return_string.m new file mode 100644 index 000000000..28a02b0d1 --- /dev/null +++ b/wrap/expected/@Test/return_string.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.return_string(value) +function result = return_string(obj,value) + error('need to compile return_string.cpp'); +end diff --git a/wrap/expected/@Test/return_vector1.cpp b/wrap/expected/@Test/return_vector1.cpp new file mode 100644 index 000000000..079ebff09 --- /dev/null +++ b/wrap/expected/@Test/return_vector1.cpp @@ -0,0 +1,11 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_vector1",nargout,nargin-1,1); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + Vector value = unwrap< Vector >(in[1]); + Vector result = self->return_vector1(value); + out[0] = wrap< Vector >(result); +} diff --git a/wrap/expected/@Test/return_vector1.m b/wrap/expected/@Test/return_vector1.m new file mode 100644 index 000000000..266017c86 --- /dev/null +++ b/wrap/expected/@Test/return_vector1.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.return_vector1(value) +function result = return_vector1(obj,value) + error('need to compile return_vector1.cpp'); +end diff --git a/wrap/expected/@Test/return_vector2.cpp b/wrap/expected/@Test/return_vector2.cpp new file mode 100644 index 000000000..693d3d06b --- /dev/null +++ b/wrap/expected/@Test/return_vector2.cpp @@ -0,0 +1,11 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("return_vector2",nargout,nargin-1,1); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + Vector value = unwrap< Vector >(in[1]); + Vector result = self->return_vector2(value); + out[0] = wrap< Vector >(result); +} diff --git a/wrap/expected/@Test/return_vector2.m b/wrap/expected/@Test/return_vector2.m new file mode 100644 index 000000000..f237ce228 --- /dev/null +++ b/wrap/expected/@Test/return_vector2.m @@ -0,0 +1,5 @@ +% automatically generated by wrap on 2010-Feb-23 +% usage: obj.return_vector2(value) +function result = return_vector2(obj,value) + error('need to compile return_vector2.cpp'); +end diff --git a/wrap/expected/make_geometry.m b/wrap/expected/make_geometry.m new file mode 100644 index 000000000..a266b2d6d --- /dev/null +++ b/wrap/expected/make_geometry.m @@ -0,0 +1,44 @@ +% automatically generated by wrap on 2010-Feb-23 +echo on + +toolboxpath = pwd +addpath(toolboxpath); + +cd(toolboxpath) +mex -O5 new_Point2_.cpp +mex -O5 new_Point2_dd.cpp + +cd @Point2 +mex -O5 x.cpp +mex -O5 y.cpp +mex -O5 dim.cpp + +cd(toolboxpath) +mex -O5 new_Point3_ddd.cpp + +cd @Point3 +mex -O5 norm.cpp + +cd(toolboxpath) +mex -O5 new_Test_.cpp + +cd @Test +mex -O5 return_bool.cpp +mex -O5 return_size_t.cpp +mex -O5 return_int.cpp +mex -O5 return_double.cpp +mex -O5 return_string.cpp +mex -O5 return_vector1.cpp +mex -O5 return_matrix1.cpp +mex -O5 return_vector2.cpp +mex -O5 return_matrix2.cpp +mex -O5 return_pair.cpp +mex -O5 return_field.cpp +mex -O5 return_TestPtr.cpp +mex -O5 create_ptrs.cpp +mex -O5 return_ptrs.cpp +mex -O5 print.cpp + +cd(toolboxpath) + +echo off diff --git a/wrap/expected/new_Point2_.cpp b/wrap/expected/new_Point2_.cpp new file mode 100644 index 000000000..6a78d318d --- /dev/null +++ b/wrap/expected/new_Point2_.cpp @@ -0,0 +1,9 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("new_Point2_",nargout,nargin,0); + Point2* self = new Point2(); + out[0] = wrap_constructed(self,"Point2"); +} diff --git a/wrap/expected/new_Point2_.m b/wrap/expected/new_Point2_.m new file mode 100644 index 000000000..b5cab71ab --- /dev/null +++ b/wrap/expected/new_Point2_.m @@ -0,0 +1,4 @@ +% automatically generated by wrap on 2010-Feb-23 +function result = new_Point2_(obj) + error('need to compile new_Point2_.cpp'); +end diff --git a/wrap/expected/new_Point2_dd.cpp b/wrap/expected/new_Point2_dd.cpp new file mode 100644 index 000000000..15a8a190d --- /dev/null +++ b/wrap/expected/new_Point2_dd.cpp @@ -0,0 +1,11 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("new_Point2_dd",nargout,nargin,2); + double x = unwrap< double >(in[0]); + double y = unwrap< double >(in[1]); + Point2* self = new Point2(x,y); + out[0] = wrap_constructed(self,"Point2"); +} diff --git a/wrap/expected/new_Point2_dd.m b/wrap/expected/new_Point2_dd.m new file mode 100644 index 000000000..bdd42b766 --- /dev/null +++ b/wrap/expected/new_Point2_dd.m @@ -0,0 +1,4 @@ +% automatically generated by wrap on 2010-Feb-23 +function result = new_Point2_dd(obj,x,y) + error('need to compile new_Point2_dd.cpp'); +end diff --git a/wrap/expected/new_Point3_ddd.cpp b/wrap/expected/new_Point3_ddd.cpp new file mode 100644 index 000000000..82c95bdc6 --- /dev/null +++ b/wrap/expected/new_Point3_ddd.cpp @@ -0,0 +1,12 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("new_Point3_ddd",nargout,nargin,3); + double x = unwrap< double >(in[0]); + double y = unwrap< double >(in[1]); + double z = unwrap< double >(in[2]); + Point3* self = new Point3(x,y,z); + out[0] = wrap_constructed(self,"Point3"); +} diff --git a/wrap/expected/new_Point3_ddd.m b/wrap/expected/new_Point3_ddd.m new file mode 100644 index 000000000..229b9658c --- /dev/null +++ b/wrap/expected/new_Point3_ddd.m @@ -0,0 +1,4 @@ +% automatically generated by wrap on 2010-Feb-23 +function result = new_Point3_ddd(obj,x,y,z) + error('need to compile new_Point3_ddd.cpp'); +end diff --git a/wrap/expected/new_Test_.cpp b/wrap/expected/new_Test_.cpp new file mode 100644 index 000000000..ab2171762 --- /dev/null +++ b/wrap/expected/new_Test_.cpp @@ -0,0 +1,9 @@ +// automatically generated by wrap on 2010-Feb-23 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("new_Test_",nargout,nargin,0); + Test* self = new Test(); + out[0] = wrap_constructed(self,"Test"); +} diff --git a/wrap/expected/new_Test_.m b/wrap/expected/new_Test_.m new file mode 100644 index 000000000..1aae9b6f5 --- /dev/null +++ b/wrap/expected/new_Test_.m @@ -0,0 +1,4 @@ +% automatically generated by wrap on 2010-Feb-23 +function result = new_Test_(obj) + error('need to compile new_Test_.cpp'); +end diff --git a/wrap/geometry.h b/wrap/geometry.h new file mode 100644 index 000000000..9b1d80b00 --- /dev/null +++ b/wrap/geometry.h @@ -0,0 +1,39 @@ + +class Point2 { + Point2(); + Point2(double x, double y); + double x(); + double y(); + int dim() const; +}; + +class Point3 { + Point3(double x, double y, double z); + double norm() const; +}; + +class Test { + Test(); + + bool return_bool (bool value); + size_t return_size_t (size_t value); + int return_int (int value); + double return_double (double value); + + string return_string (string value); + Vector return_vector1(Vector value); + Matrix return_matrix1(Matrix value); + Vector return_vector2(Vector value); + Matrix return_matrix2(Matrix value); + + pair return_pair (Vector v, Matrix A); + + bool return_field(const Test& t) const; + + Test* return_TestPtr(Test* value); + + pair create_ptrs (); + pair return_ptrs (Test* p1, Test* p2); + + void print(); +}; diff --git a/wrap/testWrap.cpp b/wrap/testWrap.cpp index f28e0035f..7eda9ceb7 100644 --- a/wrap/testWrap.cpp +++ b/wrap/testWrap.cpp @@ -27,7 +27,7 @@ TEST( wrap, ArgumentList ) { /* ************************************************************************* */ TEST( wrap, parse ) { - Module module("../interfaces", "geometry"); + Module module(".", "geometry"); CHECK(module.classes.size()==3); // check second class, Point3 @@ -58,32 +58,32 @@ TEST( wrap, parse ) { /* ************************************************************************* */ TEST( wrap, matlab_code ) { // Parse into class object - Module module("../interfaces","geometry"); + Module module(".","geometry"); // emit MATLAB code // make_geometry will not compile, use make testwrap to generate real make - module.matlab_code("/Users/dellaert/projects/gtsam/matlab", "", "-O5"); + module.matlab_code("actual", "", "-O5"); - CHECK(files_equal("../matlab/@Point2/Point2.m" , "../matlab/@Point2/Point2-expected.m" )); - CHECK(files_equal("../matlab/@Point2/x.cpp" , "../matlab/@Point2/x-expected.cpp" )); + CHECK(files_equal("expected/@Point2/Point2.m" , "actual/@Point2/Point2.m" )); + CHECK(files_equal("expected/@Point2/x.cpp" , "actual/@Point2/x.cpp" )); - CHECK(files_equal("../matlab/@Point3/Point3.m" , "../matlab/@Point3/Point3-expected.m" )); - CHECK(files_equal("../matlab/new_Point3_ddd.m" , "../matlab/new_Point3_ddd-expected.m" )); - CHECK(files_equal("../matlab/new_Point3_ddd.cpp", "../matlab/new_Point3_ddd-expected.cpp")); - CHECK(files_equal("../matlab/@Point3/norm.m" , "../matlab/@Point3/norm-expected.m" )); - CHECK(files_equal("../matlab/@Point3/norm.cpp" , "../matlab/@Point3/norm-expected.cpp" )); + CHECK(files_equal("expected/@Point3/Point3.m" , "actual/@Point3/Point3.m" )); + CHECK(files_equal("expected/new_Point3_ddd.m" , "actual/new_Point3_ddd.m" )); + CHECK(files_equal("expected/new_Point3_ddd.cpp", "actual/new_Point3_ddd.cpp")); + CHECK(files_equal("expected/@Point3/norm.m" , "actual/@Point3/norm.m" )); + CHECK(files_equal("expected/@Point3/norm.cpp" , "actual/@Point3/norm.cpp" )); - CHECK(files_equal("../matlab/new_Test_.cpp" , "../matlab/new_Test_-expected.cpp" )); - CHECK(files_equal("../matlab/@Test/Test.m" , "../matlab/@Test/Test-expected.m" )); - CHECK(files_equal("../matlab/@Test/return_string.cpp" , "../matlab/@Test/return_string-expected.cpp" )); - CHECK(files_equal("../matlab/@Test/return_pair.cpp" , "../matlab/@Test/return_pair-expected.cpp" )); - CHECK(files_equal("../matlab/@Test/return_field.cpp" , "../matlab/@Test/return_field-expected.cpp" )); - CHECK(files_equal("../matlab/@Test/return_TestPtr.cpp", "../matlab/@Test/return_TestPtr-expected.cpp")); - CHECK(files_equal("../matlab/@Test/return_ptrs.cpp" , "../matlab/@Test/return_ptrs-expected.cpp" )); - CHECK(files_equal("../matlab/@Test/print.m" , "../matlab/@Test/print-expected.m" )); - CHECK(files_equal("../matlab/@Test/print.cpp" , "../matlab/@Test/print-expected.cpp" )); + CHECK(files_equal("expected/new_Test_.cpp" , "actual/new_Test_.cpp" )); + CHECK(files_equal("expected/@Test/Test.m" , "actual/@Test/Test.m" )); + CHECK(files_equal("expected/@Test/return_string.cpp" , "actual/@Test/return_string.cpp" )); + CHECK(files_equal("expected/@Test/return_pair.cpp" , "actual/@Test/return_pair.cpp" )); + CHECK(files_equal("expected/@Test/return_field.cpp" , "actual/@Test/return_field.cpp" )); + CHECK(files_equal("expected/@Test/return_TestPtr.cpp", "actual/@Test/return_TestPtr.cpp")); + CHECK(files_equal("expected/@Test/return_ptrs.cpp" , "actual/@Test/return_ptrs.cpp" )); + CHECK(files_equal("expected/@Test/print.m" , "actual/@Test/print.m" )); + CHECK(files_equal("expected/@Test/print.cpp" , "actual/@Test/print.cpp" )); - CHECK(files_equal("../matlab/make_geometry.m" , "../matlab/make_geometry_expected.m" )); + CHECK(files_equal("expected/make_geometry.m" , "actual/make_geometry.m" )); } /* ************************************************************************* */