1 #include <gtwrap/matlab.h> 19 std::streambuf *outbuf = std::cout.rdbuf(&mout);
21 bool anyDeleted =
false;
43 "WARNING: Wrap modules with variables in the workspace have been reloaded due to\n" 44 "calling destructors, call 'clear all' again if you plan to now recompile a wrap\n" 45 "module, so that your recompiled module is used instead of the old one." << endl;
46 std::cout.rdbuf(outbuf);
50 const mxArray *alreadyCreated = mexGetVariablePtr(
"global",
"gtsam_multiple_files_rttiRegistry_created");
52 std::map<std::string, std::string> types;
56 mxArray *registry = mexGetVariable(
"global",
"gtsamwrap_rttiRegistry");
58 registry = mxCreateStructMatrix(1, 1, 0,
NULL);
59 typedef std::pair<std::string, std::string> StringPair;
60 for(
const StringPair& rtti_matlab: types) {
61 int fieldId = mxAddField(registry, rtti_matlab.first.c_str());
63 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
65 mxArray *matlabName = mxCreateString(rtti_matlab.second.c_str());
66 mxSetFieldByNumber(registry, 0, fieldId, matlabName);
68 if(mexPutVariable(
"global",
"gtsamwrap_rttiRegistry", registry) != 0) {
69 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
71 mxDestroyArray(registry);
73 mxArray *newAlreadyCreated = mxCreateNumericMatrix(0, 0, mxINT8_CLASS, mxREAL);
74 if(mexPutVariable(
"global",
"gtsam_multiple_files_rttiRegistry_created", newAlreadyCreated) != 0) {
75 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
77 mxDestroyArray(newAlreadyCreated);
84 typedef std::shared_ptr<gtsam::Class1> Shared;
86 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
93 typedef std::shared_ptr<gtsam::Class1> Shared;
95 Shared *
self =
new Shared(
new gtsam::Class1());
98 *
reinterpret_cast<Shared**
> (mxGetData(out[0])) =
self;
103 typedef std::shared_ptr<gtsam::Class1> Shared;
105 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
106 Collector_gtsamClass1::iterator item;
117 typedef std::shared_ptr<gtsam::Class2> Shared;
119 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
126 typedef std::shared_ptr<gtsam::Class2> Shared;
128 Shared *
self =
new Shared(
new gtsam::Class2());
131 *
reinterpret_cast<Shared**
> (mxGetData(out[0])) =
self;
136 typedef std::shared_ptr<gtsam::Class2> Shared;
138 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
139 Collector_gtsamClass2::iterator item;
150 typedef std::shared_ptr<gtsam::ClassA> Shared;
152 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
159 typedef std::shared_ptr<gtsam::ClassA> Shared;
161 Shared *
self =
new Shared(
new gtsam::ClassA());
164 *
reinterpret_cast<Shared**
> (mxGetData(out[0])) =
self;
169 typedef std::shared_ptr<gtsam::ClassA> Shared;
171 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
172 Collector_gtsamClassA::iterator item;
184 std::streambuf *outbuf = std::cout.rdbuf(&mout);
220 }
catch(
const std::exception&
e) {
221 mexErrMsgTxt((
"Exception from gtsam:\n" + std::string(e.what()) +
"\n").c_str());
224 std::cout.rdbuf(outbuf);
int unwrap< int >(const mxArray *array)
void gtsamClass2_collectorInsertAndMakeBase_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< std::shared_ptr< gtsam::Class1 > * > Collector_gtsamClass1
void gtsamClass1_constructor_1(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::ofstream out("Result.txt")
void checkArguments(const string &name, int nargout, int nargin, int expected)
static Collector_gtsamClassA collector_gtsamClassA
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
iterator iter(handle obj)
static Collector_gtsamClass2 collector_gtsamClass2
void gtsamClassA_deconstructor_8(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamClass2_constructor_4(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< std::shared_ptr< gtsam::Class2 > * > Collector_gtsamClass2
void _multiple_files_RTTIRegister()
void gtsamClass2_deconstructor_5(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamClassA_constructor_7(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Array< double, 1, 3 > e(1./3., 0.5, 2.)
void gtsamClass1_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamClassA_collectorInsertAndMakeBase_6(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< std::shared_ptr< gtsam::ClassA > * > Collector_gtsamClassA
#define mxUINT32OR64_CLASS
static Collector_gtsamClass1 collector_gtsamClass1
void gtsamClass1_deconstructor_2(int nargout, mxArray *out[], int nargin, const mxArray *in[])