Go to the documentation of this file. 1 #include <gtwrap/matlab.h>
5 #include <path/to/ns1.h>
6 #include <path/to/ns1/ClassB.h>
7 #include <path/to/ns2.h>
8 #include <path/to/ns2/ClassA.h>
9 #include <path/to/ns3.h>
32 std::streambuf *outbuf = std::cout.rdbuf(&mout);
34 bool anyDeleted =
false;
80 "WARNING: Wrap modules with variables in the workspace have been reloaded due to\n"
81 "calling destructors, call 'clear all' again if you plan to now recompile a wrap\n"
82 "module, so that your recompiled module is used instead of the old one." << endl;
83 std::cout.rdbuf(outbuf);
87 const mxArray *alreadyCreated = mexGetVariablePtr(
"global",
"gtsam_namespaces_rttiRegistry_created");
89 std::map<std::string, std::string> types;
93 mxArray *registry = mexGetVariable(
"global",
"gtsamwrap_rttiRegistry");
95 registry = mxCreateStructMatrix(1, 1, 0,
NULL);
96 typedef std::pair<std::string, std::string> StringPair;
97 for(
const StringPair& rtti_matlab: types) {
98 int fieldId = mxAddField(registry, rtti_matlab.first.c_str());
100 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
102 mxArray *matlabName = mxCreateString(rtti_matlab.second.c_str());
103 mxSetFieldByNumber(registry, 0, fieldId, matlabName);
105 if(mexPutVariable(
"global",
"gtsamwrap_rttiRegistry", registry) != 0) {
106 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
108 mxDestroyArray(registry);
110 mxArray *newAlreadyCreated = mxCreateNumericMatrix(0, 0, mxINT8_CLASS, mxREAL);
111 if(mexPutVariable(
"global",
"gtsam_namespaces_rttiRegistry_created", newAlreadyCreated) != 0) {
112 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
114 mxDestroyArray(newAlreadyCreated);
121 typedef std::shared_ptr<ns1::ClassA> Shared;
123 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
130 typedef std::shared_ptr<ns1::ClassA> Shared;
132 Shared *
self =
new Shared(
new ns1::ClassA());
135 *
reinterpret_cast<Shared**
> (mxGetData(
out[0])) =
self;
140 typedef std::shared_ptr<ns1::ClassA> Shared;
142 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
143 Collector_ns1ClassA::iterator item;
154 typedef std::shared_ptr<ns1::ClassB> Shared;
156 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
163 typedef std::shared_ptr<ns1::ClassB> Shared;
165 Shared *
self =
new Shared(
new ns1::ClassB());
168 *
reinterpret_cast<Shared**
> (mxGetData(
out[0])) =
self;
173 typedef std::shared_ptr<ns1::ClassB> Shared;
175 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
176 Collector_ns1ClassB::iterator item;
187 out[0] = wrap< Vector >(ns1::aGlobalFunction());
192 typedef std::shared_ptr<ns2::ClassA> Shared;
194 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
201 typedef std::shared_ptr<ns2::ClassA> Shared;
203 Shared *
self =
new Shared(
new ns2::ClassA());
206 *
reinterpret_cast<Shared**
> (mxGetData(
out[0])) =
self;
211 typedef std::shared_ptr<ns2::ClassA> Shared;
213 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
214 Collector_ns2ClassA::iterator item;
225 auto obj = unwrap_shared_ptr<ns2::ClassA>(in[0],
"ptr_ns2ClassA");
232 auto obj = unwrap_shared_ptr<ns2::ClassA>(in[0],
"ptr_ns2ClassA");
233 ns1::ClassB&
arg = *unwrap_shared_ptr< ns1::ClassB >(in[1],
"ptr_ns1ClassB");
240 auto obj = unwrap_shared_ptr<ns2::ClassA>(in[0],
"ptr_ns2ClassA");
242 out[0] =
wrap_shared_ptr(std::make_shared<ns2::ns3::ClassB>(obj->nsReturn(
q)),
"ns2.ns3.ClassB",
false);
254 typedef std::shared_ptr<ns2::ns3::ClassB> Shared;
256 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
263 typedef std::shared_ptr<ns2::ns3::ClassB> Shared;
265 Shared *
self =
new Shared(
new ns2::ns3::ClassB());
268 *
reinterpret_cast<Shared**
> (mxGetData(
out[0])) =
self;
273 typedef std::shared_ptr<ns2::ns3::ClassB> Shared;
275 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
276 Collector_ns2ns3ClassB::iterator item;
287 typedef std::shared_ptr<ns2::ClassC> Shared;
289 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
296 typedef std::shared_ptr<ns2::ClassC> Shared;
298 Shared *
self =
new Shared(
new ns2::ClassC());
301 *
reinterpret_cast<Shared**
> (mxGetData(
out[0])) =
self;
306 typedef std::shared_ptr<ns2::ClassC> Shared;
308 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
309 Collector_ns2ClassC::iterator item;
320 out[0] = wrap< Vector >(ns2::aGlobalFunction());
325 ns1::ClassA&
a = *unwrap_shared_ptr< ns1::ClassA >(in[0],
"ptr_ns1ClassA");
326 out[0] =
wrap_shared_ptr(std::make_shared<ns1::ClassA>(ns2::overloadedGlobalFunction(
a)),
"ns1.ClassA",
false);
331 ns1::ClassA&
a = *unwrap_shared_ptr< ns1::ClassA >(in[0],
"ptr_ns1ClassA");
333 out[0] =
wrap_shared_ptr(std::make_shared<ns1::ClassA>(ns2::overloadedGlobalFunction(
a,
b)),
"ns1.ClassA",
false);
338 typedef std::shared_ptr<ClassD> Shared;
340 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
347 typedef std::shared_ptr<ClassD> Shared;
349 Shared *
self =
new Shared(
new ClassD());
352 *
reinterpret_cast<Shared**
> (mxGetData(
out[0])) =
self;
357 typedef std::shared_ptr<ClassD> Shared;
359 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
360 Collector_ClassD::iterator item;
371 typedef std::shared_ptr<gtsam::Values> Shared;
373 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
380 typedef std::shared_ptr<gtsam::Values> Shared;
385 *
reinterpret_cast<Shared**
> (mxGetData(
out[0])) =
self;
391 typedef std::shared_ptr<gtsam::Values> Shared;
397 *
reinterpret_cast<Shared**
> (mxGetData(
out[0])) =
self;
402 typedef std::shared_ptr<gtsam::Values> Shared;
404 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
405 Collector_gtsamValues::iterator item;
416 auto obj = unwrap_shared_ptr<gtsam::Values>(in[0],
"ptr_gtsamValues");
418 Vector vector = unwrap< Vector >(in[2]);
419 obj->insert(
j,vector);
425 auto obj = unwrap_shared_ptr<gtsam::Values>(in[0],
"ptr_gtsamValues");
435 std::streambuf *outbuf = std::cout.rdbuf(&mout);
540 }
catch(
const std::exception&
e) {
541 mexErrMsgTxt((
"Exception from gtsam:\n" + std::string(
e.what()) +
"\n").c_str());
544 std::cout.rdbuf(outbuf);
Array< double, 1, 3 > e(1./3., 0.5, 2.)
std::set< std::shared_ptr< ns2::ClassC > * > Collector_ns2ClassC
std::set< std::shared_ptr< ns2::ns3::ClassB > * > Collector_ns2ns3ClassB
static Collector_ClassD collector_ClassD
static Collector_ns2ns3ClassB collector_ns2ns3ClassB
mxArray * wrap< double >(const double &value)
void ns1ClassB_constructor_4(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void ns1ClassB_collectorInsertAndMakeBase_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void ClassD_collectorInsertAndMakeBase_23(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void ns2ClassA_collectorInsertAndMakeBase_7(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void _namespaces_RTTIRegister()
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void ns2ClassC_collectorInsertAndMakeBase_17(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_ns1ClassA collector_ns1ClassA
#define mxUINT32OR64_CLASS
void ns2ClassA_deconstructor_9(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void ns2ns3ClassB_deconstructor_16(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Matrix
void gtsamValues_deconstructor_29(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< std::shared_ptr< ns1::ClassB > * > Collector_ns1ClassB
void checkArguments(const string &name, int nargout, int nargin, int expected)
size_t unwrap< size_t >(const mxArray *array)
EIGEN_DEVICE_FUNC const Scalar & q
int unwrap< int >(const mxArray *array)
void ns1ClassA_deconstructor_2(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void ns2ClassA_constructor_8(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void ClassD_deconstructor_25(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_ns2ClassC collector_ns2ClassC
mxArray * wrap_shared_ptr(std::shared_ptr< Class > shared_ptr, const std::string &matlabName, bool isVirtual)
void ns2ns3ClassB_collectorInsertAndMakeBase_14(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void ns1ClassA_constructor_1(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamValues_collectorInsertAndMakeBase_26(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_gtsamValues collector_gtsamValues
void ns2ClassC_constructor_18(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void ns2ClassA_nsArg_11(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< std::shared_ptr< ns2::ClassA > * > Collector_ns2ClassA
void gtsamValues_constructor_28(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamValues_insert_30(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void ns2ClassA_afunction_13(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::ofstream out("Result.txt")
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
void aGlobalFunction_20(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void ns2ClassA_nsReturn_12(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void ns1ClassA_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamValues_constructor_27(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamValues_insert_31(int nargout, mxArray *out[], int nargin, const mxArray *in[])
iterator iter(handle obj)
static Collector_ns2ClassA collector_ns2ClassA
void ns2ClassA_memberFunction_10(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_ns1ClassB collector_ns1ClassB
void overloadedGlobalFunction_21(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void ns1ClassB_deconstructor_5(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< std::shared_ptr< ClassD > * > Collector_ClassD
void overloadedGlobalFunction_22(int nargout, mxArray *out[], int nargin, const mxArray *in[])
double unwrap< double >(const mxArray *array)
std::set< std::shared_ptr< ns1::ClassA > * > Collector_ns1ClassA
mxArray * wrap< int >(const int &value)
void ClassD_constructor_24(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
std::set< std::shared_ptr< gtsam::Values > * > Collector_gtsamValues
void ns2ns3ClassB_constructor_15(int nargout, mxArray *out[], int nargin, const mxArray *in[])
A non-templated config holding any types of Manifold-group elements.
void ns2ClassC_deconstructor_19(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void aGlobalFunction_6(int nargout, mxArray *out[], int nargin, const mxArray *in[])
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:33:49