diff --git a/.cproject b/.cproject index bdbc3c0dd..05b53a07a 100644 --- a/.cproject +++ b/.cproject @@ -375,14 +375,6 @@ true true - - make - -j2 - testGaussianFactor.run - true - true - true - make -j2 @@ -409,6 +401,7 @@ make + tests/testBayesTree.run true false @@ -416,6 +409,7 @@ make + testBinaryBayesNet.run true false @@ -463,6 +457,7 @@ make + testSymbolicBayesNet.run true false @@ -470,6 +465,7 @@ make + tests/testSymbolicFactor.run true false @@ -477,6 +473,7 @@ make + testSymbolicFactorGraph.run true false @@ -492,11 +489,20 @@ make + tests/testBayesTree true false true + + make + -j2 + testGaussianFactor.run + true + true + true + make -j2 @@ -523,7 +529,6 @@ make - testGraph.run true false @@ -595,7 +600,6 @@ make - testInference.run true false @@ -603,7 +607,6 @@ make - testGaussianFactor.run true false @@ -611,7 +614,6 @@ make - testJunctionTree.run true false @@ -619,7 +621,6 @@ make - testSymbolicBayesNet.run true false @@ -627,7 +628,6 @@ make - testSymbolicFactorGraph.run true false @@ -681,20 +681,20 @@ true true - + make - -j2 + -j5 all true - true + false true - + make - -j2 - clean + -j5 + check true - true + false true @@ -713,6 +713,22 @@ true true + + make + -j2 + all + true + true + true + + + make + -j2 + clean + true + true + true + make -j2 @@ -737,7 +753,15 @@ true true - + + make + -j2 + all + true + true + true + + make -j2 check @@ -745,6 +769,14 @@ true true + + make + -j2 + clean + true + true + true + make -j2 @@ -785,15 +817,7 @@ true true - - make - -j2 - all - true - true - true - - + make -j2 check @@ -801,14 +825,6 @@ true true - - make - -j2 - clean - true - true - true - make -j2 @@ -1131,6 +1147,7 @@ make + testErrors.run true false @@ -1538,7 +1555,6 @@ make - testSimulated2DOriented.run true false @@ -1578,7 +1594,6 @@ make - testSimulated2D.run true false @@ -1586,7 +1601,6 @@ make - testSimulated3D.run true false @@ -1834,7 +1848,6 @@ make - tests/testGaussianISAM2 true false @@ -1856,6 +1869,46 @@ true true + + make + -j2 + install + true + true + true + + + make + -j2 + clean + true + true + true + + + make + -j2 + check + true + true + true + + + make + -j2 + all + true + true + true + + + make + -j2 + dist + true + true + true + make -j2 @@ -1952,78 +2005,6 @@ true true - - make - -j2 - install - true - true - true - - - make - -j2 - clean - true - true - true - - - make - -j2 - check - true - true - true - - - make - -j2 - all - true - true - true - - - make - -j2 - dist - true - true - true - - - make - -j2 - check - true - true - true - - - make - -j2 - install - true - true - true - - - make - -j2 - tests/testSpirit.run - true - true - true - - - make - -j2 - tests/testWrap.run - true - true - true - make -j2 @@ -2064,6 +2045,70 @@ true true + + make + -j5 + check + true + false + true + + + make + -j5 + install + true + false + true + + + make + -j2 + check + true + true + true + + + make + -j2 + install + true + true + true + + + make + -j2 + tests/testSpirit.run + true + true + true + + + make + -j2 + tests/testWrap.run + true + true + true + + + make + -j2 + clean + true + true + true + + + make + -j2 + all + true + true + true + diff --git a/gtsam.h b/gtsam.h index 6aa6546f5..23fa08987 100644 --- a/gtsam.h +++ b/gtsam.h @@ -8,9 +8,8 @@ * Constructors must appear in a class before any methods * Methods can only return Matrix, Vector, double, int, void, and a shared_ptr to any other object * Comments can use either C++ or C style - * Static methods are not supported - FIXED * Methods must start with a lowercase letter - * Static methods must start with an uppercase letter + * Static methods must start with a letter (upper or lowercase) and use the "static" keyword * Classes must start with an uppercase letter */ @@ -66,6 +65,7 @@ class Rot3 { Rot3(Matrix R); static Rot3* Expmap_(Vector v); static Vector Logmap(const Rot3& p); + static Rot3 ypr(double y, double p, double r); Matrix matrix() const; Matrix transpose() const; Vector xyz() const; diff --git a/wrap/Module.cpp b/wrap/Module.cpp index 5f150b8d2..da481b9d5 100644 --- a/wrap/Module.cpp +++ b/wrap/Module.cpp @@ -102,14 +102,18 @@ Module::Module(const string& interfacePath, [push_back_a(cls.constructors, constructor)] [assign_a(constructor,constructor0)]; + Rule returnClass1_p = className_p [assign_a(retVal.returns_class_, true)]; + + Rule returnClass2_p = className_p [assign_a(retVal.returns_class2_, true)]; + Rule returnType1_p = basisType_p[assign_a(retVal.returns_)] | - ((className_p | "Vector" | "Matrix")[assign_a(retVal.returns_)] >> + ((returnClass1_p | "Vector" | "Matrix")[assign_a(retVal.returns_)] >> !ch_p('*') [assign_a(retVal.returns_ptr_,true)]); Rule returnType2_p = basisType_p[assign_a(retVal.returns2_)] | - ((className_p | "Vector" | "Matrix")[assign_a(retVal.returns2_)] >> + ((returnClass2_p | "Vector" | "Matrix")[assign_a(retVal.returns2_)] >> !ch_p('*') [assign_a(retVal.returns_ptr2_,true)]); Rule pair_p = @@ -133,7 +137,7 @@ Module::Module(const string& interfacePath, [push_back_a(cls.methods, method)] [assign_a(method,method0)]; - Rule staticMethodName_p = lexeme_d[upper_p >> *(alnum_p | '_')]; + Rule staticMethodName_p = lexeme_d[(upper_p | lower_p) >> *(alnum_p | '_')]; Rule static_method_p = (str_p("static") >> returnType_p >> staticMethodName_p[assign_a(static_method.name_)] >> diff --git a/wrap/ReturnValue.cpp b/wrap/ReturnValue.cpp index 7ffd3b372..005cfea40 100644 --- a/wrap/ReturnValue.cpp +++ b/wrap/ReturnValue.cpp @@ -25,10 +25,13 @@ string ReturnValue::return_type(bool add_ptr, pairing p) { /* ************************************************************************* */ void ReturnValue::wrap_result(std::ostream& ofs) { if (returns_pair_) { + // first return value in pair if (returns_ptr_) ofs << " out[0] = wrap_shared_ptr(result.first,\"" << returns_ << "\");\n"; else ofs << " out[0] = wrap< " << return_type(true,arg1) << " >(result.first);\n"; + + // second return value in pair if (returns_ptr2_) ofs << " out[1] = wrap_shared_ptr(result.second,\"" << returns2_ << "\");\n"; else @@ -36,6 +39,8 @@ void ReturnValue::wrap_result(std::ostream& ofs) { } else if (returns_ptr_) ofs << " out[0] = wrap_shared_ptr(result,\"" << returns_ << "\");\n"; + else if (returns_class_) + ofs << " out[0] = wrap_shared_ptr(make_shared< " << returns_ << " >(result),\"" << returns_ << "\");\n"; else if (returns_!="void") ofs << " out[0] = wrap< " << return_type(true,arg1) << " >(result);\n"; } diff --git a/wrap/ReturnValue.h b/wrap/ReturnValue.h index 02382aebb..68c0fb6da 100644 --- a/wrap/ReturnValue.h +++ b/wrap/ReturnValue.h @@ -16,12 +16,13 @@ namespace wrap { struct ReturnValue { ReturnValue(bool verbose = true) - : verbose_(verbose), returns_ptr_(false), returns_ptr2_(false), returns_pair_(false) + : verbose_(verbose), returns_ptr_(false), returns_ptr2_(false), + returns_pair_(false), returns_class_(false) {} bool verbose_; std::string returns_, returns2_; - bool returns_ptr_, returns_ptr2_, returns_pair_; + bool returns_ptr_, returns_ptr2_, returns_pair_, returns_class_, returns_class2_; typedef enum { arg1, arg2, pair diff --git a/wrap/StaticMethod.cpp b/wrap/StaticMethod.cpp index 196ba639f..40ab9bcb8 100644 --- a/wrap/StaticMethod.cpp +++ b/wrap/StaticMethod.cpp @@ -38,9 +38,9 @@ void StaticMethod::matlab_mfile(const string& toolboxPath, const string& classNa // generate code string returnType = returnVal_.matlab_returnType(); ofs << "function " << returnType << " = " << full_name << "("; - if (args_.size()) ofs << "," << args_.names(); + if (args_.size()) ofs << args_.names(); ofs << ")" << endl; - ofs << "% usage: obj." << full_name << "(" << args_.names() << ")" << endl; + ofs << "% usage: x = " << full_name << "(" << args_.names() << ")" << endl; ofs << " error('need to compile " << full_name << ".cpp');" << endl; ofs << "end" << endl; @@ -79,9 +79,9 @@ void StaticMethod::matlab_wrapper(const string& toolboxPath, // unwrap arguments, see Argument.cpp args_.matlab_unwrap(ofs,0); // We start at 0 because there is no self object - // call method - // example: bool result = Point2::return_field(t); ofs << " "; + + // call method with default type if (returnVal_.returns_!="void") ofs << returnVal_.return_type(true,ReturnValue::pair) << " result = "; ofs << className << "::" << name_ << "(" << args_.names() << ");\n"; diff --git a/wrap/geometry.h b/wrap/geometry.h index e19f9f3cf..f89b7f132 100644 --- a/wrap/geometry.h +++ b/wrap/geometry.h @@ -12,8 +12,9 @@ class Point3 { Point3(double x, double y, double z); double norm() const; - // Testing: static functions - use static keyword and uppercase - static double StaticFunction(); + // static functions - use static keyword and uppercase + static double staticFunction(); + static Point3 StaticFunctionRet(double z); }; // another comment diff --git a/wrap/matlab.h b/wrap/matlab.h index 31ee4dc80..add125cb5 100644 --- a/wrap/matlab.h +++ b/wrap/matlab.h @@ -27,6 +27,7 @@ extern "C" { } #include +#include #include #include diff --git a/wrap/tests/expected/@Point2/dim.cpp b/wrap/tests/expected/@Point2/dim.cpp index c2002446b..1d6486356 100644 --- a/wrap/tests/expected/@Point2/dim.cpp +++ b/wrap/tests/expected/@Point2/dim.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + shared_ptr self = unwrap_shared_ptr< Point2 >(in[0],"Point2"); int result = self->dim(); out[0] = wrap< int >(result); } diff --git a/wrap/tests/expected/@Point2/x.cpp b/wrap/tests/expected/@Point2/x.cpp index 8777b3a56..4c2ef7b33 100644 --- a/wrap/tests/expected/@Point2/x.cpp +++ b/wrap/tests/expected/@Point2/x.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + shared_ptr self = unwrap_shared_ptr< Point2 >(in[0],"Point2"); double result = self->x(); out[0] = wrap< double >(result); } diff --git a/wrap/tests/expected/@Point2/y.cpp b/wrap/tests/expected/@Point2/y.cpp index f2e39d92e..525238ea9 100644 --- a/wrap/tests/expected/@Point2/y.cpp +++ b/wrap/tests/expected/@Point2/y.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + shared_ptr self = unwrap_shared_ptr< Point2 >(in[0],"Point2"); double result = self->y(); out[0] = wrap< double >(result); } diff --git a/wrap/tests/expected/@Point3/norm.cpp b/wrap/tests/expected/@Point3/norm.cpp index 732f3f4c8..4c494a5f8 100644 --- a/wrap/tests/expected/@Point3/norm.cpp +++ b/wrap/tests/expected/@Point3/norm.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + shared_ptr self = unwrap_shared_ptr< Point3 >(in[0],"Point3"); double result = self->norm(); out[0] = wrap< double >(result); } diff --git a/wrap/tests/expected/@Test/create_ptrs.cpp b/wrap/tests/expected/@Test/create_ptrs.cpp index 76e5ce40c..c09be35c1 100644 --- a/wrap/tests/expected/@Test/create_ptrs.cpp +++ b/wrap/tests/expected/@Test/create_ptrs.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + 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/tests/expected/@Test/print.cpp b/wrap/tests/expected/@Test/print.cpp index 24c3a2258..0cdd5d5f1 100644 --- a/wrap/tests/expected/@Test/print.cpp +++ b/wrap/tests/expected/@Test/print.cpp @@ -1,9 +1,9 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); self->print(); } diff --git a/wrap/tests/expected/@Test/return_Point2Ptr.cpp b/wrap/tests/expected/@Test/return_Point2Ptr.cpp index 0d6c35fce..6079eb972 100644 --- a/wrap/tests/expected/@Test/return_Point2Ptr.cpp +++ b/wrap/tests/expected/@Test/return_Point2Ptr.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #include #include void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { checkArguments("return_Point2Ptr",nargout,nargin-1,1); - shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); + shared_ptr self = unwrap_shared_ptr< Test >(in[0],"Test"); bool value = unwrap< bool >(in[1]); shared_ptr result = self->return_Point2Ptr(value); out[0] = wrap_shared_ptr(result,"Point2"); diff --git a/wrap/tests/expected/@Test/return_TestPtr.cpp b/wrap/tests/expected/@Test/return_TestPtr.cpp index a9d4ef983..ae34da13b 100644 --- a/wrap/tests/expected/@Test/return_TestPtr.cpp +++ b/wrap/tests/expected/@Test/return_TestPtr.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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 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/tests/expected/@Test/return_bool.cpp b/wrap/tests/expected/@Test/return_bool.cpp index 3f0aaa8e4..5fd50cf3f 100644 --- a/wrap/tests/expected/@Test/return_bool.cpp +++ b/wrap/tests/expected/@Test/return_bool.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + 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/tests/expected/@Test/return_double.cpp b/wrap/tests/expected/@Test/return_double.cpp index 9fd1e0edb..ef1704b07 100644 --- a/wrap/tests/expected/@Test/return_double.cpp +++ b/wrap/tests/expected/@Test/return_double.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + 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/tests/expected/@Test/return_field.cpp b/wrap/tests/expected/@Test/return_field.cpp index 5a211da3a..593d4b5fe 100644 --- a/wrap/tests/expected/@Test/return_field.cpp +++ b/wrap/tests/expected/@Test/return_field.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + 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/tests/expected/@Test/return_int.cpp b/wrap/tests/expected/@Test/return_int.cpp index c349622d7..429ef73ce 100644 --- a/wrap/tests/expected/@Test/return_int.cpp +++ b/wrap/tests/expected/@Test/return_int.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + 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/tests/expected/@Test/return_matrix1.cpp b/wrap/tests/expected/@Test/return_matrix1.cpp index 1dfcb53f0..0f3966361 100644 --- a/wrap/tests/expected/@Test/return_matrix1.cpp +++ b/wrap/tests/expected/@Test/return_matrix1.cpp @@ -1,11 +1,11 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + 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); + out[0] = wrap_shared_ptr(make_shared< Matrix >(result),"Matrix"); } diff --git a/wrap/tests/expected/@Test/return_matrix2.cpp b/wrap/tests/expected/@Test/return_matrix2.cpp index 422642917..1c16e910e 100644 --- a/wrap/tests/expected/@Test/return_matrix2.cpp +++ b/wrap/tests/expected/@Test/return_matrix2.cpp @@ -1,11 +1,11 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + 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); + out[0] = wrap_shared_ptr(make_shared< Matrix >(result),"Matrix"); } diff --git a/wrap/tests/expected/@Test/return_pair.cpp b/wrap/tests/expected/@Test/return_pair.cpp index 0a9a8378a..7224f5150 100644 --- a/wrap/tests/expected/@Test/return_pair.cpp +++ b/wrap/tests/expected/@Test/return_pair.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + 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); diff --git a/wrap/tests/expected/@Test/return_ptrs.cpp b/wrap/tests/expected/@Test/return_ptrs.cpp index 556b5607c..59f8d8739 100644 --- a/wrap/tests/expected/@Test/return_ptrs.cpp +++ b/wrap/tests/expected/@Test/return_ptrs.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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 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); diff --git a/wrap/tests/expected/@Test/return_size_t.cpp b/wrap/tests/expected/@Test/return_size_t.cpp index e8358e1d0..887addc3f 100644 --- a/wrap/tests/expected/@Test/return_size_t.cpp +++ b/wrap/tests/expected/@Test/return_size_t.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + 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/tests/expected/@Test/return_string.cpp b/wrap/tests/expected/@Test/return_string.cpp index bd5eb9c22..9b6ee320f 100644 --- a/wrap/tests/expected/@Test/return_string.cpp +++ b/wrap/tests/expected/@Test/return_string.cpp @@ -1,10 +1,10 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + 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/tests/expected/@Test/return_vector1.cpp b/wrap/tests/expected/@Test/return_vector1.cpp index 0977c7de9..4614e660d 100644 --- a/wrap/tests/expected/@Test/return_vector1.cpp +++ b/wrap/tests/expected/@Test/return_vector1.cpp @@ -1,11 +1,11 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + 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); + out[0] = wrap_shared_ptr(make_shared< Vector >(result),"Vector"); } diff --git a/wrap/tests/expected/@Test/return_vector2.cpp b/wrap/tests/expected/@Test/return_vector2.cpp index af65b8434..6fa6f7863 100644 --- a/wrap/tests/expected/@Test/return_vector2.cpp +++ b/wrap/tests/expected/@Test/return_vector2.cpp @@ -1,11 +1,11 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #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"); + 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); + out[0] = wrap_shared_ptr(make_shared< Vector >(result),"Vector"); } diff --git a/wrap/tests/expected/Makefile b/wrap/tests/expected/Makefile index 940be4283..7249daaba 100644 --- a/wrap/tests/expected/Makefile +++ b/wrap/tests/expected/Makefile @@ -1,9 +1,11 @@ -# automatically generated by wrap on 2011-Dec-05 +# automatically generated by wrap on 2011-Dec-06 MEX = mex MEXENDING = mexa64 mex_flags = -O5 +all: Point2 Point3 Test + # Point2 new_Point2_.$(MEXENDING): new_Point2_.cpp $(MEX) $(mex_flags) new_Point2_.cpp -output new_Point2_ @@ -21,12 +23,14 @@ Point2: new_Point2_.$(MEXENDING) new_Point2_dd.$(MEXENDING) @Point2/x.$(MEXENDIN # Point3 new_Point3_ddd.$(MEXENDING): new_Point3_ddd.cpp $(MEX) $(mex_flags) new_Point3_ddd.cpp -output new_Point3_ddd -Point3_StaticFunction.$(MEXENDING): Point3_StaticFunction.cpp - $(MEX) $(mex_flags) Point3_StaticFunction.cpp -output Point3_StaticFunction +Point3_staticFunction.$(MEXENDING): Point3_staticFunction.cpp + $(MEX) $(mex_flags) Point3_staticFunction.cpp -output Point3_staticFunction +Point3_StaticFunctionRet.$(MEXENDING): Point3_StaticFunctionRet.cpp + $(MEX) $(mex_flags) Point3_StaticFunctionRet.cpp -output Point3_StaticFunctionRet @Point3/norm.$(MEXENDING): @Point3/norm.cpp $(MEX) $(mex_flags) @Point3/norm.cpp -output @Point3/norm -Point3: new_Point3_ddd.$(MEXENDING) Point3_StaticFunction.$(MEXENDING) @Point3/norm.$(MEXENDING) +Point3: new_Point3_ddd.$(MEXENDING) Point3_staticFunction.$(MEXENDING) Point3_StaticFunctionRet.$(MEXENDING) @Point3/norm.$(MEXENDING) # Test new_Test_.$(MEXENDING): new_Test_.cpp @@ -67,7 +71,6 @@ new_Test_.$(MEXENDING): new_Test_.cpp Test: new_Test_.$(MEXENDING) @Test/return_bool.$(MEXENDING) @Test/return_size_t.$(MEXENDING) @Test/return_int.$(MEXENDING) @Test/return_double.$(MEXENDING) @Test/return_string.$(MEXENDING) @Test/return_vector1.$(MEXENDING) @Test/return_matrix1.$(MEXENDING) @Test/return_vector2.$(MEXENDING) @Test/return_matrix2.$(MEXENDING) @Test/return_pair.$(MEXENDING) @Test/return_field.$(MEXENDING) @Test/return_TestPtr.$(MEXENDING) @Test/return_Point2Ptr.$(MEXENDING) @Test/create_ptrs.$(MEXENDING) @Test/return_ptrs.$(MEXENDING) @Test/print.$(MEXENDING) -all: Point2 Point3 Test clean: rm -rf *.$(MEXENDING) diff --git a/wrap/tests/expected/Point3_StaticFunction.m b/wrap/tests/expected/Point3_StaticFunction.m deleted file mode 100644 index cdb0d483d..000000000 --- a/wrap/tests/expected/Point3_StaticFunction.m +++ /dev/null @@ -1,4 +0,0 @@ -function result = Point3_StaticFunction(obj) -% usage: obj.Point3_StaticFunction() - error('need to compile Point3_StaticFunction.cpp'); -end diff --git a/wrap/tests/expected/Point3_StaticFunctionRet.cpp b/wrap/tests/expected/Point3_StaticFunctionRet.cpp new file mode 100644 index 000000000..1877b7e99 --- /dev/null +++ b/wrap/tests/expected/Point3_StaticFunctionRet.cpp @@ -0,0 +1,9 @@ +// automatically generated by wrap on 2011-Dec-06 +#include +#include +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + checkArguments("Point3_StaticFunctionRet",nargout,nargin,0); + Point3 result = Point3::StaticFunctionRet(); + out[0] = wrap_shared_ptr(make_shared< Point3 >(result),"Point3"); +} diff --git a/wrap/tests/expected/Point3_StaticFunctionRet.m b/wrap/tests/expected/Point3_StaticFunctionRet.m new file mode 100644 index 000000000..f2ba314f1 --- /dev/null +++ b/wrap/tests/expected/Point3_StaticFunctionRet.m @@ -0,0 +1,4 @@ +function result = Point3_StaticFunctionRet() +% usage: x = Point3_StaticFunctionRet() + error('need to compile Point3_StaticFunctionRet.cpp'); +end diff --git a/wrap/tests/expected/Point3_StaticFunction.cpp b/wrap/tests/expected/Point3_staticFunction.cpp similarity index 51% rename from wrap/tests/expected/Point3_StaticFunction.cpp rename to wrap/tests/expected/Point3_staticFunction.cpp index 7662b583b..869810709 100644 --- a/wrap/tests/expected/Point3_StaticFunction.cpp +++ b/wrap/tests/expected/Point3_staticFunction.cpp @@ -1,9 +1,9 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #include #include void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { - checkArguments("Point3_StaticFunction",nargout,nargin,0); - double result = Point3::StaticFunction(); + checkArguments("Point3_staticFunction",nargout,nargin,0); + double result = Point3::staticFunction(); out[0] = wrap< double >(result); } diff --git a/wrap/tests/expected/Point3_staticFunction.m b/wrap/tests/expected/Point3_staticFunction.m new file mode 100644 index 000000000..441bb5bc6 --- /dev/null +++ b/wrap/tests/expected/Point3_staticFunction.m @@ -0,0 +1,4 @@ +function result = Point3_staticFunction() +% usage: x = Point3_staticFunction() + error('need to compile Point3_staticFunction.cpp'); +end diff --git a/wrap/tests/expected/make_geometry.m b/wrap/tests/expected/make_geometry.m index 864dc60e5..732f40fc9 100644 --- a/wrap/tests/expected/make_geometry.m +++ b/wrap/tests/expected/make_geometry.m @@ -1,4 +1,4 @@ -% automatically generated by wrap on 2011-Dec-01 +% automatically generated by wrap on 2011-Dec-06 echo on toolboxpath = mfilename('fullpath'); @@ -20,7 +20,8 @@ mex -O5 dim.cpp %% Point3 cd(toolboxpath) mex -O5 new_Point3_ddd.cpp -mex -O5 Point3_StaticFunction.cpp +mex -O5 Point3_staticFunction.cpp +mex -O5 Point3_StaticFunctionRet.cpp cd @Point3 mex -O5 norm.cpp diff --git a/wrap/tests/expected/new_Point2_.cpp b/wrap/tests/expected/new_Point2_.cpp index da07147da..34ef89203 100644 --- a/wrap/tests/expected/new_Point2_.cpp +++ b/wrap/tests/expected/new_Point2_.cpp @@ -1,4 +1,4 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #include #include void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) diff --git a/wrap/tests/expected/new_Point2_.m b/wrap/tests/expected/new_Point2_.m index f6e31bbf2..dc02b426b 100644 --- a/wrap/tests/expected/new_Point2_.m +++ b/wrap/tests/expected/new_Point2_.m @@ -1,4 +1,4 @@ -% automatically generated by wrap on 2011-Dec-01 +% automatically generated by wrap on 2011-Dec-06 function result = new_Point2_(obj) error('need to compile new_Point2_.cpp'); end diff --git a/wrap/tests/expected/new_Point2_dd.cpp b/wrap/tests/expected/new_Point2_dd.cpp index e447c234e..61d4d1535 100644 --- a/wrap/tests/expected/new_Point2_dd.cpp +++ b/wrap/tests/expected/new_Point2_dd.cpp @@ -1,4 +1,4 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #include #include void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) diff --git a/wrap/tests/expected/new_Point2_dd.m b/wrap/tests/expected/new_Point2_dd.m index 19e3b3ebd..7d4bf7b86 100644 --- a/wrap/tests/expected/new_Point2_dd.m +++ b/wrap/tests/expected/new_Point2_dd.m @@ -1,4 +1,4 @@ -% automatically generated by wrap on 2011-Dec-01 +% automatically generated by wrap on 2011-Dec-06 function result = new_Point2_dd(obj,x,y) error('need to compile new_Point2_dd.cpp'); end diff --git a/wrap/tests/expected/new_Point3_ddd.cpp b/wrap/tests/expected/new_Point3_ddd.cpp index 3a572c26c..f9bed0d45 100644 --- a/wrap/tests/expected/new_Point3_ddd.cpp +++ b/wrap/tests/expected/new_Point3_ddd.cpp @@ -1,4 +1,4 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #include #include void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) diff --git a/wrap/tests/expected/new_Point3_ddd.m b/wrap/tests/expected/new_Point3_ddd.m index 890a93bf5..b3004b4bb 100644 --- a/wrap/tests/expected/new_Point3_ddd.m +++ b/wrap/tests/expected/new_Point3_ddd.m @@ -1,4 +1,4 @@ -% automatically generated by wrap on 2011-Dec-01 +% automatically generated by wrap on 2011-Dec-06 function result = new_Point3_ddd(obj,x,y,z) error('need to compile new_Point3_ddd.cpp'); end diff --git a/wrap/tests/expected/new_Test_.cpp b/wrap/tests/expected/new_Test_.cpp index 77b74027f..39898b03c 100644 --- a/wrap/tests/expected/new_Test_.cpp +++ b/wrap/tests/expected/new_Test_.cpp @@ -1,4 +1,4 @@ -// automatically generated by wrap on 2011-Dec-01 +// automatically generated by wrap on 2011-Dec-06 #include #include void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) diff --git a/wrap/tests/expected/new_Test_.m b/wrap/tests/expected/new_Test_.m index 023f8a451..9064b5f23 100644 --- a/wrap/tests/expected/new_Test_.m +++ b/wrap/tests/expected/new_Test_.m @@ -1,4 +1,4 @@ -% automatically generated by wrap on 2011-Dec-01 +% automatically generated by wrap on 2011-Dec-06 function result = new_Test_(obj) error('need to compile new_Test_.cpp'); end diff --git a/wrap/tests/testWrap.cpp b/wrap/tests/testWrap.cpp index e48ae34d7..2040254ed 100644 --- a/wrap/tests/testWrap.cpp +++ b/wrap/tests/testWrap.cpp @@ -29,7 +29,7 @@ static bool verbose = false; #ifdef TOPSRCDIR static string topdir = TOPSRCDIR; #else -static string topdir = "notarealdirectory"; // If TOPSRCDIR is not defined, we error +static string topdir = "TOPSRCDIR_NOT_CONFIGURED"; // If TOPSRCDIR is not defined, we error #endif /* ************************************************************************* */ @@ -62,7 +62,7 @@ TEST( wrap, parse ) { EXPECT(cls.name=="Point3"); EXPECT(cls.constructors.size()==1); EXPECT(cls.methods.size()==1); - EXPECT(cls.static_methods.size()==1); + EXPECT(cls.static_methods.size()==2); // first constructor takes 3 doubles Constructor c1 = cls.constructors.front(); @@ -91,15 +91,15 @@ TEST( wrap, matlab_code ) { // emit MATLAB code // make_geometry will not compile, use make testwrap to generate real make - module.matlab_code("mexa64", "actual", "", "-O5"); + module.matlab_code("actual", "", "mexa64", "-O5"); EXPECT(files_equal(path + "/tests/expected/@Point2/Point2.m" , "actual/@Point2/Point2.m" )); EXPECT(files_equal(path + "/tests/expected/@Point2/x.cpp" , "actual/@Point2/x.cpp" )); EXPECT(files_equal(path + "/tests/expected/@Point3/Point3.m" , "actual/@Point3/Point3.m" )); EXPECT(files_equal(path + "/tests/expected/new_Point3_ddd.m" , "actual/new_Point3_ddd.m" )); EXPECT(files_equal(path + "/tests/expected/new_Point3_ddd.cpp", "actual/new_Point3_ddd.cpp")); - EXPECT(files_equal(path + "/tests/expected/Point3_StaticFunction.m" , "actual/Point3_StaticFunction.m" )); - EXPECT(files_equal(path + "/tests/expected/Point3_StaticFunction.cpp", "actual/Point3_StaticFunction.cpp")); + EXPECT(files_equal(path + "/tests/expected/Point3_staticFunction.m" , "actual/Point3_staticFunction.m" )); + EXPECT(files_equal(path + "/tests/expected/Point3_staticFunction.cpp", "actual/Point3_staticFunction.cpp")); EXPECT(files_equal(path + "/tests/expected/@Point3/norm.m" , "actual/@Point3/norm.m" )); EXPECT(files_equal(path + "/tests/expected/@Point3/norm.cpp" , "actual/@Point3/norm.cpp" ));