inheritance_wrapper.cpp
Go to the documentation of this file.
1 #include <gtwrap/matlab.h>
2 #include <map>
3 
4 #include <boost/archive/text_iarchive.hpp>
5 #include <boost/archive/text_oarchive.hpp>
6 #include <boost/serialization/export.hpp>
7 
8 #include <folder/path/to/Test.h>
10 #include <gtsam/geometry/Point3.h>
11 
12 typedef Fun<double> FunDouble;
13 typedef PrimitiveRef<double> PrimitiveRefDouble;
14 typedef MyVector<3> MyVector3;
15 typedef MyVector<12> MyVector12;
16 typedef MultipleTemplates<int, double> MultipleTemplatesIntDouble;
17 typedef MultipleTemplates<int, float> MultipleTemplatesIntFloat;
19 typedef MyTemplate<gtsam::Point2> MyTemplatePoint2;
20 typedef MyTemplate<gtsam::Matrix> MyTemplateMatrix;
21 
24 
25 typedef std::set<boost::shared_ptr<FunRange>*> Collector_FunRange;
27 typedef std::set<boost::shared_ptr<FunDouble>*> Collector_FunDouble;
29 typedef std::set<boost::shared_ptr<Test>*> Collector_Test;
31 typedef std::set<boost::shared_ptr<PrimitiveRefDouble>*> Collector_PrimitiveRefDouble;
33 typedef std::set<boost::shared_ptr<MyVector3>*> Collector_MyVector3;
35 typedef std::set<boost::shared_ptr<MyVector12>*> Collector_MyVector12;
37 typedef std::set<boost::shared_ptr<MultipleTemplatesIntDouble>*> Collector_MultipleTemplatesIntDouble;
39 typedef std::set<boost::shared_ptr<MultipleTemplatesIntFloat>*> Collector_MultipleTemplatesIntFloat;
41 typedef std::set<boost::shared_ptr<MyFactorPosePoint2>*> Collector_MyFactorPosePoint2;
43 typedef std::set<boost::shared_ptr<gtsam::Point2>*> Collector_gtsamPoint2;
45 typedef std::set<boost::shared_ptr<gtsam::Point3>*> Collector_gtsamPoint3;
47 typedef std::set<boost::shared_ptr<MyBase>*> Collector_MyBase;
49 typedef std::set<boost::shared_ptr<MyTemplatePoint2>*> Collector_MyTemplatePoint2;
51 typedef std::set<boost::shared_ptr<MyTemplateMatrix>*> Collector_MyTemplateMatrix;
53 typedef std::set<boost::shared_ptr<ForwardKinematicsFactor>*> Collector_ForwardKinematicsFactor;
55 
57 {
58  mstream mout;
59  std::streambuf *outbuf = std::cout.rdbuf(&mout);
60 
61  bool anyDeleted = false;
62  { for(Collector_FunRange::iterator iter = collector_FunRange.begin();
63  iter != collector_FunRange.end(); ) {
64  delete *iter;
65  collector_FunRange.erase(iter++);
66  anyDeleted = true;
67  } }
68  { for(Collector_FunDouble::iterator iter = collector_FunDouble.begin();
69  iter != collector_FunDouble.end(); ) {
70  delete *iter;
71  collector_FunDouble.erase(iter++);
72  anyDeleted = true;
73  } }
74  { for(Collector_Test::iterator iter = collector_Test.begin();
75  iter != collector_Test.end(); ) {
76  delete *iter;
77  collector_Test.erase(iter++);
78  anyDeleted = true;
79  } }
80  { for(Collector_PrimitiveRefDouble::iterator iter = collector_PrimitiveRefDouble.begin();
82  delete *iter;
84  anyDeleted = true;
85  } }
86  { for(Collector_MyVector3::iterator iter = collector_MyVector3.begin();
87  iter != collector_MyVector3.end(); ) {
88  delete *iter;
89  collector_MyVector3.erase(iter++);
90  anyDeleted = true;
91  } }
92  { for(Collector_MyVector12::iterator iter = collector_MyVector12.begin();
93  iter != collector_MyVector12.end(); ) {
94  delete *iter;
95  collector_MyVector12.erase(iter++);
96  anyDeleted = true;
97  } }
98  { for(Collector_MultipleTemplatesIntDouble::iterator iter = collector_MultipleTemplatesIntDouble.begin();
100  delete *iter;
102  anyDeleted = true;
103  } }
104  { for(Collector_MultipleTemplatesIntFloat::iterator iter = collector_MultipleTemplatesIntFloat.begin();
106  delete *iter;
108  anyDeleted = true;
109  } }
110  { for(Collector_MyFactorPosePoint2::iterator iter = collector_MyFactorPosePoint2.begin();
111  iter != collector_MyFactorPosePoint2.end(); ) {
112  delete *iter;
114  anyDeleted = true;
115  } }
116  { for(Collector_gtsamPoint2::iterator iter = collector_gtsamPoint2.begin();
117  iter != collector_gtsamPoint2.end(); ) {
118  delete *iter;
119  collector_gtsamPoint2.erase(iter++);
120  anyDeleted = true;
121  } }
122  { for(Collector_gtsamPoint3::iterator iter = collector_gtsamPoint3.begin();
123  iter != collector_gtsamPoint3.end(); ) {
124  delete *iter;
125  collector_gtsamPoint3.erase(iter++);
126  anyDeleted = true;
127  } }
128  { for(Collector_MyBase::iterator iter = collector_MyBase.begin();
129  iter != collector_MyBase.end(); ) {
130  delete *iter;
131  collector_MyBase.erase(iter++);
132  anyDeleted = true;
133  } }
134  { for(Collector_MyTemplatePoint2::iterator iter = collector_MyTemplatePoint2.begin();
135  iter != collector_MyTemplatePoint2.end(); ) {
136  delete *iter;
138  anyDeleted = true;
139  } }
140  { for(Collector_MyTemplateMatrix::iterator iter = collector_MyTemplateMatrix.begin();
141  iter != collector_MyTemplateMatrix.end(); ) {
142  delete *iter;
144  anyDeleted = true;
145  } }
146  { for(Collector_ForwardKinematicsFactor::iterator iter = collector_ForwardKinematicsFactor.begin();
148  delete *iter;
150  anyDeleted = true;
151  } }
152  if(anyDeleted)
153  cout <<
154  "WARNING: Wrap modules with variables in the workspace have been reloaded due to\n"
155  "calling destructors, call 'clear all' again if you plan to now recompile a wrap\n"
156  "module, so that your recompiled module is used instead of the old one." << endl;
157  std::cout.rdbuf(outbuf);
158 }
159 
161  const mxArray *alreadyCreated = mexGetVariablePtr("global", "gtsam_inheritance_rttiRegistry_created");
162  if(!alreadyCreated) {
163  std::map<std::string, std::string> types;
164  types.insert(std::make_pair(typeid(MyBase).name(), "MyBase"));
165  types.insert(std::make_pair(typeid(MyTemplatePoint2).name(), "MyTemplatePoint2"));
166  types.insert(std::make_pair(typeid(MyTemplateMatrix).name(), "MyTemplateMatrix"));
167  types.insert(std::make_pair(typeid(ForwardKinematicsFactor).name(), "ForwardKinematicsFactor"));
168 
169  mxArray *registry = mexGetVariable("global", "gtsamwrap_rttiRegistry");
170  if(!registry)
171  registry = mxCreateStructMatrix(1, 1, 0, NULL);
172  typedef std::pair<std::string, std::string> StringPair;
173  for(const StringPair& rtti_matlab: types) {
174  int fieldId = mxAddField(registry, rtti_matlab.first.c_str());
175  if(fieldId < 0)
176  mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
177  mxArray *matlabName = mxCreateString(rtti_matlab.second.c_str());
178  mxSetFieldByNumber(registry, 0, fieldId, matlabName);
179  }
180  if(mexPutVariable("global", "gtsamwrap_rttiRegistry", registry) != 0)
181  mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
182  mxDestroyArray(registry);
183 
184  mxArray *newAlreadyCreated = mxCreateNumericMatrix(0, 0, mxINT8_CLASS, mxREAL);
185  if(mexPutVariable("global", "gtsam_geometry_rttiRegistry_created", newAlreadyCreated) != 0)
186  mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
187  mxDestroyArray(newAlreadyCreated);
188  }
189 }
190 
191 void gtsamPoint2_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
192 {
193  mexAtExit(&_deleteAllObjects);
194  typedef boost::shared_ptr<gtsam::Point2> Shared;
195 
196  Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
197  collector_gtsamPoint2.insert(self);
198 }
199 
200 void MyBase_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
201 {
202  mexAtExit(&_deleteAllObjects);
203  typedef boost::shared_ptr<MyBase> Shared;
204 
205  Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
206  collector_MyBase.insert(self);
207 }
208 
209 void MyBase_deconstructor_2(int nargout, mxArray *out[], int nargin, const mxArray *in[])
210 {
211  typedef boost::shared_ptr<MyBase> Shared;
212  checkArguments("delete_MyBase",nargout,nargin,1);
213  Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
214  Collector_MyBase::iterator item;
215  item = collector_MyBase.find(self);
216  if(item != collector_MyBase.end()) {
217  delete self;
218  collector_MyBase.erase(item);
219  }
220 }
221 
222 void gtsamPoint2_deconstructor_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
223 {
224  typedef boost::shared_ptr<gtsam::Point2> Shared;
225  checkArguments("delete_gtsamPoint2",nargout,nargin,1);
226  Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
227  Collector_gtsamPoint2::iterator item;
228  item = collector_gtsamPoint2.find(self);
229  if(item != collector_gtsamPoint2.end()) {
230  delete self;
231  collector_gtsamPoint2.erase(item);
232  }
233 }
234 
235 void MyTemplatePoint2_collectorInsertAndMakeBase_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
236 {
237  mexAtExit(&_deleteAllObjects);
238  typedef boost::shared_ptr<MyTemplate<gtsam::Point2>> Shared;
239 
240  Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
241  collector_MyTemplatePoint2.insert(self);
242 
243  typedef boost::shared_ptr<MyBase> SharedBase;
244  out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
245  *reinterpret_cast<SharedBase**>(mxGetData(out[0])) = new SharedBase(*self);
246 }
247 
248 void MyTemplatePoint2_constructor_5(int nargout, mxArray *out[], int nargin, const mxArray *in[])
249 {
250  mexAtExit(&_deleteAllObjects);
251  typedef boost::shared_ptr<MyTemplate<gtsam::Point2>> Shared;
252 
253  Shared *self = new Shared(new MyTemplate<gtsam::Point2>());
254  collector_MyTemplatePoint2.insert(self);
255  out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
256  *reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
257 
258  typedef boost::shared_ptr<MyBase> SharedBase;
259  out[1] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
260  *reinterpret_cast<SharedBase**>(mxGetData(out[1])) = new SharedBase(*self);
261 }
262 
263 void MyTemplatePoint2_deconstructor_6(int nargout, mxArray *out[], int nargin, const mxArray *in[])
264 {
265  typedef boost::shared_ptr<MyTemplate<gtsam::Point2>> Shared;
266  checkArguments("delete_MyTemplatePoint2",nargout,nargin,1);
267  Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
268  Collector_MyTemplatePoint2::iterator item;
269  item = collector_MyTemplatePoint2.find(self);
270  if(item != collector_MyTemplatePoint2.end()) {
271  delete self;
272  collector_MyTemplatePoint2.erase(item);
273  }
274 }
275 
276 void MyTemplatePoint2_accept_T_7(int nargout, mxArray *out[], int nargin, const mxArray *in[])
277 {
278  checkArguments("accept_T",nargout,nargin-1,1);
279  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
280  Point2 value = unwrap< Point2 >(in[1]);
281  obj->accept_T(value);
282 }
283 
284 void MyTemplatePoint2_accept_Tptr_8(int nargout, mxArray *out[], int nargin, const mxArray *in[])
285 {
286  checkArguments("accept_Tptr",nargout,nargin-1,1);
287  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
288  Point2 value = unwrap< Point2 >(in[1]);
289  obj->accept_Tptr(value);
290 }
291 
292 void MyTemplatePoint2_create_MixedPtrs_9(int nargout, mxArray *out[], int nargin, const mxArray *in[])
293 {
294  checkArguments("create_MixedPtrs",nargout,nargin-1,0);
295  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
296  auto pairResult = obj->create_MixedPtrs();
297  out[0] = wrap< Point2 >(pairResult.first);
298  {
299  boost::shared_ptr<Point2> shared(pairResult.second);
300  out[1] = wrap_shared_ptr(shared,"Point2");
301  }
302 }
303 
304 void MyTemplatePoint2_create_ptrs_10(int nargout, mxArray *out[], int nargin, const mxArray *in[])
305 {
306  checkArguments("create_ptrs",nargout,nargin-1,0);
307  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
308  auto pairResult = obj->create_ptrs();
309  {
310  boost::shared_ptr<Point2> shared(pairResult.first);
311  out[0] = wrap_shared_ptr(shared,"Point2");
312  }
313  {
314  boost::shared_ptr<Point2> shared(pairResult.second);
315  out[1] = wrap_shared_ptr(shared,"Point2");
316  }
317 }
318 
319 void MyTemplatePoint2_return_T_11(int nargout, mxArray *out[], int nargin, const mxArray *in[])
320 {
321  checkArguments("return_T",nargout,nargin-1,1);
322  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
323  Point2 value = unwrap< Point2 >(in[1]);
324  out[0] = wrap< Point2 >(obj->return_T(value));
325 }
326 
327 void MyTemplatePoint2_return_Tptr_12(int nargout, mxArray *out[], int nargin, const mxArray *in[])
328 {
329  checkArguments("return_Tptr",nargout,nargin-1,1);
330  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
331  Point2 value = unwrap< Point2 >(in[1]);
332  {
333  boost::shared_ptr<Point2> shared(obj->return_Tptr(value));
334  out[0] = wrap_shared_ptr(shared,"Point2");
335  }
336 }
337 
338 void MyTemplatePoint2_return_ptrs_13(int nargout, mxArray *out[], int nargin, const mxArray *in[])
339 {
340  checkArguments("return_ptrs",nargout,nargin-1,2);
341  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
342  Point2 p1 = unwrap< Point2 >(in[1]);
343  Point2 p2 = unwrap< Point2 >(in[2]);
344  auto pairResult = obj->return_ptrs(p1,p2);
345  {
346  boost::shared_ptr<Point2> shared(pairResult.first);
347  out[0] = wrap_shared_ptr(shared,"Point2");
348  }
349  {
350  boost::shared_ptr<Point2> shared(pairResult.second);
351  out[1] = wrap_shared_ptr(shared,"Point2");
352  }
353 }
354 
355 void MyTemplatePoint2_templatedMethod_14(int nargout, mxArray *out[], int nargin, const mxArray *in[])
356 {
357  checkArguments("templatedMethodMatrix",nargout,nargin-1,1);
358  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
359  Matrix t = unwrap< Matrix >(in[1]);
360  out[0] = wrap< Matrix >(obj->templatedMethod<gtsam::Matrix>(t));
361 }
362 
363 void MyTemplatePoint2_templatedMethod_15(int nargout, mxArray *out[], int nargin, const mxArray *in[])
364 {
365  checkArguments("templatedMethodPoint2",nargout,nargin-1,1);
366  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
367  Point2 t = unwrap< Point2 >(in[1]);
368  out[0] = wrap< Point2 >(obj->templatedMethod<gtsam::Point2>(t));
369 }
370 
371 void MyTemplatePoint2_templatedMethod_16(int nargout, mxArray *out[], int nargin, const mxArray *in[])
372 {
373  checkArguments("templatedMethodPoint3",nargout,nargin-1,1);
374  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
375  Point3 t = unwrap< Point3 >(in[1]);
376  out[0] = wrap< Point3 >(obj->templatedMethod<gtsam::Point3>(t));
377 }
378 
379 void MyTemplatePoint2_templatedMethod_17(int nargout, mxArray *out[], int nargin, const mxArray *in[])
380 {
381  checkArguments("templatedMethodVector",nargout,nargin-1,1);
382  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
383  Vector t = unwrap< Vector >(in[1]);
384  out[0] = wrap< Vector >(obj->templatedMethod<gtsam::Vector>(t));
385 }
386 
387 void MyTemplatePoint2_Level_18(int nargout, mxArray *out[], int nargin, const mxArray *in[])
388 {
389  checkArguments("MyTemplatePoint2.Level",nargout,nargin,1);
390  Point2 K = unwrap< Point2 >(in[0]);
391  out[0] = wrap_shared_ptr(boost::make_shared<MyTemplate<Point2>>(MyTemplate<gtsam::Point2>::Level(K)),"MyTemplatePoint2", false);
392 }
393 
394 void gtsamPoint3_constructor_19(int nargout, mxArray *out[], int nargin, const mxArray *in[])
395 {
396  mexAtExit(&_deleteAllObjects);
397  typedef boost::shared_ptr<gtsam::Point3> Shared;
398 
399  double x = unwrap< double >(in[0]);
400  double y = unwrap< double >(in[1]);
401  double z = unwrap< double >(in[2]);
402  Shared *self = new Shared(new gtsam::Point3(x,y,z));
403  collector_gtsamPoint3.insert(self);
404  out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
405  *reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
406 }
407 
408 void MyTemplateMatrix_collectorInsertAndMakeBase_19(int nargout, mxArray *out[], int nargin, const mxArray *in[])
409 {
410  mexAtExit(&_deleteAllObjects);
411  typedef boost::shared_ptr<MyTemplate<gtsam::Matrix>> Shared;
412 
413  Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
414  collector_MyTemplateMatrix.insert(self);
415 
416  typedef boost::shared_ptr<MyBase> SharedBase;
417  out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
418  *reinterpret_cast<SharedBase**>(mxGetData(out[0])) = new SharedBase(*self);
419 }
420 
421 void MyTemplateMatrix_constructor_21(int nargout, mxArray *out[], int nargin, const mxArray *in[])
422 {
423  mexAtExit(&_deleteAllObjects);
424  typedef boost::shared_ptr<MyTemplate<gtsam::Matrix>> Shared;
425 
426  Shared *self = new Shared(new MyTemplate<gtsam::Matrix>());
427  collector_MyTemplateMatrix.insert(self);
428  out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
429  *reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
430 
431  typedef boost::shared_ptr<MyBase> SharedBase;
432  out[1] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
433  *reinterpret_cast<SharedBase**>(mxGetData(out[1])) = new SharedBase(*self);
434 }
435 
436 void MyTemplateMatrix_deconstructor_22(int nargout, mxArray *out[], int nargin, const mxArray *in[])
437 {
438  typedef boost::shared_ptr<MyTemplate<gtsam::Matrix>> Shared;
439  checkArguments("delete_MyTemplateMatrix",nargout,nargin,1);
440  Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
441  Collector_MyTemplateMatrix::iterator item;
442  item = collector_MyTemplateMatrix.find(self);
443  if(item != collector_MyTemplateMatrix.end()) {
444  delete self;
445  collector_MyTemplateMatrix.erase(item);
446  }
447 }
448 
449 void MyTemplateMatrix_accept_T_23(int nargout, mxArray *out[], int nargin, const mxArray *in[])
450 {
451  checkArguments("accept_T",nargout,nargin-1,1);
452  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
453  Matrix value = unwrap< Matrix >(in[1]);
454  obj->accept_T(value);
455 }
456 
457 void MyTemplateMatrix_accept_Tptr_24(int nargout, mxArray *out[], int nargin, const mxArray *in[])
458 {
459  checkArguments("accept_Tptr",nargout,nargin-1,1);
460  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
461  Matrix value = unwrap< Matrix >(in[1]);
462  obj->accept_Tptr(value);
463 }
464 
465 void MyTemplateMatrix_create_MixedPtrs_25(int nargout, mxArray *out[], int nargin, const mxArray *in[])
466 {
467  checkArguments("create_MixedPtrs",nargout,nargin-1,0);
468  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
469  auto pairResult = obj->create_MixedPtrs();
470  out[0] = wrap< Matrix >(pairResult.first);
471  {
472  boost::shared_ptr<Matrix> shared(pairResult.second);
473  out[1] = wrap_shared_ptr(shared,"Matrix");
474  }
475 }
476 
477 void MyTemplateMatrix_create_ptrs_26(int nargout, mxArray *out[], int nargin, const mxArray *in[])
478 {
479  checkArguments("create_ptrs",nargout,nargin-1,0);
480  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
481  auto pairResult = obj->create_ptrs();
482  {
483  boost::shared_ptr<Matrix> shared(pairResult.first);
484  out[0] = wrap_shared_ptr(shared,"Matrix");
485  }
486  {
487  boost::shared_ptr<Matrix> shared(pairResult.second);
488  out[1] = wrap_shared_ptr(shared,"Matrix");
489  }
490 }
491 
492 void MyTemplateMatrix_return_T_27(int nargout, mxArray *out[], int nargin, const mxArray *in[])
493 {
494  checkArguments("return_T",nargout,nargin-1,1);
495  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
496  Matrix value = unwrap< Matrix >(in[1]);
497  out[0] = wrap< Matrix >(obj->return_T(value));
498 }
499 
500 void MyTemplateMatrix_return_Tptr_28(int nargout, mxArray *out[], int nargin, const mxArray *in[])
501 {
502  checkArguments("return_Tptr",nargout,nargin-1,1);
503  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
504  Matrix value = unwrap< Matrix >(in[1]);
505  {
506  boost::shared_ptr<Matrix> shared(obj->return_Tptr(value));
507  out[0] = wrap_shared_ptr(shared,"Matrix");
508  }
509 }
510 
511 void MyTemplateMatrix_return_ptrs_29(int nargout, mxArray *out[], int nargin, const mxArray *in[])
512 {
513  checkArguments("return_ptrs",nargout,nargin-1,2);
514  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
515  Matrix p1 = unwrap< Matrix >(in[1]);
516  Matrix p2 = unwrap< Matrix >(in[2]);
517  auto pairResult = obj->return_ptrs(p1,p2);
518  {
519  boost::shared_ptr<Matrix> shared(pairResult.first);
520  out[0] = wrap_shared_ptr(shared,"Matrix");
521  }
522  {
523  boost::shared_ptr<Matrix> shared(pairResult.second);
524  out[1] = wrap_shared_ptr(shared,"Matrix");
525  }
526 }
527 
528 void MyTemplateMatrix_templatedMethod_30(int nargout, mxArray *out[], int nargin, const mxArray *in[])
529 {
530  checkArguments("templatedMethodMatrix",nargout,nargin-1,1);
531  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
532  Matrix t = unwrap< Matrix >(in[1]);
533  out[0] = wrap< Matrix >(obj->templatedMethod<gtsam::Matrix>(t));
534 }
535 
536 void MyTemplateMatrix_templatedMethod_31(int nargout, mxArray *out[], int nargin, const mxArray *in[])
537 {
538  checkArguments("templatedMethodPoint2",nargout,nargin-1,1);
539  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
540  Point2 t = unwrap< Point2 >(in[1]);
541  out[0] = wrap< Point2 >(obj->templatedMethod<gtsam::Point2>(t));
542 }
543 
544 void MyTemplateMatrix_templatedMethod_32(int nargout, mxArray *out[], int nargin, const mxArray *in[])
545 {
546  checkArguments("templatedMethodPoint3",nargout,nargin-1,1);
547  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
548  Point3 t = unwrap< Point3 >(in[1]);
549  out[0] = wrap< Point3 >(obj->templatedMethod<gtsam::Point3>(t));
550 }
551 
552 void MyTemplateMatrix_templatedMethod_33(int nargout, mxArray *out[], int nargin, const mxArray *in[])
553 {
554  checkArguments("templatedMethodVector",nargout,nargin-1,1);
555  auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
556  Vector t = unwrap< Vector >(in[1]);
557  out[0] = wrap< Vector >(obj->templatedMethod<gtsam::Vector>(t));
558 }
559 
560 void MyTemplateMatrix_Level_34(int nargout, mxArray *out[], int nargin, const mxArray *in[])
561 {
562  checkArguments("MyTemplateMatrix.Level",nargout,nargin,1);
563  Matrix K = unwrap< Matrix >(in[0]);
564  out[0] = wrap_shared_ptr(boost::make_shared<MyTemplate<Matrix>>(MyTemplate<gtsam::Matrix>::Level(K)),"MyTemplateMatrix", false);
565 }
566 
567 void Test_set_container_35(int nargout, mxArray *out[], int nargin, const mxArray *in[])
568 {
569  checkArguments("set_container",nargout,nargin-1,1);
570  auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
571  boost::shared_ptr<std::vector<testing::Test>> container = unwrap_shared_ptr< std::vector<testing::Test> >(in[1], "ptr_stdvectorTest");
572  obj->set_container(*container);
573 }
574 
575 void ForwardKinematicsFactor_collectorInsertAndMakeBase_35(int nargout, mxArray *out[], int nargin, const mxArray *in[])
576 {
577  mexAtExit(&_deleteAllObjects);
578  typedef boost::shared_ptr<ForwardKinematicsFactor> Shared;
579 
580  Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
582 
583  typedef boost::shared_ptr<gtsam::BetweenFactor<gtsam::Pose3>> SharedBase;
584  out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
585  *reinterpret_cast<SharedBase**>(mxGetData(out[0])) = new SharedBase(*self);
586 }
587 
588 void ForwardKinematicsFactor_deconstructor_37(int nargout, mxArray *out[], int nargin, const mxArray *in[])
589 {
590  typedef boost::shared_ptr<ForwardKinematicsFactor> Shared;
591  checkArguments("delete_ForwardKinematicsFactor",nargout,nargin,1);
592  Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
593  Collector_ForwardKinematicsFactor::iterator item;
594  item = collector_ForwardKinematicsFactor.find(self);
595  if(item != collector_ForwardKinematicsFactor.end()) {
596  delete self;
598  }
599 }
600 
601 
602 void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
603 {
604  mstream mout;
605  std::streambuf *outbuf = std::cout.rdbuf(&mout);
606 
608 
609  int id = unwrap<int>(in[0]);
610 
611  try {
612  switch(id) {
613  case 0:
614  gtsamPoint2_collectorInsertAndMakeBase_0(nargout, out, nargin-1, in+1);
615  break;
616  case 1:
617  MyBase_collectorInsertAndMakeBase_0(nargout, out, nargin-1, in+1);
618  break;
619  case 2:
620  MyBase_deconstructor_2(nargout, out, nargin-1, in+1);
621  break;
622  case 3:
623  gtsamPoint2_deconstructor_3(nargout, out, nargin-1, in+1);
624  break;
625  case 4:
626  MyTemplatePoint2_collectorInsertAndMakeBase_3(nargout, out, nargin-1, in+1);
627  break;
628  case 5:
629  MyTemplatePoint2_constructor_5(nargout, out, nargin-1, in+1);
630  break;
631  case 6:
632  MyTemplatePoint2_deconstructor_6(nargout, out, nargin-1, in+1);
633  break;
634  case 7:
635  MyTemplatePoint2_accept_T_7(nargout, out, nargin-1, in+1);
636  break;
637  case 8:
638  MyTemplatePoint2_accept_Tptr_8(nargout, out, nargin-1, in+1);
639  break;
640  case 9:
641  MyTemplatePoint2_create_MixedPtrs_9(nargout, out, nargin-1, in+1);
642  break;
643  case 10:
644  MyTemplatePoint2_create_ptrs_10(nargout, out, nargin-1, in+1);
645  break;
646  case 11:
647  MyTemplatePoint2_return_T_11(nargout, out, nargin-1, in+1);
648  break;
649  case 12:
650  MyTemplatePoint2_return_Tptr_12(nargout, out, nargin-1, in+1);
651  break;
652  case 13:
653  MyTemplatePoint2_return_ptrs_13(nargout, out, nargin-1, in+1);
654  break;
655  case 14:
656  MyTemplatePoint2_templatedMethod_14(nargout, out, nargin-1, in+1);
657  break;
658  case 15:
659  MyTemplatePoint2_templatedMethod_15(nargout, out, nargin-1, in+1);
660  break;
661  case 16:
662  MyTemplatePoint2_templatedMethod_16(nargout, out, nargin-1, in+1);
663  break;
664  case 17:
665  MyTemplatePoint2_templatedMethod_17(nargout, out, nargin-1, in+1);
666  break;
667  case 18:
668  MyTemplatePoint2_Level_18(nargout, out, nargin-1, in+1);
669  break;
670  case 19:
671  gtsamPoint3_constructor_19(nargout, out, nargin-1, in+1);
672  break;
673  case 20:
674  MyTemplateMatrix_collectorInsertAndMakeBase_19(nargout, out, nargin-1, in+1);
675  break;
676  case 21:
677  MyTemplateMatrix_constructor_21(nargout, out, nargin-1, in+1);
678  break;
679  case 22:
680  MyTemplateMatrix_deconstructor_22(nargout, out, nargin-1, in+1);
681  break;
682  case 23:
683  MyTemplateMatrix_accept_T_23(nargout, out, nargin-1, in+1);
684  break;
685  case 24:
686  MyTemplateMatrix_accept_Tptr_24(nargout, out, nargin-1, in+1);
687  break;
688  case 25:
689  MyTemplateMatrix_create_MixedPtrs_25(nargout, out, nargin-1, in+1);
690  break;
691  case 26:
692  MyTemplateMatrix_create_ptrs_26(nargout, out, nargin-1, in+1);
693  break;
694  case 27:
695  MyTemplateMatrix_return_T_27(nargout, out, nargin-1, in+1);
696  break;
697  case 28:
698  MyTemplateMatrix_return_Tptr_28(nargout, out, nargin-1, in+1);
699  break;
700  case 29:
701  MyTemplateMatrix_return_ptrs_29(nargout, out, nargin-1, in+1);
702  break;
703  case 30:
704  MyTemplateMatrix_templatedMethod_30(nargout, out, nargin-1, in+1);
705  break;
706  case 31:
707  MyTemplateMatrix_templatedMethod_31(nargout, out, nargin-1, in+1);
708  break;
709  case 32:
710  MyTemplateMatrix_templatedMethod_32(nargout, out, nargin-1, in+1);
711  break;
712  case 33:
713  MyTemplateMatrix_templatedMethod_33(nargout, out, nargin-1, in+1);
714  break;
715  case 34:
716  MyTemplateMatrix_Level_34(nargout, out, nargin-1, in+1);
717  break;
718  case 35:
719  Test_set_container_35(nargout, out, nargin-1, in+1);
720  break;
721  case 36:
722  ForwardKinematicsFactor_collectorInsertAndMakeBase_35(nargout, out, nargin-1, in+1);
723  break;
724  case 37:
725  ForwardKinematicsFactor_deconstructor_37(nargout, out, nargin-1, in+1);
726  break;
727  }
728  } catch(const std::exception& e) {
729  mexErrMsgTxt(("Exception from gtsam:\n" + std::string(e.what()) + "\n").c_str());
730  }
731 
732  std::cout.rdbuf(outbuf);
733 }
int unwrap< int >(const mxArray *array)
Definition: matlab.h:295
static Collector_MultipleTemplatesIntDouble collector_MultipleTemplatesIntDouble
void MyTemplatePoint2_return_Tptr_12(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)
Definition: make_shared.h:57
std::set< boost::shared_ptr< gtsam::Point2 > * > Collector_gtsamPoint2
std::set< boost::shared_ptr< Test > * > Collector_Test
std::set< boost::shared_ptr< PrimitiveRefDouble > * > Collector_PrimitiveRefDouble
void MyTemplatePoint2_collectorInsertAndMakeBase_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Scalar * y
static Collector_FunRange collector_FunRange
Vector3f p1
void gtsamPoint3_constructor_19(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_MyVector12 collector_MyVector12
std::set< boost::shared_ptr< FunDouble > * > Collector_FunDouble
void MyTemplatePoint2_return_T_11(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void checkArguments(const string &name, int nargout, int nargin, int expected)
Definition: matlab.h:116
void MyTemplateMatrix_create_MixedPtrs_25(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< boost::shared_ptr< ForwardKinematicsFactor > * > Collector_ForwardKinematicsFactor
void ForwardKinematicsFactor_collectorInsertAndMakeBase_35(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Vector2 Point2
Definition: Point2.h:27
static Collector_FunDouble collector_FunDouble
void MyTemplateMatrix_return_T_27(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:43
MultipleTemplates< int, float > MultipleTemplatesIntFloat
void MyTemplatePoint2_templatedMethod_15(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MyTemplateMatrix_templatedMethod_32(int nargout, mxArray *out[], int nargin, const mxArray *in[])
MyTemplate< gtsam::Point2 > MyTemplatePoint2
PrimitiveRef< double > PrimitiveRefDouble
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
iterator iter(handle obj)
Definition: pytypes.h:1547
static Collector_MyBase collector_MyBase
std::set< boost::shared_ptr< gtsam::Point3 > * > Collector_gtsamPoint3
void MyTemplateMatrix_accept_T_23(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< boost::shared_ptr< MyVector3 > * > Collector_MyVector3
void MyTemplateMatrix_Level_34(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< boost::shared_ptr< MyVector12 > * > Collector_MyVector12
static Collector_ForwardKinematicsFactor collector_ForwardKinematicsFactor
mxArray * wrap_shared_ptr(boost::shared_ptr< Class > shared_ptr, const std::string &matlabName, bool isVirtual)
Definition: matlab.h:454
void MyTemplatePoint2_Level_18(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_MyTemplatePoint2 collector_MyTemplatePoint2
GeneralSFMFactor< SfmCamera, Point3 > MyFactor
void MyTemplatePoint2_return_ptrs_13(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_MultipleTemplatesIntFloat collector_MultipleTemplatesIntFloat
std::set< boost::shared_ptr< MultipleTemplatesIntDouble > * > Collector_MultipleTemplatesIntDouble
void MyTemplatePoint2_accept_Tptr_8(int nargout, mxArray *out[], int nargin, const mxArray *in[])
MultipleTemplates< int, double > MultipleTemplatesIntDouble
MyFactor< gtsam::Pose2, gtsam::Matrix > MyFactorPosePoint2
void MyTemplatePoint2_templatedMethod_17(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MyTemplateMatrix_deconstructor_22(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MyBase_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_Test collector_Test
std::set< boost::shared_ptr< MultipleTemplatesIntDouble > * > Collector_MultipleTemplatesIntDouble
MyTemplate< gtsam::Matrix > MyTemplateMatrix
void MyTemplatePoint2_create_MixedPtrs_9(int nargout, mxArray *out[], int nargin, const mxArray *in[])
MyVector< 12 > MyVector12
std::set< boost::shared_ptr< MultipleTemplatesIntFloat > * > Collector_MultipleTemplatesIntFloat
void gtsamPoint2_deconstructor_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Fun< double > FunDouble
Eigen::VectorXd Vector
Definition: Vector.h:38
double unwrap< double >(const mxArray *array)
Definition: matlab.h:309
void MyBase_deconstructor_2(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< boost::shared_ptr< MyFactorPosePoint2 > * > Collector_MyFactorPosePoint2
void MyTemplatePoint2_constructor_5(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MyTemplatePoint2_templatedMethod_14(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MyTemplatePoint2_create_ptrs_10(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_MyFactorPosePoint2 collector_MyFactorPosePoint2
std::set< boost::shared_ptr< MyTemplateMatrix > * > Collector_MyTemplateMatrix
static Collector_gtsamPoint3 collector_gtsamPoint3
void MyTemplateMatrix_templatedMethod_33(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void ForwardKinematicsFactor_deconstructor_37(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MyTemplateMatrix_templatedMethod_31(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< boost::shared_ptr< FunDouble > * > Collector_FunDouble
std::set< boost::shared_ptr< FunRange > * > Collector_FunRange
std::set< boost::shared_ptr< MyVector12 > * > Collector_MyVector12
void MyTemplatePoint2_deconstructor_6(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 MyTemplateMatrix_accept_Tptr_24(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MyTemplateMatrix_return_ptrs_29(int nargout, mxArray *out[], int nargin, const mxArray *in[])
#define NULL
Definition: ccolamd.c:609
std::set< boost::shared_ptr< MyFactorPosePoint2 > * > Collector_MyFactorPosePoint2
std::set< boost::shared_ptr< gtsam::Point2 > * > Collector_gtsamPoint2
void _deleteAllObjects()
void MyTemplateMatrix_templatedMethod_30(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void _inheritance_RTTIRegister()
BOOST_CLASS_EXPORT_GUID(gtsam::Point2,"gtsamPoint2")
std::set< boost::shared_ptr< MyVector3 > * > Collector_MyVector3
void MyTemplatePoint2_templatedMethod_16(int nargout, mxArray *out[], int nargin, const mxArray *in[])
#define mxUINT32OR64_CLASS
Definition: matlab.h:61
std::set< boost::shared_ptr< MultipleTemplatesIntFloat > * > Collector_MultipleTemplatesIntFloat
static Collector_gtsamPoint2 collector_gtsamPoint2
std::set< boost::shared_ptr< FunRange > * > Collector_FunRange
std::set< boost::shared_ptr< gtsam::Point3 > * > Collector_gtsamPoint3
3D Point
static Collector_MyTemplateMatrix collector_MyTemplateMatrix
MyVector< 3 > MyVector3
void Test_set_container_35(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Point3 p2
void MyTemplateMatrix_constructor_21(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Matrix
Vector3 Point3
Definition: Point3.h:35
std::set< boost::shared_ptr< MyTemplatePoint2 > * > Collector_MyTemplatePoint2
std::set< boost::shared_ptr< Test > * > Collector_Test
void MyTemplateMatrix_collectorInsertAndMakeBase_19(int nargout, mxArray *out[], int nargin, const mxArray *in[])
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
2D Point
void MyTemplateMatrix_create_ptrs_26(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
std::set< boost::shared_ptr< MyBase > * > Collector_MyBase
Definition: matlab.h:98
void gtsamPoint2_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void MyTemplateMatrix_return_Tptr_28(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_MyVector3 collector_MyVector3
Point2 t(10, 10)
static Collector_PrimitiveRefDouble collector_PrimitiveRefDouble
void MyTemplatePoint2_accept_T_7(int nargout, mxArray *out[], int nargin, const mxArray *in[])


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:14