Skip to content

Commit

Permalink
[MATLAB] Implemented SWIG_Matlab_ConvertPtrAndOwn
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeandersson committed Apr 13, 2014
1 parent b8af37d commit bdf2960
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions Lib/matlab/matlabrun.swg
Expand Up @@ -95,6 +95,26 @@ SWIGRUNTIME mxArray* SWIG_Matlab_NewPointerObj(void *ptr, swig_type_info *type,
}

SWIGRUNTIME int SWIG_Matlab_ConvertPtrAndOwn(mxArray*, void **ptr, swig_type_info *type, int flags, int *own) {
#error
return SWIG_OK;
/* Return value */
int ret = SWIG_OK;

/* Get pointer, represented as a uint64_T scalar */
mxArray *pm_ptr = mxGetProperty("swigCPtr");
if(!pm_ptr || mxGetNumberOfElements(pm_ptr) != 1 || mxGetClassID(pm_ptr) != mxUINT64_CLASS || mxIsComplex(pm_ptr)){
ret = SWIG_ERROR;
} else {
if(ptr) *ptr = (void*)(*(uint64_T*)mxGetData(pm_ptr));
}
if(pm_ptr) mxDestroyArray(pm_ptr);

/* Get ownership marker */
mxArray *pm_own = mxGetProperty("swigOwn");
it(!pm_own || !mxIsLogicalScalar(pm_own)){
ret = SWIG_ERROR;
} else {
if(own) *own = mxIsLogicalScalarTrue(pm_own);
}
if(pm_own) mxDestroyArray(pm_own);

return ret;
}

0 comments on commit bdf2960

Please sign in to comment.