Added UNSAFE_WRAP flag that omits type-checking, to allow for GaussianFactor -> JacobianFactor inheritance. TODO: how can we have type safety AND inheritance?
parent
168ad81230
commit
9780af72d9
|
@ -52,7 +52,7 @@ interfacePath = $(top_srcdir)
|
|||
moduleName = gtsam
|
||||
toolboxpath = ../toolbox
|
||||
nameSpace = "gtsam"
|
||||
mexFlags = "${BOOST_CPPFLAGS} -I${prefix}/include -I${prefix}/include/gtsam -I${prefix}/include/gtsam/base -I${prefix}/include/gtsam/geometry -I${prefix}/include/gtsam/linear -I${prefix}/include/gtsam/nonlinear -I${prefix}/include/gtsam/slam -L${exec_prefix}/lib -lgtsam"
|
||||
mexFlags = "${BOOST_CPPFLAGS} -DUNSAFE_WRAP -I${prefix}/include -I${prefix}/include/gtsam -I${prefix}/include/gtsam/base -I${prefix}/include/gtsam/geometry -I${prefix}/include/gtsam/linear -I${prefix}/include/gtsam/nonlinear -I${prefix}/include/gtsam/slam -L${exec_prefix}/lib -lgtsam"
|
||||
all:
|
||||
./wrap ${interfacePath} ${moduleName} ${toolboxpath} ${nameSpace} ${mexFlags}
|
||||
|
||||
|
|
|
@ -438,11 +438,13 @@ mxArray* wrap_shared_ptr(shared_ptr< Class > shared_ptr, const char *classname)
|
|||
*/
|
||||
template <typename Class>
|
||||
shared_ptr<Class> unwrap_shared_ptr(const mxArray* obj, const string& className) {
|
||||
#ifndef UNSAFE_WRAP
|
||||
bool isClass = mxIsClass(obj, className.c_str());
|
||||
if (!isClass) {
|
||||
mexPrintf("Expected %s, got %s\n", className.c_str(), mxGetClassName(obj));
|
||||
error("Argument has wrong type.");
|
||||
}
|
||||
#endif
|
||||
mxArray* mxh = mxGetProperty(obj,0,"self");
|
||||
if (mxh==NULL) error("unwrap_reference: invalid wrap object");
|
||||
ObjectHandle<Class>* handle = ObjectHandle<Class>::from_mex_handle(mxh);
|
||||
|
|
Loading…
Reference in New Issue