From 15b3dd9d5fbdd1e7b193564b1cdebcbcf0771f18 Mon Sep 17 00:00:00 2001 From: Andrew Melim Date: Mon, 2 Jul 2012 19:09:50 +0000 Subject: [PATCH] adding new constructors for matlab wrap tests --- wrap/tests/expected/new_Point2.cpp | 39 ++++++++++++++++++ wrap/tests/expected/new_Point2.m | 4 ++ wrap/tests/expected/new_Point3.cpp | 39 ++++++++++++++++++ wrap/tests/expected/new_Point3.m | 4 ++ wrap/tests/expected/new_Test.cpp | 40 +++++++++++++++++++ wrap/tests/expected/new_Test.m | 4 ++ wrap/tests/expected_namespaces/new_ClassD.cpp | 34 ++++++++++++++++ wrap/tests/expected_namespaces/new_ClassD.m | 4 ++ .../expected_namespaces/new_ns1ClassA.cpp | 34 ++++++++++++++++ .../tests/expected_namespaces/new_ns1ClassA.m | 4 ++ .../expected_namespaces/new_ns1ClassB.cpp | 35 ++++++++++++++++ .../tests/expected_namespaces/new_ns1ClassB.m | 4 ++ .../expected_namespaces/new_ns2ClassA.cpp | 35 ++++++++++++++++ .../tests/expected_namespaces/new_ns2ClassA.m | 4 ++ .../expected_namespaces/new_ns2ClassC.cpp | 34 ++++++++++++++++ .../tests/expected_namespaces/new_ns2ClassC.m | 4 ++ .../expected_namespaces/new_ns2ns3ClassB.cpp | 35 ++++++++++++++++ .../expected_namespaces/new_ns2ns3ClassB.m | 4 ++ 18 files changed, 361 insertions(+) create mode 100644 wrap/tests/expected/new_Point2.cpp create mode 100644 wrap/tests/expected/new_Point2.m create mode 100644 wrap/tests/expected/new_Point3.cpp create mode 100644 wrap/tests/expected/new_Point3.m create mode 100644 wrap/tests/expected/new_Test.cpp create mode 100644 wrap/tests/expected/new_Test.m create mode 100644 wrap/tests/expected_namespaces/new_ClassD.cpp create mode 100644 wrap/tests/expected_namespaces/new_ClassD.m create mode 100644 wrap/tests/expected_namespaces/new_ns1ClassA.cpp create mode 100644 wrap/tests/expected_namespaces/new_ns1ClassA.m create mode 100644 wrap/tests/expected_namespaces/new_ns1ClassB.cpp create mode 100644 wrap/tests/expected_namespaces/new_ns1ClassB.m create mode 100644 wrap/tests/expected_namespaces/new_ns2ClassA.cpp create mode 100644 wrap/tests/expected_namespaces/new_ns2ClassA.m create mode 100644 wrap/tests/expected_namespaces/new_ns2ClassC.cpp create mode 100644 wrap/tests/expected_namespaces/new_ns2ClassC.m create mode 100644 wrap/tests/expected_namespaces/new_ns2ns3ClassB.cpp create mode 100644 wrap/tests/expected_namespaces/new_ns2ns3ClassB.m diff --git a/wrap/tests/expected/new_Point2.cpp b/wrap/tests/expected/new_Point2.cpp new file mode 100644 index 000000000..30a707f88 --- /dev/null +++ b/wrap/tests/expected/new_Point2.cpp @@ -0,0 +1,39 @@ +// automatically generated by wrap +#include +#include +typedef boost::shared_ptr Shared; + +static std::set collector; + +void cleanup(void) { + BOOST_FOREACH(Shared* p, collector) + collector.erase(p); +} +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + mexAtExit(cleanup); + + const mxArray* input = in[0]; + Shared* self = *(Shared**) mxGetData(input); + + if(self) { + if(nargin > 1) { + collector.insert(self); + } + else if(collector.erase(self)) + delete self; + } else { + int nc = unwrap(in[1]); + + if(nc == 0) + self = new Shared(new Point2()); + if(nc == 1) { + double x = unwrap< double >(in[2]); + double y = unwrap< double >(in[3]); + self = new Shared(new Point2(x,y)); + } + collector.insert(self); + out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); + *reinterpret_cast (mxGetPr(out[0])) = self; + } +} diff --git a/wrap/tests/expected/new_Point2.m b/wrap/tests/expected/new_Point2.m new file mode 100644 index 000000000..9a6edd425 --- /dev/null +++ b/wrap/tests/expected/new_Point2.m @@ -0,0 +1,4 @@ +% automatically generated by wrap +function result = new_Point2(obj,x,y) + error('need to compile new_Point2.cpp'); +end diff --git a/wrap/tests/expected/new_Point3.cpp b/wrap/tests/expected/new_Point3.cpp new file mode 100644 index 000000000..c3d758266 --- /dev/null +++ b/wrap/tests/expected/new_Point3.cpp @@ -0,0 +1,39 @@ +// automatically generated by wrap +#include +#include +using namespace geometry; +typedef boost::shared_ptr Shared; + +static std::set collector; + +void cleanup(void) { + BOOST_FOREACH(Shared* p, collector) + collector.erase(p); +} +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + mexAtExit(cleanup); + + const mxArray* input = in[0]; + Shared* self = *(Shared**) mxGetData(input); + + if(self) { + if(nargin > 1) { + collector.insert(self); + } + else if(collector.erase(self)) + delete self; + } else { + int nc = unwrap(in[1]); + + if(nc == 0) { + double x = unwrap< double >(in[2]); + double y = unwrap< double >(in[3]); + double z = unwrap< double >(in[4]); + self = new Shared(new Point3(x,y,z)); + } + collector.insert(self); + out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); + *reinterpret_cast (mxGetPr(out[0])) = self; + } +} diff --git a/wrap/tests/expected/new_Point3.m b/wrap/tests/expected/new_Point3.m new file mode 100644 index 000000000..9cca5daa5 --- /dev/null +++ b/wrap/tests/expected/new_Point3.m @@ -0,0 +1,4 @@ +% automatically generated by wrap +function result = new_Point3(obj,x,y,z) + error('need to compile new_Point3.cpp'); +end diff --git a/wrap/tests/expected/new_Test.cpp b/wrap/tests/expected/new_Test.cpp new file mode 100644 index 000000000..050d179d3 --- /dev/null +++ b/wrap/tests/expected/new_Test.cpp @@ -0,0 +1,40 @@ +// automatically generated by wrap +#include +#include +using namespace geometry; +typedef boost::shared_ptr Shared; + +static std::set collector; + +void cleanup(void) { + BOOST_FOREACH(Shared* p, collector) + collector.erase(p); +} +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + mexAtExit(cleanup); + + const mxArray* input = in[0]; + Shared* self = *(Shared**) mxGetData(input); + + if(self) { + if(nargin > 1) { + collector.insert(self); + } + else if(collector.erase(self)) + delete self; + } else { + int nc = unwrap(in[1]); + + if(nc == 0) + self = new Shared(new Test()); + if(nc == 1) { + double a = unwrap< double >(in[2]); + Matrix b = unwrap< Matrix >(in[3]); + self = new Shared(new Test(a,b)); + } + collector.insert(self); + out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); + *reinterpret_cast (mxGetPr(out[0])) = self; + } +} diff --git a/wrap/tests/expected/new_Test.m b/wrap/tests/expected/new_Test.m new file mode 100644 index 000000000..ec9a13f63 --- /dev/null +++ b/wrap/tests/expected/new_Test.m @@ -0,0 +1,4 @@ +% automatically generated by wrap +function result = new_Test(obj,a,b) + error('need to compile new_Test.cpp'); +end diff --git a/wrap/tests/expected_namespaces/new_ClassD.cpp b/wrap/tests/expected_namespaces/new_ClassD.cpp new file mode 100644 index 000000000..13bbe9d5e --- /dev/null +++ b/wrap/tests/expected_namespaces/new_ClassD.cpp @@ -0,0 +1,34 @@ +// automatically generated by wrap +#include +#include +typedef boost::shared_ptr Shared; + +static std::set collector; + +void cleanup(void) { + BOOST_FOREACH(Shared* p, collector) + collector.erase(p); +} +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + mexAtExit(cleanup); + + const mxArray* input = in[0]; + Shared* self = *(Shared**) mxGetData(input); + + if(self) { + if(nargin > 1) { + collector.insert(self); + } + else if(collector.erase(self)) + delete self; + } else { + int nc = unwrap(in[1]); + + if(nc == 0) + self = new Shared(new ClassD()); + collector.insert(self); + out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); + *reinterpret_cast (mxGetPr(out[0])) = self; + } +} diff --git a/wrap/tests/expected_namespaces/new_ClassD.m b/wrap/tests/expected_namespaces/new_ClassD.m new file mode 100644 index 000000000..d12bfffb1 --- /dev/null +++ b/wrap/tests/expected_namespaces/new_ClassD.m @@ -0,0 +1,4 @@ +% automatically generated by wrap +function result = new_ClassD(obj) + error('need to compile new_ClassD.cpp'); +end diff --git a/wrap/tests/expected_namespaces/new_ns1ClassA.cpp b/wrap/tests/expected_namespaces/new_ns1ClassA.cpp new file mode 100644 index 000000000..fc60abe6d --- /dev/null +++ b/wrap/tests/expected_namespaces/new_ns1ClassA.cpp @@ -0,0 +1,34 @@ +// automatically generated by wrap +#include +#include +typedef boost::shared_ptr Shared; + +static std::set collector; + +void cleanup(void) { + BOOST_FOREACH(Shared* p, collector) + collector.erase(p); +} +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + mexAtExit(cleanup); + + const mxArray* input = in[0]; + Shared* self = *(Shared**) mxGetData(input); + + if(self) { + if(nargin > 1) { + collector.insert(self); + } + else if(collector.erase(self)) + delete self; + } else { + int nc = unwrap(in[1]); + + if(nc == 0) + self = new Shared(new ns1::ClassA()); + collector.insert(self); + out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); + *reinterpret_cast (mxGetPr(out[0])) = self; + } +} diff --git a/wrap/tests/expected_namespaces/new_ns1ClassA.m b/wrap/tests/expected_namespaces/new_ns1ClassA.m new file mode 100644 index 000000000..4412baae1 --- /dev/null +++ b/wrap/tests/expected_namespaces/new_ns1ClassA.m @@ -0,0 +1,4 @@ +% automatically generated by wrap +function result = new_ns1ClassA(obj) + error('need to compile new_ns1ClassA.cpp'); +end diff --git a/wrap/tests/expected_namespaces/new_ns1ClassB.cpp b/wrap/tests/expected_namespaces/new_ns1ClassB.cpp new file mode 100644 index 000000000..419453968 --- /dev/null +++ b/wrap/tests/expected_namespaces/new_ns1ClassB.cpp @@ -0,0 +1,35 @@ +// automatically generated by wrap +#include +#include +#include +typedef boost::shared_ptr Shared; + +static std::set collector; + +void cleanup(void) { + BOOST_FOREACH(Shared* p, collector) + collector.erase(p); +} +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + mexAtExit(cleanup); + + const mxArray* input = in[0]; + Shared* self = *(Shared**) mxGetData(input); + + if(self) { + if(nargin > 1) { + collector.insert(self); + } + else if(collector.erase(self)) + delete self; + } else { + int nc = unwrap(in[1]); + + if(nc == 0) + self = new Shared(new ns1::ClassB()); + collector.insert(self); + out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); + *reinterpret_cast (mxGetPr(out[0])) = self; + } +} diff --git a/wrap/tests/expected_namespaces/new_ns1ClassB.m b/wrap/tests/expected_namespaces/new_ns1ClassB.m new file mode 100644 index 000000000..b75d6b9bf --- /dev/null +++ b/wrap/tests/expected_namespaces/new_ns1ClassB.m @@ -0,0 +1,4 @@ +% automatically generated by wrap +function result = new_ns1ClassB(obj) + error('need to compile new_ns1ClassB.cpp'); +end diff --git a/wrap/tests/expected_namespaces/new_ns2ClassA.cpp b/wrap/tests/expected_namespaces/new_ns2ClassA.cpp new file mode 100644 index 000000000..31e3385d5 --- /dev/null +++ b/wrap/tests/expected_namespaces/new_ns2ClassA.cpp @@ -0,0 +1,35 @@ +// automatically generated by wrap +#include +#include +#include +typedef boost::shared_ptr Shared; + +static std::set collector; + +void cleanup(void) { + BOOST_FOREACH(Shared* p, collector) + collector.erase(p); +} +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + mexAtExit(cleanup); + + const mxArray* input = in[0]; + Shared* self = *(Shared**) mxGetData(input); + + if(self) { + if(nargin > 1) { + collector.insert(self); + } + else if(collector.erase(self)) + delete self; + } else { + int nc = unwrap(in[1]); + + if(nc == 0) + self = new Shared(new ns2::ClassA()); + collector.insert(self); + out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); + *reinterpret_cast (mxGetPr(out[0])) = self; + } +} diff --git a/wrap/tests/expected_namespaces/new_ns2ClassA.m b/wrap/tests/expected_namespaces/new_ns2ClassA.m new file mode 100644 index 000000000..b3b9201d6 --- /dev/null +++ b/wrap/tests/expected_namespaces/new_ns2ClassA.m @@ -0,0 +1,4 @@ +% automatically generated by wrap +function result = new_ns2ClassA(obj) + error('need to compile new_ns2ClassA.cpp'); +end diff --git a/wrap/tests/expected_namespaces/new_ns2ClassC.cpp b/wrap/tests/expected_namespaces/new_ns2ClassC.cpp new file mode 100644 index 000000000..c0446109a --- /dev/null +++ b/wrap/tests/expected_namespaces/new_ns2ClassC.cpp @@ -0,0 +1,34 @@ +// automatically generated by wrap +#include +#include +typedef boost::shared_ptr Shared; + +static std::set collector; + +void cleanup(void) { + BOOST_FOREACH(Shared* p, collector) + collector.erase(p); +} +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + mexAtExit(cleanup); + + const mxArray* input = in[0]; + Shared* self = *(Shared**) mxGetData(input); + + if(self) { + if(nargin > 1) { + collector.insert(self); + } + else if(collector.erase(self)) + delete self; + } else { + int nc = unwrap(in[1]); + + if(nc == 0) + self = new Shared(new ns2::ClassC()); + collector.insert(self); + out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); + *reinterpret_cast (mxGetPr(out[0])) = self; + } +} diff --git a/wrap/tests/expected_namespaces/new_ns2ClassC.m b/wrap/tests/expected_namespaces/new_ns2ClassC.m new file mode 100644 index 000000000..0f7ffb26f --- /dev/null +++ b/wrap/tests/expected_namespaces/new_ns2ClassC.m @@ -0,0 +1,4 @@ +% automatically generated by wrap +function result = new_ns2ClassC(obj) + error('need to compile new_ns2ClassC.cpp'); +end diff --git a/wrap/tests/expected_namespaces/new_ns2ns3ClassB.cpp b/wrap/tests/expected_namespaces/new_ns2ns3ClassB.cpp new file mode 100644 index 000000000..a952790b5 --- /dev/null +++ b/wrap/tests/expected_namespaces/new_ns2ns3ClassB.cpp @@ -0,0 +1,35 @@ +// automatically generated by wrap +#include +#include +#include +typedef boost::shared_ptr Shared; + +static std::set collector; + +void cleanup(void) { + BOOST_FOREACH(Shared* p, collector) + collector.erase(p); +} +void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) +{ + mexAtExit(cleanup); + + const mxArray* input = in[0]; + Shared* self = *(Shared**) mxGetData(input); + + if(self) { + if(nargin > 1) { + collector.insert(self); + } + else if(collector.erase(self)) + delete self; + } else { + int nc = unwrap(in[1]); + + if(nc == 0) + self = new Shared(new ns2::ns3::ClassB()); + collector.insert(self); + out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); + *reinterpret_cast (mxGetPr(out[0])) = self; + } +} diff --git a/wrap/tests/expected_namespaces/new_ns2ns3ClassB.m b/wrap/tests/expected_namespaces/new_ns2ns3ClassB.m new file mode 100644 index 000000000..707e159f0 --- /dev/null +++ b/wrap/tests/expected_namespaces/new_ns2ns3ClassB.m @@ -0,0 +1,4 @@ +% automatically generated by wrap +function result = new_ns2ns3ClassB(obj) + error('need to compile new_ns2ns3ClassB.cpp'); +end