adding new constructors for matlab wrap tests

release/4.3a0
Andrew Melim 2012-07-02 19:09:50 +00:00
parent ead88ae35a
commit 15b3dd9d5f
18 changed files with 361 additions and 0 deletions

View File

@ -0,0 +1,39 @@
// automatically generated by wrap
#include <wrap/matlab.h>
#include <Point2.h>
typedef boost::shared_ptr<Point2> Shared;
static std::set<Shared*> 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<int>(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<Shared**> (mxGetPr(out[0])) = self;
}
}

View File

@ -0,0 +1,4 @@
% automatically generated by wrap
function result = new_Point2(obj,x,y)
error('need to compile new_Point2.cpp');
end

View File

@ -0,0 +1,39 @@
// automatically generated by wrap
#include <wrap/matlab.h>
#include <Point3.h>
using namespace geometry;
typedef boost::shared_ptr<Point3> Shared;
static std::set<Shared*> 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<int>(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<Shared**> (mxGetPr(out[0])) = self;
}
}

View File

@ -0,0 +1,4 @@
% automatically generated by wrap
function result = new_Point3(obj,x,y,z)
error('need to compile new_Point3.cpp');
end

View File

@ -0,0 +1,40 @@
// automatically generated by wrap
#include <wrap/matlab.h>
#include <folder/path/to/Test.h>
using namespace geometry;
typedef boost::shared_ptr<Test> Shared;
static std::set<Shared*> 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<int>(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<Shared**> (mxGetPr(out[0])) = self;
}
}

View File

@ -0,0 +1,4 @@
% automatically generated by wrap
function result = new_Test(obj,a,b)
error('need to compile new_Test.cpp');
end

View File

@ -0,0 +1,34 @@
// automatically generated by wrap
#include <wrap/matlab.h>
#include <ClassD.h>
typedef boost::shared_ptr<ClassD> Shared;
static std::set<Shared*> 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<int>(in[1]);
if(nc == 0)
self = new Shared(new ClassD());
collector.insert(self);
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
*reinterpret_cast<Shared**> (mxGetPr(out[0])) = self;
}
}

View File

@ -0,0 +1,4 @@
% automatically generated by wrap
function result = new_ClassD(obj)
error('need to compile new_ClassD.cpp');
end

View File

@ -0,0 +1,34 @@
// automatically generated by wrap
#include <wrap/matlab.h>
#include <path/to/ns1.h>
typedef boost::shared_ptr<ns1::ClassA> Shared;
static std::set<Shared*> 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<int>(in[1]);
if(nc == 0)
self = new Shared(new ns1::ClassA());
collector.insert(self);
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
*reinterpret_cast<Shared**> (mxGetPr(out[0])) = self;
}
}

View File

@ -0,0 +1,4 @@
% automatically generated by wrap
function result = new_ns1ClassA(obj)
error('need to compile new_ns1ClassA.cpp');
end

View File

@ -0,0 +1,35 @@
// automatically generated by wrap
#include <wrap/matlab.h>
#include <path/to/ns1.h>
#include <path/to/ns1/ClassB.h>
typedef boost::shared_ptr<ns1::ClassB> Shared;
static std::set<Shared*> 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<int>(in[1]);
if(nc == 0)
self = new Shared(new ns1::ClassB());
collector.insert(self);
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
*reinterpret_cast<Shared**> (mxGetPr(out[0])) = self;
}
}

View File

@ -0,0 +1,4 @@
% automatically generated by wrap
function result = new_ns1ClassB(obj)
error('need to compile new_ns1ClassB.cpp');
end

View File

@ -0,0 +1,35 @@
// automatically generated by wrap
#include <wrap/matlab.h>
#include <path/to/ns2.h>
#include <path/to/ns2/ClassA.h>
typedef boost::shared_ptr<ns2::ClassA> Shared;
static std::set<Shared*> 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<int>(in[1]);
if(nc == 0)
self = new Shared(new ns2::ClassA());
collector.insert(self);
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
*reinterpret_cast<Shared**> (mxGetPr(out[0])) = self;
}
}

View File

@ -0,0 +1,4 @@
% automatically generated by wrap
function result = new_ns2ClassA(obj)
error('need to compile new_ns2ClassA.cpp');
end

View File

@ -0,0 +1,34 @@
// automatically generated by wrap
#include <wrap/matlab.h>
#include <path/to/ns2.h>
typedef boost::shared_ptr<ns2::ClassC> Shared;
static std::set<Shared*> 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<int>(in[1]);
if(nc == 0)
self = new Shared(new ns2::ClassC());
collector.insert(self);
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
*reinterpret_cast<Shared**> (mxGetPr(out[0])) = self;
}
}

View File

@ -0,0 +1,4 @@
% automatically generated by wrap
function result = new_ns2ClassC(obj)
error('need to compile new_ns2ClassC.cpp');
end

View File

@ -0,0 +1,35 @@
// automatically generated by wrap
#include <wrap/matlab.h>
#include <path/to/ns2.h>
#include <path/to/ns3.h>
typedef boost::shared_ptr<ns2::ns3::ClassB> Shared;
static std::set<Shared*> 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<int>(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<Shared**> (mxGetPr(out[0])) = self;
}
}

View File

@ -0,0 +1,4 @@
% automatically generated by wrap
function result = new_ns2ns3ClassB(obj)
error('need to compile new_ns2ns3ClassB.cpp');
end