@@ -20,6 +20,10 @@ typedef std::set<std::shared_ptr<ForwardKinematicsFactor>*> Collector_ForwardKin
2020static Collector_ForwardKinematicsFactor collector_ForwardKinematicsFactor;
2121typedef std::set<std::shared_ptr<ParentHasTemplateDouble>*> Collector_ParentHasTemplateDouble;
2222static Collector_ParentHasTemplateDouble collector_ParentHasTemplateDouble;
23+ typedef std::set<std::shared_ptr<Base>*> Collector_Base;
24+ static Collector_Base collector_Base;
25+ typedef std::set<std::shared_ptr<Derived>*> Collector_Derived;
26+ static Collector_Derived collector_Derived;
2327
2428
2529void _deleteAllObjects ()
@@ -64,6 +68,18 @@ void _deleteAllObjects()
6468 collector_ParentHasTemplateDouble.erase (iter++);
6569 anyDeleted = true ;
6670 } }
71+ { for (Collector_Base::iterator iter = collector_Base.begin ();
72+ iter != collector_Base.end (); ) {
73+ delete *iter;
74+ collector_Base.erase (iter++);
75+ anyDeleted = true ;
76+ } }
77+ { for (Collector_Derived::iterator iter = collector_Derived.begin ();
78+ iter != collector_Derived.end (); ) {
79+ delete *iter;
80+ collector_Derived.erase (iter++);
81+ anyDeleted = true ;
82+ } }
6783
6884 if (anyDeleted)
6985 cout <<
@@ -84,6 +100,8 @@ void _inheritance_RTTIRegister() {
84100 types.insert (std::make_pair (typeid (MyTemplateA).name (), " MyTemplateA" ));
85101 types.insert (std::make_pair (typeid (ForwardKinematicsFactor).name (), " ForwardKinematicsFactor" ));
86102 types.insert (std::make_pair (typeid (ParentHasTemplateDouble).name (), " ParentHasTemplateDouble" ));
103+ types.insert (std::make_pair (typeid (Base).name (), " Base" ));
104+ types.insert (std::make_pair (typeid (Derived).name (), " Derived" ));
87105
88106
89107 mxArray *registry = mexGetVariable (" global" , " gtsamwrap_rttiRegistry" );
@@ -698,6 +716,79 @@ void ParentHasTemplateDouble_deconstructor_56(int nargout, mxArray *out[], int n
698716 delete self;
699717}
700718
719+ void Base_collectorInsertAndMakeBase_57 (int nargout, mxArray *out[], int nargin, const mxArray *in[])
720+ {
721+ mexAtExit (&_deleteAllObjects);
722+ typedef std::shared_ptr<Base> Shared;
723+
724+ Shared *self = *reinterpret_cast <Shared**> (mxGetData (in[0 ]));
725+ collector_Base.insert (self);
726+ }
727+
728+ void Base_upcastFromVoid_58 (int nargout, mxArray *out[], int nargin, const mxArray *in[]) {
729+ mexAtExit (&_deleteAllObjects);
730+ typedef std::shared_ptr<Base> Shared;
731+ std::shared_ptr<void > *asVoid = *reinterpret_cast <std::shared_ptr<void >**> (mxGetData (in[0 ]));
732+ out[0 ] = mxCreateNumericMatrix (1 , 1 , mxUINT32OR64_CLASS, mxREAL);
733+ Shared *self = new Shared (std::static_pointer_cast<Base>(*asVoid));
734+ *reinterpret_cast <Shared**>(mxGetData (out[0 ])) = self;
735+ }
736+
737+ void Base_deconstructor_59 (int nargout, mxArray *out[], int nargin, const mxArray *in[])
738+ {
739+ typedef std::shared_ptr<Base> Shared;
740+ checkArguments (" delete_Base" ,nargout,nargin,1 );
741+ Shared *self = *reinterpret_cast <Shared**>(mxGetData (in[0 ]));
742+ Collector_Base::iterator item;
743+ item = collector_Base.find (self);
744+ if (item != collector_Base.end ()) {
745+ collector_Base.erase (item);
746+ }
747+ delete self;
748+ }
749+
750+ void Base_Create_60 (int nargout, mxArray *out[], int nargin, const mxArray *in[])
751+ {
752+ checkArguments (" Base.Create" ,nargout,nargin,1 );
753+ double x = unwrap< double >(in[0 ]);
754+ out[0 ] = wrap_shared_ptr (Base::Create (x)," gtsam.Base" , true );
755+ }
756+
757+ void Derived_collectorInsertAndMakeBase_61 (int nargout, mxArray *out[], int nargin, const mxArray *in[])
758+ {
759+ mexAtExit (&_deleteAllObjects);
760+ typedef std::shared_ptr<Derived> Shared;
761+
762+ Shared *self = *reinterpret_cast <Shared**> (mxGetData (in[0 ]));
763+ collector_Derived.insert (self);
764+
765+ typedef std::shared_ptr<Base> SharedBase;
766+ out[0 ] = mxCreateNumericMatrix (1 , 1 , mxUINT32OR64_CLASS, mxREAL);
767+ *reinterpret_cast <SharedBase**>(mxGetData (out[0 ])) = new SharedBase (*self);
768+ }
769+
770+ void Derived_upcastFromVoid_62 (int nargout, mxArray *out[], int nargin, const mxArray *in[]) {
771+ mexAtExit (&_deleteAllObjects);
772+ typedef std::shared_ptr<Derived> Shared;
773+ std::shared_ptr<void > *asVoid = *reinterpret_cast <std::shared_ptr<void >**> (mxGetData (in[0 ]));
774+ out[0 ] = mxCreateNumericMatrix (1 , 1 , mxUINT32OR64_CLASS, mxREAL);
775+ Shared *self = new Shared (std::static_pointer_cast<Derived>(*asVoid));
776+ *reinterpret_cast <Shared**>(mxGetData (out[0 ])) = self;
777+ }
778+
779+ void Derived_deconstructor_63 (int nargout, mxArray *out[], int nargin, const mxArray *in[])
780+ {
781+ typedef std::shared_ptr<Derived> Shared;
782+ checkArguments (" delete_Derived" ,nargout,nargin,1 );
783+ Shared *self = *reinterpret_cast <Shared**>(mxGetData (in[0 ]));
784+ Collector_Derived::iterator item;
785+ item = collector_Derived.find (self);
786+ if (item != collector_Derived.end ()) {
787+ collector_Derived.erase (item);
788+ }
789+ delete self;
790+ }
791+
701792
702793void mexFunction (int nargout, mxArray *out[], int nargin, const mxArray *in[])
703794{
@@ -881,6 +972,27 @@ void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
881972 case 56 :
882973 ParentHasTemplateDouble_deconstructor_56 (nargout, out, nargin-1 , in+1 );
883974 break ;
975+ case 57 :
976+ Base_collectorInsertAndMakeBase_57 (nargout, out, nargin-1 , in+1 );
977+ break ;
978+ case 58 :
979+ Base_upcastFromVoid_58 (nargout, out, nargin-1 , in+1 );
980+ break ;
981+ case 59 :
982+ Base_deconstructor_59 (nargout, out, nargin-1 , in+1 );
983+ break ;
984+ case 60 :
985+ Base_Create_60 (nargout, out, nargin-1 , in+1 );
986+ break ;
987+ case 61 :
988+ Derived_collectorInsertAndMakeBase_61 (nargout, out, nargin-1 , in+1 );
989+ break ;
990+ case 62 :
991+ Derived_upcastFromVoid_62 (nargout, out, nargin-1 , in+1 );
992+ break ;
993+ case 63 :
994+ Derived_deconstructor_63 (nargout, out, nargin-1 , in+1 );
995+ break ;
884996 }
885997 } catch (const std::exception& e) {
886998 mexErrMsgTxt ((" Exception from gtsam:\n " + std::string (e.what ()) + " \n " ).c_str ());
0 commit comments