1 #include <gtwrap/matlab.h> 4 #include <boost/archive/text_iarchive.hpp> 5 #include <boost/archive/text_oarchive.hpp> 6 #include <boost/serialization/export.hpp> 8 #include <folder/path/to/Test.h> 42 std::streambuf *outbuf = std::cout.rdbuf(&mout);
44 bool anyDeleted =
false;
101 "WARNING: Wrap modules with variables in the workspace have been reloaded due to\n" 102 "calling destructors, call 'clear all' again if you plan to now recompile a wrap\n" 103 "module, so that your recompiled module is used instead of the old one." << endl;
104 std::cout.rdbuf(outbuf);
108 const mxArray *alreadyCreated = mexGetVariablePtr(
"global",
"gtsam_class_rttiRegistry_created");
109 if(!alreadyCreated) {
110 std::map<std::string, std::string> types;
112 mxArray *registry = mexGetVariable(
"global",
"gtsamwrap_rttiRegistry");
114 registry = mxCreateStructMatrix(1, 1, 0,
NULL);
115 typedef std::pair<std::string, std::string> StringPair;
116 for(
const StringPair& rtti_matlab: types) {
117 int fieldId = mxAddField(registry, rtti_matlab.first.c_str());
119 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
120 mxArray *matlabName = mxCreateString(rtti_matlab.second.c_str());
121 mxSetFieldByNumber(registry, 0, fieldId, matlabName);
123 if(mexPutVariable(
"global",
"gtsamwrap_rttiRegistry", registry) != 0)
124 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
125 mxDestroyArray(registry);
127 mxArray *newAlreadyCreated = mxCreateNumericMatrix(0, 0, mxINT8_CLASS, mxREAL);
128 if(mexPutVariable(
"global",
"gtsam_geometry_rttiRegistry_created", newAlreadyCreated) != 0)
129 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
130 mxDestroyArray(newAlreadyCreated);
137 typedef boost::shared_ptr<FunRange> Shared;
139 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
146 typedef boost::shared_ptr<FunRange> Shared;
148 Shared *
self =
new Shared(
new FunRange());
151 *
reinterpret_cast<Shared**
> (mxGetData(out[0])) =
self;
156 typedef boost::shared_ptr<FunRange> Shared;
158 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
159 Collector_FunRange::iterator item;
170 auto obj = unwrap_shared_ptr<FunRange>(in[0],
"ptr_FunRange");
172 out[0] =
wrap_shared_ptr(boost::make_shared<FunRange>(obj->range(d)),
"FunRange",
false);
184 typedef boost::shared_ptr<Fun<double>> Shared;
186 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
192 typedef boost::shared_ptr<Fun<double>> Shared;
194 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
195 Collector_FunDouble::iterator item;
205 checkArguments(
"multiTemplatedMethodStringSize_t",nargout,nargin-1,3);
206 auto obj = unwrap_shared_ptr<Fun<double>>(in[0],
"ptr_FunDouble");
216 auto obj = unwrap_shared_ptr<Fun<double>>(in[0],
"ptr_FunDouble");
224 checkArguments(
"FunDouble.staticMethodWithThis",nargout,nargin,0);
231 typedef boost::shared_ptr<Test> Shared;
233 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
240 typedef boost::shared_ptr<Test> Shared;
242 Shared *
self =
new Shared(
new Test());
245 *
reinterpret_cast<Shared**
> (mxGetData(out[0])) =
self;
251 typedef boost::shared_ptr<Test> Shared;
254 Matrix b = unwrap< Matrix >(in[1]);
255 Shared *
self =
new Shared(
new Test(a,b));
258 *
reinterpret_cast<Shared**
> (mxGetData(out[0])) =
self;
263 typedef boost::shared_ptr<Test> Shared;
265 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
266 Collector_Test::iterator item;
277 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
279 obj->arg_EigenConstRef(value);
285 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
286 auto pairResult = obj->create_MixedPtrs();
287 out[0] =
wrap_shared_ptr(boost::make_shared<Test>(pairResult.first),
"Test",
false);
294 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
295 auto pairResult = obj->create_ptrs();
303 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
307 void Test_print_18(
int nargout, mxArray *out[],
int nargin,
const mxArray *in[])
310 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
317 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
320 boost::shared_ptr<Point2> shared(obj->return_Point2Ptr(value));
328 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
329 boost::shared_ptr<Test>
value = unwrap_shared_ptr< Test >(in[1],
"ptr_Test");
330 out[0] =
wrap_shared_ptr(boost::make_shared<Test>(obj->return_Test(value)),
"Test",
false);
336 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
337 boost::shared_ptr<Test>
value = unwrap_shared_ptr< Test >(in[1],
"ptr_Test");
344 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
352 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
360 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
361 Test&
t = *unwrap_shared_ptr< Test >(in[1],
"ptr_Test");
368 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
376 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
378 out[0] = wrap< Matrix >(obj->return_matrix1(value));
384 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
386 out[0] = wrap< Matrix >(obj->return_matrix2(value));
392 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
393 Vector v = unwrap< Vector >(in[1]);
394 Matrix A = unwrap< Matrix >(in[2]);
395 auto pairResult = obj->return_pair(v,A);
396 out[0] = wrap< Vector >(pairResult.first);
397 out[1] = wrap< Matrix >(pairResult.second);
403 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
404 Vector v = unwrap< Vector >(in[1]);
405 auto pairResult = obj->return_pair(v);
406 out[0] = wrap< Vector >(pairResult.first);
407 out[1] = wrap< Matrix >(pairResult.second);
413 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
414 boost::shared_ptr<Test>
p1 = unwrap_shared_ptr< Test >(in[1],
"ptr_Test");
415 boost::shared_ptr<Test>
p2 = unwrap_shared_ptr< Test >(in[2],
"ptr_Test");
416 auto pairResult = obj->return_ptrs(p1,p2);
424 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
432 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
440 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
442 out[0] = wrap< Vector >(obj->return_vector1(value));
448 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
450 out[0] = wrap< Vector >(obj->return_vector2(value));
456 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
457 boost::shared_ptr<std::vector<testing::Test>> container = unwrap_shared_ptr< std::vector<testing::Test> >(in[1],
"ptr_stdvectorTest");
458 obj->set_container(*container);
464 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
465 boost::shared_ptr<std::vector<testing::Test>> container = unwrap_shared_ptr< std::vector<testing::Test> >(in[1],
"ptr_stdvectorTest");
466 obj->set_container(*container);
472 auto obj = unwrap_shared_ptr<Test>(in[0],
"ptr_Test");
473 boost::shared_ptr<std::vector<testing::Test>> container = unwrap_shared_ptr< std::vector<testing::Test> >(in[1],
"ptr_stdvectorTest");
474 obj->set_container(*container);
480 typedef boost::shared_ptr<PrimitiveRef<double>> Shared;
482 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
489 typedef boost::shared_ptr<PrimitiveRef<double>> Shared;
491 Shared *
self =
new Shared(
new PrimitiveRef<double>());
494 *
reinterpret_cast<Shared**
> (mxGetData(out[0])) =
self;
499 typedef boost::shared_ptr<PrimitiveRef<double>> Shared;
501 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
502 Collector_PrimitiveRefDouble::iterator item;
520 typedef boost::shared_ptr<MyVector<3>> Shared;
522 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
529 typedef boost::shared_ptr<MyVector<3>> Shared;
531 Shared *
self =
new Shared(
new MyVector<3>());
534 *
reinterpret_cast<Shared**
> (mxGetData(out[0])) =
self;
539 typedef boost::shared_ptr<MyVector<3>> Shared;
541 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
542 Collector_MyVector3::iterator item;
553 typedef boost::shared_ptr<MyVector<12>> Shared;
555 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
562 typedef boost::shared_ptr<MyVector<12>> Shared;
564 Shared *
self =
new Shared(
new MyVector<12>());
567 *
reinterpret_cast<Shared**
> (mxGetData(out[0])) =
self;
572 typedef boost::shared_ptr<MyVector<12>> Shared;
574 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
575 Collector_MyVector12::iterator item;
586 typedef boost::shared_ptr<MultipleTemplates<int, double>> Shared;
588 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
594 typedef boost::shared_ptr<MultipleTemplates<int, double>> Shared;
595 checkArguments(
"delete_MultipleTemplatesIntDouble",nargout,nargin,1);
596 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
597 Collector_MultipleTemplatesIntDouble::iterator item;
608 typedef boost::shared_ptr<MultipleTemplates<int, float>> Shared;
610 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
616 typedef boost::shared_ptr<MultipleTemplates<int, float>> Shared;
617 checkArguments(
"delete_MultipleTemplatesIntFloat",nargout,nargin,1);
618 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
619 Collector_MultipleTemplatesIntFloat::iterator item;
630 typedef boost::shared_ptr<MyFactor<gtsam::Pose2, gtsam::Matrix>> Shared;
632 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
639 typedef boost::shared_ptr<MyFactor<gtsam::Pose2, gtsam::Matrix>> Shared;
644 boost::shared_ptr<gtsam::noiseModel::Base> noiseModel = unwrap_shared_ptr< gtsam::noiseModel::Base >(in[3],
"ptr_gtsamnoiseModelBase");
648 *
reinterpret_cast<Shared**
> (mxGetData(out[0])) =
self;
653 typedef boost::shared_ptr<MyFactor<gtsam::Pose2, gtsam::Matrix>> Shared;
655 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
656 Collector_MyFactorPosePoint2::iterator item;
667 auto obj = unwrap_shared_ptr<MyFactor<gtsam::Pose2, gtsam::Matrix>>(in[0],
"ptr_MyFactorPosePoint2");
668 string&
s = *unwrap_shared_ptr< string >(in[1],
"ptr_string");
669 gtsam::KeyFormatter& keyFormatter = *unwrap_shared_ptr< gtsam::KeyFormatter >(in[2],
"ptr_gtsamKeyFormatter");
670 obj->print(s,keyFormatter);
674 void mexFunction(
int nargout, mxArray *out[],
int nargin,
const mxArray *in[])
677 std::streambuf *outbuf = std::cout.rdbuf(&mout);
854 }
catch(
const std::exception&
e) {
855 mexErrMsgTxt((
"Exception from gtsam:\n" + std::string(e.what()) +
"\n").c_str());
858 std::cout.rdbuf(outbuf);
int unwrap< int >(const mxArray *array)
void Test_return_matrix1_26(int nargout, mxArray *out[], int nargin, const mxArray *in[])
gtsam::enable_if_t< needs_eigen_aligned_allocator< T >::value, boost::shared_ptr< T > > make_shared(Args &&...args)
std::set< boost::shared_ptr< Test > * > Collector_Test
PrimitiveRef< double > PrimitiveRefDouble
void MultipleTemplatesIntFloat_collectorInsertAndMakeBase_50(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_return_pair_29(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_constructor_12(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_print_18(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MyVector3_constructor_43(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void PrimitiveRefDouble_Brutal_41(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void FunRange_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_get_container_17(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MyFactorPosePoint2_collectorInsertAndMakeBase_52(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void PrimitiveRefDouble_constructor_39(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void checkArguments(const string &name, int nargout, int nargin, int expected)
void Test_return_ptrs_30(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_FunDouble collector_FunDouble
void Test_set_container_36(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void FunDouble_collectorInsertAndMakeBase_5(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void PrimitiveRefDouble_collectorInsertAndMakeBase_38(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void _class_RTTIRegister()
void MyFactorPosePoint2_constructor_53(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_MultipleTemplatesIntFloat collector_MultipleTemplatesIntFloat
string unwrap< string >(const mxArray *array)
iterator iter(handle obj)
size_t unwrap< size_t >(const mxArray *array)
void FunRange_constructor_1(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< boost::shared_ptr< MyVector12 > * > Collector_MyVector12
mxArray * wrap_shared_ptr(boost::shared_ptr< Class > shared_ptr, const std::string &matlabName, bool isVirtual)
GeneralSFMFactor< SfmCamera, Point3 > MyFactor
std::set< boost::shared_ptr< MultipleTemplatesIntDouble > * > Collector_MultipleTemplatesIntDouble
MultipleTemplates< int, float > MultipleTemplatesIntFloat
void MyFactorPosePoint2_print_55(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_return_TestPtr_21(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_collectorInsertAndMakeBase_10(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_PrimitiveRefDouble collector_PrimitiveRefDouble
void Test_return_field_24(int nargout, mxArray *out[], int nargin, const mxArray *in[])
mxArray * wrap< size_t >(const size_t &value)
void FunDouble_templatedMethod_8(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MyVector12_deconstructor_47(int nargout, mxArray *out[], int nargin, const mxArray *in[])
const Symbol key1('v', 1)
static Collector_Test collector_Test
void Test_return_vector1_33(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_FunRange collector_FunRange
void FunDouble_staticMethodWithThis_9(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void FunRange_range_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MultipleTemplatesIntDouble_collectorInsertAndMakeBase_48(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< boost::shared_ptr< MultipleTemplatesIntFloat > * > Collector_MultipleTemplatesIntFloat
void MultipleTemplatesIntFloat_deconstructor_51(int nargout, mxArray *out[], int nargin, const mxArray *in[])
double unwrap< double >(const mxArray *array)
std::set< boost::shared_ptr< MyFactorPosePoint2 > * > Collector_MyFactorPosePoint2
static Collector_MyVector3 collector_MyVector3
MyFactor< gtsam::Pose2, gtsam::Matrix > MyFactorPosePoint2
void PrimitiveRefDouble_deconstructor_40(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_return_pair_28(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_create_ptrs_16(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MyFactorPosePoint2_deconstructor_54(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void FunRange_create_4(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
std::set< boost::shared_ptr< FunDouble > * > Collector_FunDouble
void MyVector3_deconstructor_44(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Array< double, 1, 3 > e(1./3., 0.5, 2.)
std::set< boost::shared_ptr< PrimitiveRefDouble > * > Collector_PrimitiveRefDouble
void MyVector3_collectorInsertAndMakeBase_42(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_arg_EigenConstRef_14(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_return_double_23(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MultipleTemplatesIntDouble_deconstructor_49(int nargout, mxArray *out[], int nargin, const mxArray *in[])
mxArray * wrap< int >(const int &value)
void Test_return_string_32(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_return_matrix2_27(int nargout, mxArray *out[], int nargin, const mxArray *in[])
mxArray * wrap< double >(const double &value)
void Test_return_size_t_31(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_return_bool_22(int nargout, mxArray *out[], int nargin, const mxArray *in[])
MyVector< 12 > MyVector12
std::set< boost::shared_ptr< MyVector3 > * > Collector_MyVector3
#define mxUINT32OR64_CLASS
void FunDouble_multiTemplatedMethod_7(int nargout, mxArray *out[], int nargin, const mxArray *in[])
ADT create(const Signature &signature)
void Test_return_Point2Ptr_19(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< boost::shared_ptr< FunRange > * > Collector_FunRange
const Symbol key2('v', 2)
mxArray * wrap< string >(const string &value)
void FunDouble_deconstructor_6(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_deconstructor_13(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MyVector12_constructor_46(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Matrix
MultipleTemplates< int, double > MultipleTemplatesIntDouble
void Test_return_int_25(int nargout, mxArray *out[], int nargin, const mxArray *in[])
mxArray * wrap< bool >(const bool &value)
void Test_create_MixedPtrs_15(int nargout, mxArray *out[], int nargin, const mxArray *in[])
bool unwrap< bool >(const mxArray *array)
void Test_return_vector2_34(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_constructor_11(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
void MyVector12_collectorInsertAndMakeBase_45(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_set_container_35(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void FunRange_deconstructor_2(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void Test_set_container_37(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_MyVector12 collector_MyVector12
void Test_return_Test_20(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_MultipleTemplatesIntDouble collector_MultipleTemplatesIntDouble
static Collector_MyFactorPosePoint2 collector_MyFactorPosePoint2