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> 24 std::streambuf *outbuf = std::cout.rdbuf(&mout);
26 bool anyDeleted =
false;
42 "WARNING: Wrap modules with variables in the workspace have been reloaded due to\n" 43 "calling destructors, call 'clear all' again if you plan to now recompile a wrap\n" 44 "module, so that your recompiled module is used instead of the old one." << endl;
45 std::cout.rdbuf(outbuf);
49 const mxArray *alreadyCreated = mexGetVariablePtr(
"global",
"gtsam_geometry_rttiRegistry_created");
51 std::map<std::string, std::string> types;
55 mxArray *registry = mexGetVariable(
"global",
"gtsamwrap_rttiRegistry");
57 registry = mxCreateStructMatrix(1, 1, 0,
NULL);
58 typedef std::pair<std::string, std::string> StringPair;
59 for(
const StringPair& rtti_matlab: types) {
60 int fieldId = mxAddField(registry, rtti_matlab.first.c_str());
62 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
64 mxArray *matlabName = mxCreateString(rtti_matlab.second.c_str());
65 mxSetFieldByNumber(registry, 0, fieldId, matlabName);
67 if(mexPutVariable(
"global",
"gtsamwrap_rttiRegistry", registry) != 0) {
68 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
70 mxDestroyArray(registry);
72 mxArray *newAlreadyCreated = mxCreateNumericMatrix(0, 0, mxINT8_CLASS, mxREAL);
73 if(mexPutVariable(
"global",
"gtsam_geometry_rttiRegistry_created", newAlreadyCreated) != 0) {
74 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
76 mxDestroyArray(newAlreadyCreated);
83 typedef std::shared_ptr<gtsam::Point2> Shared;
85 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
92 typedef std::shared_ptr<gtsam::Point2> Shared;
97 *
reinterpret_cast<Shared**
> (mxGetData(out[0])) =
self;
103 typedef std::shared_ptr<gtsam::Point2> Shared;
110 *
reinterpret_cast<Shared**
> (mxGetData(out[0])) =
self;
115 typedef std::shared_ptr<gtsam::Point2> Shared;
117 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
118 Collector_gtsamPoint2::iterator item;
129 auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0],
"ptr_gtsamPoint2");
137 auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0],
"ptr_gtsamPoint2");
138 std::shared_ptr<char>
a = unwrap_shared_ptr< char >(in[1],
"ptr_char");
145 auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0],
"ptr_gtsamPoint2");
153 auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0],
"ptr_gtsamPoint2");
154 char*
a = unwrap_ptr< char >(in[1],
"ptr_char");
161 auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0],
"ptr_gtsamPoint2");
162 std::shared_ptr<char>
a = unwrap_shared_ptr< char >(in[1],
"ptr_char");
169 auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0],
"ptr_gtsamPoint2");
177 auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0],
"ptr_gtsamPoint2");
178 char*
a = unwrap_ptr< char >(in[1],
"ptr_char");
185 auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0],
"ptr_gtsamPoint2");
193 auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0],
"ptr_gtsamPoint2");
200 auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0],
"ptr_gtsamPoint2");
201 Vector v = unwrap< Vector >(in[1]);
202 Matrix m = unwrap< Matrix >(in[2]);
203 obj->eigenArguments(v,m);
209 auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0],
"ptr_gtsamPoint2");
216 auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0],
"ptr_gtsamPoint2");
217 out[0] =
wrap_shared_ptr(std::make_shared<VectorNotEigen>(obj->vectorConfusion()),
"VectorNotEigen",
false);
223 auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0],
"ptr_gtsamPoint2");
230 auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0],
"ptr_gtsamPoint2");
237 typedef std::shared_ptr<gtsam::Point3> Shared;
239 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
246 typedef std::shared_ptr<gtsam::Point3> Shared;
254 *
reinterpret_cast<Shared**
> (mxGetData(out[0])) =
self;
259 typedef std::shared_ptr<gtsam::Point3> Shared;
261 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
262 Collector_gtsamPoint3::iterator item;
273 auto obj = unwrap_shared_ptr<gtsam::Point3>(in[0],
"ptr_gtsamPoint3");
279 typedef std::shared_ptr<gtsam::Point3> Shared;
281 Shared obj = unwrap_shared_ptr<gtsam::Point3>(in[0],
"ptr_gtsamPoint3");
282 ostringstream out_archive_stream;
283 boost::archive::text_oarchive out_archive(out_archive_stream);
289 checkArguments(
"gtsam::Point3.StaticFunctionRet",nargout,nargin,1);
291 out[0] = wrap< Point3 >(gtsam::Point3::StaticFunctionRet(z));
302 typedef std::shared_ptr<gtsam::Point3> Shared;
303 checkArguments(
"gtsamPoint3.string_deserialize",nargout,nargin,1);
305 istringstream in_archive_stream(serialized);
306 boost::archive::text_iarchive in_archive(in_archive_stream);
308 in_archive >> *output;
315 std::streambuf *outbuf = std::cout.rdbuf(&mout);
402 }
catch(
const std::exception&
e) {
403 mexErrMsgTxt((
"Exception from gtsam:\n" + std::string(e.what()) +
"\n").c_str());
406 std::cout.rdbuf(outbuf);
int unwrap< int >(const mxArray *array)
mxArray * wrap_shared_ptr(std::shared_ptr< Class > shared_ptr, const std::string &matlabName, bool isVirtual)
void _geometry_RTTIRegister()
void gtsamPoint2_x_16(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::ofstream out("Result.txt")
void gtsamPoint3_collectorInsertAndMakeBase_18(int nargout, mxArray *out[], int nargin, const mxArray *in[])
char unwrap< char >(const mxArray *array)
void checkArguments(const string &name, int nargout, int nargin, int expected)
BOOST_CLASS_EXPORT_GUID(gtsam::Point2, "gtsamPoint2")
void gtsamPoint2_eigenArguments_13(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamPoint2_deconstructor_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
string unwrap< string >(const mxArray *array)
iterator iter(handle obj)
void gtsamPoint2_argChar_5(int nargout, mxArray *out[], int nargin, const mxArray *in[])
unsigned char unwrap< unsigned char >(const mxArray *array)
void gtsamPoint2_constructor_1(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamPoint3_deconstructor_20(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamPoint2_argChar_9(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamPoint2_argChar_8(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamPoint2_argChar_4(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamPoint3_constructor_19(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamPoint2_y_17(int nargout, mxArray *out[], int nargin, const mxArray *in[])
double unwrap< double >(const mxArray *array)
std::set< std::shared_ptr< gtsam::Point3 > * > Collector_gtsamPoint3
void gtsamPoint2_argChar_10(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamPoint3_StaticFunctionRet_23(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Array< int, Dynamic, 1 > v
void gtsamPoint2_constructor_2(int nargout, mxArray *out[], int nargin, const mxArray *in[])
mxArray * wrap< char >(const char &value)
void gtsamPoint3_string_deserialize_25(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Array< double, 1, 3 > e(1./3., 0.5, 2.)
std::set< std::shared_ptr< gtsam::Point2 > * > Collector_gtsamPoint2
void gtsamPoint2_dim_12(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamPoint3_staticFunction_24(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_gtsamPoint3 collector_gtsamPoint3
mxArray * wrap< int >(const int &value)
void gtsamPoint3_norm_21(int nargout, mxArray *out[], int nargin, const mxArray *in[])
mxArray * wrap< double >(const double &value)
void gtsamPoint2_argChar_7(int nargout, mxArray *out[], int nargin, const mxArray *in[])
#define mxUINT32OR64_CLASS
void gtsamPoint3_string_serialize_22(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_gtsamPoint2 collector_gtsamPoint2
void gtsamPoint2_argUChar_11(int nargout, mxArray *out[], int nargin, const mxArray *in[])
mxArray * wrap< string >(const string &value)
void gtsamPoint2_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Matrix
void gtsamPoint2_argChar_6(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamPoint2_returnChar_14(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
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
void gtsamPoint2_vectorConfusion_15(int nargout, mxArray *out[], int nargin, const mxArray *in[])