734 lines
		
	
	
		
			28 KiB
		
	
	
	
		
			C++
		
	
	
		
		
			
		
	
	
			734 lines
		
	
	
		
			28 KiB
		
	
	
	
		
			C++
		
	
	
|  | #include <gtwrap/matlab.h>
 | ||
|  | #include <map>
 | ||
|  | 
 | ||
|  | #include <boost/archive/text_iarchive.hpp>
 | ||
|  | #include <boost/archive/text_oarchive.hpp>
 | ||
|  | #include <boost/serialization/export.hpp>
 | ||
|  | 
 | ||
|  | #include <folder/path/to/Test.h>
 | ||
|  | #include <gtsam/geometry/Point2.h>
 | ||
|  | #include <gtsam/geometry/Point3.h>
 | ||
|  | 
 | ||
|  | typedef Fun<double> FunDouble; | ||
|  | typedef PrimitiveRef<double> PrimitiveRefDouble; | ||
|  | typedef MyVector<3> MyVector3; | ||
|  | typedef MyVector<12> MyVector12; | ||
|  | typedef MultipleTemplates<int, double> MultipleTemplatesIntDouble; | ||
|  | typedef MultipleTemplates<int, float> MultipleTemplatesIntFloat; | ||
|  | typedef MyFactor<gtsam::Pose2, gtsam::Matrix> MyFactorPosePoint2; | ||
|  | typedef MyTemplate<gtsam::Point2> MyTemplatePoint2; | ||
|  | typedef MyTemplate<gtsam::Matrix> MyTemplateMatrix; | ||
|  | 
 | ||
|  | BOOST_CLASS_EXPORT_GUID(gtsam::Point2, "gtsamPoint2"); | ||
|  | BOOST_CLASS_EXPORT_GUID(gtsam::Point3, "gtsamPoint3"); | ||
|  | 
 | ||
|  | typedef std::set<boost::shared_ptr<FunRange>*> Collector_FunRange; | ||
|  | static Collector_FunRange collector_FunRange; | ||
|  | typedef std::set<boost::shared_ptr<FunDouble>*> Collector_FunDouble; | ||
|  | static Collector_FunDouble collector_FunDouble; | ||
|  | typedef std::set<boost::shared_ptr<Test>*> Collector_Test; | ||
|  | static Collector_Test collector_Test; | ||
|  | typedef std::set<boost::shared_ptr<PrimitiveRefDouble>*> Collector_PrimitiveRefDouble; | ||
|  | static Collector_PrimitiveRefDouble collector_PrimitiveRefDouble; | ||
|  | typedef std::set<boost::shared_ptr<MyVector3>*> Collector_MyVector3; | ||
|  | static Collector_MyVector3 collector_MyVector3; | ||
|  | typedef std::set<boost::shared_ptr<MyVector12>*> Collector_MyVector12; | ||
|  | static Collector_MyVector12 collector_MyVector12; | ||
|  | typedef std::set<boost::shared_ptr<MultipleTemplatesIntDouble>*> Collector_MultipleTemplatesIntDouble; | ||
|  | static Collector_MultipleTemplatesIntDouble collector_MultipleTemplatesIntDouble; | ||
|  | typedef std::set<boost::shared_ptr<MultipleTemplatesIntFloat>*> Collector_MultipleTemplatesIntFloat; | ||
|  | static Collector_MultipleTemplatesIntFloat collector_MultipleTemplatesIntFloat; | ||
|  | typedef std::set<boost::shared_ptr<MyFactorPosePoint2>*> Collector_MyFactorPosePoint2; | ||
|  | static Collector_MyFactorPosePoint2 collector_MyFactorPosePoint2; | ||
|  | typedef std::set<boost::shared_ptr<gtsam::Point2>*> Collector_gtsamPoint2; | ||
|  | static Collector_gtsamPoint2 collector_gtsamPoint2; | ||
|  | typedef std::set<boost::shared_ptr<gtsam::Point3>*> Collector_gtsamPoint3; | ||
|  | static Collector_gtsamPoint3 collector_gtsamPoint3; | ||
|  | typedef std::set<boost::shared_ptr<MyBase>*> Collector_MyBase; | ||
|  | static Collector_MyBase collector_MyBase; | ||
|  | typedef std::set<boost::shared_ptr<MyTemplatePoint2>*> Collector_MyTemplatePoint2; | ||
|  | static Collector_MyTemplatePoint2 collector_MyTemplatePoint2; | ||
|  | typedef std::set<boost::shared_ptr<MyTemplateMatrix>*> Collector_MyTemplateMatrix; | ||
|  | static Collector_MyTemplateMatrix collector_MyTemplateMatrix; | ||
|  | typedef std::set<boost::shared_ptr<ForwardKinematicsFactor>*> Collector_ForwardKinematicsFactor; | ||
|  | static Collector_ForwardKinematicsFactor collector_ForwardKinematicsFactor; | ||
|  | 
 | ||
|  | void _deleteAllObjects() | ||
|  | { | ||
|  |   mstream mout; | ||
|  |   std::streambuf *outbuf = std::cout.rdbuf(&mout); | ||
|  | 
 | ||
|  |   bool anyDeleted = false; | ||
|  |   { for(Collector_FunRange::iterator iter = collector_FunRange.begin(); | ||
|  |       iter != collector_FunRange.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_FunRange.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   { for(Collector_FunDouble::iterator iter = collector_FunDouble.begin(); | ||
|  |       iter != collector_FunDouble.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_FunDouble.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   { for(Collector_Test::iterator iter = collector_Test.begin(); | ||
|  |       iter != collector_Test.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_Test.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   { for(Collector_PrimitiveRefDouble::iterator iter = collector_PrimitiveRefDouble.begin(); | ||
|  |       iter != collector_PrimitiveRefDouble.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_PrimitiveRefDouble.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   { for(Collector_MyVector3::iterator iter = collector_MyVector3.begin(); | ||
|  |       iter != collector_MyVector3.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_MyVector3.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   { for(Collector_MyVector12::iterator iter = collector_MyVector12.begin(); | ||
|  |       iter != collector_MyVector12.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_MyVector12.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   { for(Collector_MultipleTemplatesIntDouble::iterator iter = collector_MultipleTemplatesIntDouble.begin(); | ||
|  |       iter != collector_MultipleTemplatesIntDouble.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_MultipleTemplatesIntDouble.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   { for(Collector_MultipleTemplatesIntFloat::iterator iter = collector_MultipleTemplatesIntFloat.begin(); | ||
|  |       iter != collector_MultipleTemplatesIntFloat.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_MultipleTemplatesIntFloat.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   { for(Collector_MyFactorPosePoint2::iterator iter = collector_MyFactorPosePoint2.begin(); | ||
|  |       iter != collector_MyFactorPosePoint2.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_MyFactorPosePoint2.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   { for(Collector_gtsamPoint2::iterator iter = collector_gtsamPoint2.begin(); | ||
|  |       iter != collector_gtsamPoint2.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_gtsamPoint2.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   { for(Collector_gtsamPoint3::iterator iter = collector_gtsamPoint3.begin(); | ||
|  |       iter != collector_gtsamPoint3.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_gtsamPoint3.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   { for(Collector_MyBase::iterator iter = collector_MyBase.begin(); | ||
|  |       iter != collector_MyBase.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_MyBase.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   { for(Collector_MyTemplatePoint2::iterator iter = collector_MyTemplatePoint2.begin(); | ||
|  |       iter != collector_MyTemplatePoint2.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_MyTemplatePoint2.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   { for(Collector_MyTemplateMatrix::iterator iter = collector_MyTemplateMatrix.begin(); | ||
|  |       iter != collector_MyTemplateMatrix.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_MyTemplateMatrix.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   { for(Collector_ForwardKinematicsFactor::iterator iter = collector_ForwardKinematicsFactor.begin(); | ||
|  |       iter != collector_ForwardKinematicsFactor.end(); ) { | ||
|  |     delete *iter; | ||
|  |     collector_ForwardKinematicsFactor.erase(iter++); | ||
|  |     anyDeleted = true; | ||
|  |   } } | ||
|  |   if(anyDeleted) | ||
|  |     cout << | ||
|  |       "WARNING:  Wrap modules with variables in the workspace have been reloaded due to\n" | ||
|  |       "calling destructors, call 'clear all' again if you plan to now recompile a wrap\n" | ||
|  |       "module, so that your recompiled module is used instead of the old one." << endl; | ||
|  |   std::cout.rdbuf(outbuf); | ||
|  | } | ||
|  | 
 | ||
|  | void _inheritance_RTTIRegister() { | ||
|  |   const mxArray *alreadyCreated = mexGetVariablePtr("global", "gtsam_inheritance_rttiRegistry_created"); | ||
|  |   if(!alreadyCreated) { | ||
|  |     std::map<std::string, std::string> types; | ||
|  |     types.insert(std::make_pair(typeid(MyBase).name(), "MyBase")); | ||
|  |     types.insert(std::make_pair(typeid(MyTemplatePoint2).name(), "MyTemplatePoint2")); | ||
|  |     types.insert(std::make_pair(typeid(MyTemplateMatrix).name(), "MyTemplateMatrix")); | ||
|  |     types.insert(std::make_pair(typeid(ForwardKinematicsFactor).name(), "ForwardKinematicsFactor")); | ||
|  | 
 | ||
|  |     mxArray *registry = mexGetVariable("global", "gtsamwrap_rttiRegistry"); | ||
|  |     if(!registry) | ||
|  |       registry = mxCreateStructMatrix(1, 1, 0, NULL); | ||
|  |     typedef std::pair<std::string, std::string> StringPair; | ||
|  |     for(const StringPair& rtti_matlab: types) { | ||
|  |       int fieldId = mxAddField(registry, rtti_matlab.first.c_str()); | ||
|  |       if(fieldId < 0) | ||
|  |         mexErrMsgTxt("gtsam wrap:  Error indexing RTTI types, inheritance will not work correctly"); | ||
|  |       mxArray *matlabName = mxCreateString(rtti_matlab.second.c_str()); | ||
|  |       mxSetFieldByNumber(registry, 0, fieldId, matlabName); | ||
|  |     } | ||
|  |     if(mexPutVariable("global", "gtsamwrap_rttiRegistry", registry) != 0) | ||
|  |       mexErrMsgTxt("gtsam wrap:  Error indexing RTTI types, inheritance will not work correctly"); | ||
|  |     mxDestroyArray(registry); | ||
|  |      | ||
|  |     mxArray *newAlreadyCreated = mxCreateNumericMatrix(0, 0, mxINT8_CLASS, mxREAL); | ||
|  |     if(mexPutVariable("global", "gtsam_geometry_rttiRegistry_created", newAlreadyCreated) != 0) | ||
|  |       mexErrMsgTxt("gtsam wrap:  Error indexing RTTI types, inheritance will not work correctly"); | ||
|  |     mxDestroyArray(newAlreadyCreated); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | void gtsamPoint2_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   mexAtExit(&_deleteAllObjects); | ||
|  |   typedef boost::shared_ptr<gtsam::Point2> Shared; | ||
|  | 
 | ||
|  |   Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0])); | ||
|  |   collector_gtsamPoint2.insert(self); | ||
|  | } | ||
|  | 
 | ||
|  | void MyBase_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   mexAtExit(&_deleteAllObjects); | ||
|  |   typedef boost::shared_ptr<MyBase> Shared; | ||
|  | 
 | ||
|  |   Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0])); | ||
|  |   collector_MyBase.insert(self); | ||
|  | } | ||
|  | 
 | ||
|  | void MyBase_deconstructor_2(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   typedef boost::shared_ptr<MyBase> Shared; | ||
|  |   checkArguments("delete_MyBase",nargout,nargin,1); | ||
|  |   Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0])); | ||
|  |   Collector_MyBase::iterator item; | ||
|  |   item = collector_MyBase.find(self); | ||
|  |   if(item != collector_MyBase.end()) { | ||
|  |     delete self; | ||
|  |     collector_MyBase.erase(item); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | void gtsamPoint2_deconstructor_3(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   typedef boost::shared_ptr<gtsam::Point2> Shared; | ||
|  |   checkArguments("delete_gtsamPoint2",nargout,nargin,1); | ||
|  |   Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0])); | ||
|  |   Collector_gtsamPoint2::iterator item; | ||
|  |   item = collector_gtsamPoint2.find(self); | ||
|  |   if(item != collector_gtsamPoint2.end()) { | ||
|  |     delete self; | ||
|  |     collector_gtsamPoint2.erase(item); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_collectorInsertAndMakeBase_3(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   mexAtExit(&_deleteAllObjects); | ||
|  |   typedef boost::shared_ptr<MyTemplate<gtsam::Point2>> Shared; | ||
|  | 
 | ||
|  |   Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0])); | ||
|  |   collector_MyTemplatePoint2.insert(self); | ||
|  | 
 | ||
|  |   typedef boost::shared_ptr<MyBase> SharedBase; | ||
|  |   out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); | ||
|  |   *reinterpret_cast<SharedBase**>(mxGetData(out[0])) = new SharedBase(*self); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_constructor_5(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   mexAtExit(&_deleteAllObjects); | ||
|  |   typedef boost::shared_ptr<MyTemplate<gtsam::Point2>> Shared; | ||
|  | 
 | ||
|  |   Shared *self = new Shared(new MyTemplate<gtsam::Point2>()); | ||
|  |   collector_MyTemplatePoint2.insert(self); | ||
|  |   out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); | ||
|  |   *reinterpret_cast<Shared**> (mxGetData(out[0])) = self; | ||
|  | 
 | ||
|  |   typedef boost::shared_ptr<MyBase> SharedBase; | ||
|  |   out[1] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); | ||
|  |   *reinterpret_cast<SharedBase**>(mxGetData(out[1])) = new SharedBase(*self); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_deconstructor_6(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   typedef boost::shared_ptr<MyTemplate<gtsam::Point2>> Shared; | ||
|  |   checkArguments("delete_MyTemplatePoint2",nargout,nargin,1); | ||
|  |   Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0])); | ||
|  |   Collector_MyTemplatePoint2::iterator item; | ||
|  |   item = collector_MyTemplatePoint2.find(self); | ||
|  |   if(item != collector_MyTemplatePoint2.end()) { | ||
|  |     delete self; | ||
|  |     collector_MyTemplatePoint2.erase(item); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_accept_T_7(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("accept_T",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2"); | ||
|  |   Point2 value = unwrap< Point2 >(in[1]); | ||
|  |   obj->accept_T(value); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_accept_Tptr_8(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("accept_Tptr",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2"); | ||
|  |   Point2 value = unwrap< Point2 >(in[1]); | ||
|  |   obj->accept_Tptr(value); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_create_MixedPtrs_9(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("create_MixedPtrs",nargout,nargin-1,0); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2"); | ||
|  |   auto pairResult = obj->create_MixedPtrs(); | ||
|  |   out[0] = wrap< Point2 >(pairResult.first); | ||
|  |   { | ||
|  |   boost::shared_ptr<Point2> shared(pairResult.second); | ||
|  |   out[1] = wrap_shared_ptr(shared,"Point2"); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_create_ptrs_10(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("create_ptrs",nargout,nargin-1,0); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2"); | ||
|  |   auto pairResult = obj->create_ptrs(); | ||
|  |   { | ||
|  |   boost::shared_ptr<Point2> shared(pairResult.first); | ||
|  |   out[0] = wrap_shared_ptr(shared,"Point2"); | ||
|  |   } | ||
|  |   { | ||
|  |   boost::shared_ptr<Point2> shared(pairResult.second); | ||
|  |   out[1] = wrap_shared_ptr(shared,"Point2"); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_return_T_11(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("return_T",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2"); | ||
|  |   Point2 value = unwrap< Point2 >(in[1]); | ||
|  |   out[0] = wrap< Point2 >(obj->return_T(value)); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_return_Tptr_12(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("return_Tptr",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2"); | ||
|  |   Point2 value = unwrap< Point2 >(in[1]); | ||
|  |   { | ||
|  |   boost::shared_ptr<Point2> shared(obj->return_Tptr(value)); | ||
|  |   out[0] = wrap_shared_ptr(shared,"Point2"); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_return_ptrs_13(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("return_ptrs",nargout,nargin-1,2); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2"); | ||
|  |   Point2 p1 = unwrap< Point2 >(in[1]); | ||
|  |   Point2 p2 = unwrap< Point2 >(in[2]); | ||
|  |   auto pairResult = obj->return_ptrs(p1,p2); | ||
|  |   { | ||
|  |   boost::shared_ptr<Point2> shared(pairResult.first); | ||
|  |   out[0] = wrap_shared_ptr(shared,"Point2"); | ||
|  |   } | ||
|  |   { | ||
|  |   boost::shared_ptr<Point2> shared(pairResult.second); | ||
|  |   out[1] = wrap_shared_ptr(shared,"Point2"); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_templatedMethod_14(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("templatedMethodMatrix",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2"); | ||
|  |   Matrix t = unwrap< Matrix >(in[1]); | ||
|  |   out[0] = wrap< Matrix >(obj->templatedMethod<gtsam::Matrix>(t)); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_templatedMethod_15(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("templatedMethodPoint2",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2"); | ||
|  |   Point2 t = unwrap< Point2 >(in[1]); | ||
|  |   out[0] = wrap< Point2 >(obj->templatedMethod<gtsam::Point2>(t)); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_templatedMethod_16(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("templatedMethodPoint3",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2"); | ||
|  |   Point3 t = unwrap< Point3 >(in[1]); | ||
|  |   out[0] = wrap< Point3 >(obj->templatedMethod<gtsam::Point3>(t)); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_templatedMethod_17(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("templatedMethodVector",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2"); | ||
|  |   Vector t = unwrap< Vector >(in[1]); | ||
|  |   out[0] = wrap< Vector >(obj->templatedMethod<gtsam::Vector>(t)); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplatePoint2_Level_18(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("MyTemplatePoint2.Level",nargout,nargin,1); | ||
|  |   Point2 K = unwrap< Point2 >(in[0]); | ||
|  |   out[0] = wrap_shared_ptr(boost::make_shared<MyTemplate<Point2>>(MyTemplate<gtsam::Point2>::Level(K)),"MyTemplatePoint2", false); | ||
|  | } | ||
|  | 
 | ||
|  | void gtsamPoint3_constructor_19(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   mexAtExit(&_deleteAllObjects); | ||
|  |   typedef boost::shared_ptr<gtsam::Point3> Shared; | ||
|  | 
 | ||
|  |   double x = unwrap< double >(in[0]); | ||
|  |   double y = unwrap< double >(in[1]); | ||
|  |   double z = unwrap< double >(in[2]); | ||
|  |   Shared *self = new Shared(new gtsam::Point3(x,y,z)); | ||
|  |   collector_gtsamPoint3.insert(self); | ||
|  |   out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); | ||
|  |   *reinterpret_cast<Shared**> (mxGetData(out[0])) = self; | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_collectorInsertAndMakeBase_19(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   mexAtExit(&_deleteAllObjects); | ||
|  |   typedef boost::shared_ptr<MyTemplate<gtsam::Matrix>> Shared; | ||
|  | 
 | ||
|  |   Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0])); | ||
|  |   collector_MyTemplateMatrix.insert(self); | ||
|  | 
 | ||
|  |   typedef boost::shared_ptr<MyBase> SharedBase; | ||
|  |   out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); | ||
|  |   *reinterpret_cast<SharedBase**>(mxGetData(out[0])) = new SharedBase(*self); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_constructor_21(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   mexAtExit(&_deleteAllObjects); | ||
|  |   typedef boost::shared_ptr<MyTemplate<gtsam::Matrix>> Shared; | ||
|  | 
 | ||
|  |   Shared *self = new Shared(new MyTemplate<gtsam::Matrix>()); | ||
|  |   collector_MyTemplateMatrix.insert(self); | ||
|  |   out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); | ||
|  |   *reinterpret_cast<Shared**> (mxGetData(out[0])) = self; | ||
|  | 
 | ||
|  |   typedef boost::shared_ptr<MyBase> SharedBase; | ||
|  |   out[1] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); | ||
|  |   *reinterpret_cast<SharedBase**>(mxGetData(out[1])) = new SharedBase(*self); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_deconstructor_22(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   typedef boost::shared_ptr<MyTemplate<gtsam::Matrix>> Shared; | ||
|  |   checkArguments("delete_MyTemplateMatrix",nargout,nargin,1); | ||
|  |   Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0])); | ||
|  |   Collector_MyTemplateMatrix::iterator item; | ||
|  |   item = collector_MyTemplateMatrix.find(self); | ||
|  |   if(item != collector_MyTemplateMatrix.end()) { | ||
|  |     delete self; | ||
|  |     collector_MyTemplateMatrix.erase(item); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_accept_T_23(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("accept_T",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix"); | ||
|  |   Matrix value = unwrap< Matrix >(in[1]); | ||
|  |   obj->accept_T(value); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_accept_Tptr_24(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("accept_Tptr",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix"); | ||
|  |   Matrix value = unwrap< Matrix >(in[1]); | ||
|  |   obj->accept_Tptr(value); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_create_MixedPtrs_25(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("create_MixedPtrs",nargout,nargin-1,0); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix"); | ||
|  |   auto pairResult = obj->create_MixedPtrs(); | ||
|  |   out[0] = wrap< Matrix >(pairResult.first); | ||
|  |   { | ||
|  |   boost::shared_ptr<Matrix> shared(pairResult.second); | ||
|  |   out[1] = wrap_shared_ptr(shared,"Matrix"); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_create_ptrs_26(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("create_ptrs",nargout,nargin-1,0); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix"); | ||
|  |   auto pairResult = obj->create_ptrs(); | ||
|  |   { | ||
|  |   boost::shared_ptr<Matrix> shared(pairResult.first); | ||
|  |   out[0] = wrap_shared_ptr(shared,"Matrix"); | ||
|  |   } | ||
|  |   { | ||
|  |   boost::shared_ptr<Matrix> shared(pairResult.second); | ||
|  |   out[1] = wrap_shared_ptr(shared,"Matrix"); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_return_T_27(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("return_T",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix"); | ||
|  |   Matrix value = unwrap< Matrix >(in[1]); | ||
|  |   out[0] = wrap< Matrix >(obj->return_T(value)); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_return_Tptr_28(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("return_Tptr",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix"); | ||
|  |   Matrix value = unwrap< Matrix >(in[1]); | ||
|  |   { | ||
|  |   boost::shared_ptr<Matrix> shared(obj->return_Tptr(value)); | ||
|  |   out[0] = wrap_shared_ptr(shared,"Matrix"); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_return_ptrs_29(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("return_ptrs",nargout,nargin-1,2); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix"); | ||
|  |   Matrix p1 = unwrap< Matrix >(in[1]); | ||
|  |   Matrix p2 = unwrap< Matrix >(in[2]); | ||
|  |   auto pairResult = obj->return_ptrs(p1,p2); | ||
|  |   { | ||
|  |   boost::shared_ptr<Matrix> shared(pairResult.first); | ||
|  |   out[0] = wrap_shared_ptr(shared,"Matrix"); | ||
|  |   } | ||
|  |   { | ||
|  |   boost::shared_ptr<Matrix> shared(pairResult.second); | ||
|  |   out[1] = wrap_shared_ptr(shared,"Matrix"); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_templatedMethod_30(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("templatedMethodMatrix",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix"); | ||
|  |   Matrix t = unwrap< Matrix >(in[1]); | ||
|  |   out[0] = wrap< Matrix >(obj->templatedMethod<gtsam::Matrix>(t)); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_templatedMethod_31(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("templatedMethodPoint2",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix"); | ||
|  |   Point2 t = unwrap< Point2 >(in[1]); | ||
|  |   out[0] = wrap< Point2 >(obj->templatedMethod<gtsam::Point2>(t)); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_templatedMethod_32(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("templatedMethodPoint3",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix"); | ||
|  |   Point3 t = unwrap< Point3 >(in[1]); | ||
|  |   out[0] = wrap< Point3 >(obj->templatedMethod<gtsam::Point3>(t)); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_templatedMethod_33(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("templatedMethodVector",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix"); | ||
|  |   Vector t = unwrap< Vector >(in[1]); | ||
|  |   out[0] = wrap< Vector >(obj->templatedMethod<gtsam::Vector>(t)); | ||
|  | } | ||
|  | 
 | ||
|  | void MyTemplateMatrix_Level_34(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("MyTemplateMatrix.Level",nargout,nargin,1); | ||
|  |   Matrix K = unwrap< Matrix >(in[0]); | ||
|  |   out[0] = wrap_shared_ptr(boost::make_shared<MyTemplate<Matrix>>(MyTemplate<gtsam::Matrix>::Level(K)),"MyTemplateMatrix", false); | ||
|  | } | ||
|  | 
 | ||
|  | void Test_set_container_35(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   checkArguments("set_container",nargout,nargin-1,1); | ||
|  |   auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test"); | ||
|  |   boost::shared_ptr<std::vector<testing::Test>> container = unwrap_shared_ptr< std::vector<testing::Test> >(in[1], "ptr_stdvectorTest"); | ||
|  |   obj->set_container(*container); | ||
|  | } | ||
|  | 
 | ||
|  | void ForwardKinematicsFactor_collectorInsertAndMakeBase_35(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   mexAtExit(&_deleteAllObjects); | ||
|  |   typedef boost::shared_ptr<ForwardKinematicsFactor> Shared; | ||
|  | 
 | ||
|  |   Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0])); | ||
|  |   collector_ForwardKinematicsFactor.insert(self); | ||
|  | 
 | ||
|  |   typedef boost::shared_ptr<gtsam::BetweenFactor<gtsam::Pose3>> SharedBase; | ||
|  |   out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); | ||
|  |   *reinterpret_cast<SharedBase**>(mxGetData(out[0])) = new SharedBase(*self); | ||
|  | } | ||
|  | 
 | ||
|  | void ForwardKinematicsFactor_deconstructor_37(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   typedef boost::shared_ptr<ForwardKinematicsFactor> Shared; | ||
|  |   checkArguments("delete_ForwardKinematicsFactor",nargout,nargin,1); | ||
|  |   Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0])); | ||
|  |   Collector_ForwardKinematicsFactor::iterator item; | ||
|  |   item = collector_ForwardKinematicsFactor.find(self); | ||
|  |   if(item != collector_ForwardKinematicsFactor.end()) { | ||
|  |     delete self; | ||
|  |     collector_ForwardKinematicsFactor.erase(item); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) | ||
|  | { | ||
|  |   mstream mout; | ||
|  |   std::streambuf *outbuf = std::cout.rdbuf(&mout); | ||
|  | 
 | ||
|  |   _inheritance_RTTIRegister(); | ||
|  | 
 | ||
|  |   int id = unwrap<int>(in[0]); | ||
|  | 
 | ||
|  |   try { | ||
|  |     switch(id) { | ||
|  |     case 0: | ||
|  |       gtsamPoint2_collectorInsertAndMakeBase_0(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 1: | ||
|  |       MyBase_collectorInsertAndMakeBase_0(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 2: | ||
|  |       MyBase_deconstructor_2(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 3: | ||
|  |       gtsamPoint2_deconstructor_3(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 4: | ||
|  |       MyTemplatePoint2_collectorInsertAndMakeBase_3(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 5: | ||
|  |       MyTemplatePoint2_constructor_5(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 6: | ||
|  |       MyTemplatePoint2_deconstructor_6(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 7: | ||
|  |       MyTemplatePoint2_accept_T_7(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 8: | ||
|  |       MyTemplatePoint2_accept_Tptr_8(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 9: | ||
|  |       MyTemplatePoint2_create_MixedPtrs_9(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 10: | ||
|  |       MyTemplatePoint2_create_ptrs_10(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 11: | ||
|  |       MyTemplatePoint2_return_T_11(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 12: | ||
|  |       MyTemplatePoint2_return_Tptr_12(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 13: | ||
|  |       MyTemplatePoint2_return_ptrs_13(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 14: | ||
|  |       MyTemplatePoint2_templatedMethod_14(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 15: | ||
|  |       MyTemplatePoint2_templatedMethod_15(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 16: | ||
|  |       MyTemplatePoint2_templatedMethod_16(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 17: | ||
|  |       MyTemplatePoint2_templatedMethod_17(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 18: | ||
|  |       MyTemplatePoint2_Level_18(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 19: | ||
|  |       gtsamPoint3_constructor_19(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 20: | ||
|  |       MyTemplateMatrix_collectorInsertAndMakeBase_19(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 21: | ||
|  |       MyTemplateMatrix_constructor_21(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 22: | ||
|  |       MyTemplateMatrix_deconstructor_22(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 23: | ||
|  |       MyTemplateMatrix_accept_T_23(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 24: | ||
|  |       MyTemplateMatrix_accept_Tptr_24(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 25: | ||
|  |       MyTemplateMatrix_create_MixedPtrs_25(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 26: | ||
|  |       MyTemplateMatrix_create_ptrs_26(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 27: | ||
|  |       MyTemplateMatrix_return_T_27(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 28: | ||
|  |       MyTemplateMatrix_return_Tptr_28(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 29: | ||
|  |       MyTemplateMatrix_return_ptrs_29(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 30: | ||
|  |       MyTemplateMatrix_templatedMethod_30(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 31: | ||
|  |       MyTemplateMatrix_templatedMethod_31(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 32: | ||
|  |       MyTemplateMatrix_templatedMethod_32(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 33: | ||
|  |       MyTemplateMatrix_templatedMethod_33(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 34: | ||
|  |       MyTemplateMatrix_Level_34(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 35: | ||
|  |       Test_set_container_35(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 36: | ||
|  |       ForwardKinematicsFactor_collectorInsertAndMakeBase_35(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     case 37: | ||
|  |       ForwardKinematicsFactor_deconstructor_37(nargout, out, nargin-1, in+1); | ||
|  |       break; | ||
|  |     } | ||
|  |   } catch(const std::exception& e) { | ||
|  |     mexErrMsgTxt(("Exception from gtsam:\n" + std::string(e.what()) + "\n").c_str()); | ||
|  |   } | ||
|  | 
 | ||
|  |   std::cout.rdbuf(outbuf); | ||
|  | } |