Skip to content
Snippets Groups Projects
Commit 45299536 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Cxx/gtPlaceSubVol: safer dealing with matlab volumes

parent dd9cea3b
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,14 @@ ...@@ -10,6 +10,14 @@
#include "mex.h" #include "mex.h"
extern "C"
{
bool mxUnshareArray(mxArray *array_ptr, bool noDeepCopy);
mxArray *mxCreateSharedCopy(const mxArray *pr);
mxArray *mxCreateSharedDataCopy(const mxArray *pr);
mxArray *mxUnreference(const mxArray *pr);
}
template<typename Type> template<typename Type>
class GtMatlabPointer { class GtMatlabPointer {
const mwSize multiplier; const mwSize multiplier;
......
...@@ -74,7 +74,7 @@ void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] ) ...@@ -74,7 +74,7 @@ void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] )
/* -- No assert on correctness of parameters -- */ /* -- No assert on correctness of parameters -- */
/* Don't copy, just modify the incoming matrix */ /* Don't copy, just modify the incoming matrix */
plhs[0] = (mxArray *) prhs[0]; plhs[0] = mxCreateSharedDataCopy(prhs[0]);
switch(mxGetClassID(prhs[1])) { switch(mxGetClassID(prhs[1])) {
case mxDOUBLE_CLASS: { case mxDOUBLE_CLASS: {
......
...@@ -75,7 +75,7 @@ void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] ) ...@@ -75,7 +75,7 @@ void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] )
/* -- No assert on correctness of parameters -- */ /* -- No assert on correctness of parameters -- */
/* Don't copy, just modify the incoming matrix */ /* Don't copy, just modify the incoming matrix */
plhs[0] = (mxArray *) prhs[0]; plhs[0] = mxCreateSharedDataCopy(prhs[0]);
switch(mxGetClassID(prhs[1])) { switch(mxGetClassID(prhs[1])) {
case mxDOUBLE_CLASS: { case mxDOUBLE_CLASS: {
......
...@@ -73,7 +73,7 @@ void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] ) ...@@ -73,7 +73,7 @@ void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] )
/* -- No assert on correctness of parameters -- */ /* -- No assert on correctness of parameters -- */
/* Don't copy, just modify the incoming matrix */ /* Don't copy, just modify the incoming matrix */
plhs[0] = (mxArray *) prhs[0]; plhs[0] = mxCreateSharedDataCopy(prhs[0]);
switch(mxGetClassID(prhs[1])) { switch(mxGetClassID(prhs[1])) {
case mxDOUBLE_CLASS: { case mxDOUBLE_CLASS: {
......
...@@ -83,7 +83,7 @@ void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] ) ...@@ -83,7 +83,7 @@ void mexFunction( int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] )
/* -- No assert on correctness of parameters -- */ /* -- No assert on correctness of parameters -- */
/* Don't copy, just modify the incoming matrix */ /* Don't copy, just modify the incoming matrix */
plhs[0] = (mxArray *) prhs[0]; plhs[0] = mxCreateSharedDataCopy(prhs[0]);
switch(mxGetClassID(prhs[1])) { switch(mxGetClassID(prhs[1])) {
case mxDOUBLE_CLASS: { case mxDOUBLE_CLASS: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment