diff --git a/AppModel/include/app_api.h b/AppModel/include/app_api.h index d7aec08..ce7edde 100644 --- a/AppModel/include/app_api.h +++ b/AppModel/include/app_api.h @@ -8,6 +8,8 @@ extern "C" { #include #include + /// This type is representing a "parameter", which is the abstraction of "some object" in Matlab/Octave. + /// With Matlab, it maps to mxArray*. It is to be regarded as an opaque type. typedef void* Parameter; enum AppExtensionClassId @@ -36,65 +38,65 @@ extern "C" { double (*pfn_GetNaNDouble)(void); - void* (*pfn_GetData)(const Parameter* parameter); + void* (*pfn_GetData)(const Parameter parameter); - uint8_t* (*pfn_GetUint8s)(const Parameter* parameter); + uint8_t* (*pfn_GetUint8s)(const Parameter parameter); - int8_t* (*pfn_GetInt8s)(const Parameter* parameter); + int8_t* (*pfn_GetInt8s)(const Parameter parameter); - uint16_t* (*pfn_GetUint16s)(const Parameter* parameter); + uint16_t* (*pfn_GetUint16s)(const Parameter parameter); - int16_t* (*pfn_GetInt16s)(const Parameter* parameter); + int16_t* (*pfn_GetInt16s)(const Parameter parameter); - uint32_t* (*pfn_GetUint32s)(const Parameter* parameter); + uint32_t* (*pfn_GetUint32s)(const Parameter parameter); - int32_t* (*pfn_GetInt32s)(const Parameter* parameter); + int32_t* (*pfn_GetInt32s)(const Parameter parameter); - uint64_t* (*pfn_GetUint64s)(const Parameter* parameter); + uint64_t* (*pfn_GetUint64s)(const Parameter parameter); - int64_t* (*pfn_GetInt64s)(const Parameter* parameter); + int64_t* (*pfn_GetInt64s)(const Parameter parameter); - double* (*pfn_GetDoubles)(const Parameter* parameter); + double* (*pfn_GetDoubles)(const Parameter parameter); - float* (*pfn_GetSingles)(const Parameter* parameter); + float* (*pfn_GetSingles)(const Parameter parameter); - bool* (*pfn_GetLogicals)(const Parameter* parameter); + bool* (*pfn_GetLogicals)(const Parameter parameter); - bool (*pfn_IsNumeric)(const Parameter* parameter); + bool (*pfn_IsNumeric)(const Parameter parameter); - bool (*pfn_IsChar)(const Parameter* parameter); + bool (*pfn_IsChar)(const Parameter parameter); - bool (*pfn_IsSparse)(const Parameter* parameter); + bool (*pfn_IsSparse)(const Parameter parameter); - bool (*pfn_IsStruct)(const Parameter* parameter); + bool (*pfn_IsStruct)(const Parameter parameter); - Parameter* (*pfn_CreateString)(const char* string); + Parameter(*pfn_CreateString)(const char* string); void (*pfn_ReportErrorAndRaiseSignal)(const char* identifier, const char* message); char* (*pfn_StrDupHostAllocated)(const char* string); - Parameter* (*pfn_CreateStructArray)(size_t ndim, const size_t* dims, int nfields, const char** field_names); + Parameter(*pfn_CreateStructArray)(size_t ndim, const size_t* dims, int nfields, const char** field_names); - void (*pfn_SetFieldByNumber)(Parameter* pa, size_t i, int fieldnum, Parameter* value); + void (*pfn_SetFieldByNumber)(Parameter pa, size_t i, int fieldnum, Parameter value); - char* (*pfn_ConvertToUTF8String)(const Parameter* parameter); + char* (*pfn_ConvertToUTF8String)(const Parameter parameter); void (*pfn_Free)(void* ptr); - Parameter* (*pfn_CreateNumericMatrixReal)(size_t m, size_t n, enum AppExtensionClassId class_id); + Parameter(*pfn_CreateNumericMatrixReal)(size_t m, size_t n, enum AppExtensionClassId class_id); - enum AppExtensionClassId(*pfn_GetClassId)(const Parameter* parameter); + enum AppExtensionClassId(*pfn_GetClassId)(const Parameter parameter); - size_t (*pfn_GetNumberOfElements)(const Parameter* parameter); + size_t(*pfn_GetNumberOfElements)(const Parameter parameter); - size_t (*pfn_GetNumberOfDimensions)(const Parameter* parameter); + size_t(*pfn_GetNumberOfDimensions)(const Parameter parameter); - void (*pfn_GetSizeOfDimensions)(const Parameter* parameter, size_t number_of_dimension, size_t* sizes); + void (*pfn_GetSizeOfDimensions)(const Parameter parameter, size_t number_of_dimension, size_t* sizes); - Parameter* (*pfn_GetField)(const Parameter* parameter, const char* field_name); + Parameter(*pfn_GetField)(const Parameter parameter, const char* field_name); - Parameter* (*pfn_CreateNumericArrayReal)(size_t ndim, const size_t* dims, enum AppExtensionClassId class_id); + Parameter(*pfn_CreateNumericArrayReal)(size_t ndim, const size_t* dims, enum AppExtensionClassId class_id); }; #ifdef __cplusplus diff --git a/MatlabMex/app_api_implementation.c b/MatlabMex/app_api_implementation.c index 77f8e98..5d0a283 100644 --- a/MatlabMex/app_api_implementation.c +++ b/MatlabMex/app_api_implementation.c @@ -22,89 +22,89 @@ double matlabMexGetNaNDouble(void) return mxGetNaN(); } -void* matlabMexGetData(const Parameter* parameter) +void* matlabMexGetData(const Parameter parameter) { return mxGetData((const mxArray*)parameter); } -uint8_t* matlabMexGetUint8s(const Parameter* parameter) +uint8_t* matlabMexGetUint8s(const Parameter parameter) { return mxGetUint8s((const mxArray*)parameter); } -int8_t* matlabMexGetInt8s(const Parameter* parameter) +int8_t* matlabMexGetInt8s(const Parameter parameter) { return mxGetInt8s((const mxArray*)parameter); } -uint16_t* matlabMexGetUint16s(const Parameter* parameter) +uint16_t* matlabMexGetUint16s(const Parameter parameter) { return mxGetUint16s((const mxArray*)parameter); } -int16_t* matlabMexGetInt16s(const Parameter* parameter) +int16_t* matlabMexGetInt16s(const Parameter parameter) { return mxGetInt16s((const mxArray*)parameter); } -uint32_t* matlabMexGetUint32s(const Parameter* parameter) +uint32_t* matlabMexGetUint32s(const Parameter parameter) { return mxGetUint32s((const mxArray*)parameter); } -int32_t* matlabMexGetInt32s(const Parameter* parameter) +int32_t* matlabMexGetInt32s(const Parameter parameter) { return mxGetInt32s((const mxArray*)parameter); } -uint64_t* matlabMexGetUint64s(const Parameter* parameter) +uint64_t* matlabMexGetUint64s(const Parameter parameter) { return mxGetUint64s((const mxArray*)parameter); } -int64_t* matlabMexGetInt64s(const Parameter* parameter) +int64_t* matlabMexGetInt64s(const Parameter parameter) { return mxGetInt64s((const mxArray*)parameter); } -double* matlabMexGetDoubles(const Parameter* parameter) +double* matlabMexGetDoubles(const Parameter parameter) { return mxGetDoubles((const mxArray*)parameter); } -float* matlabMexGetSingles(const Parameter* parameter) +float* matlabMexGetSingles(const Parameter parameter) { return mxGetSingles((const mxArray*)parameter); } -bool* matlabMexGetLogicals(const Parameter* parameter) +bool* matlabMexGetLogicals(const Parameter parameter) { return mxGetLogicals((const mxArray*)parameter); } -bool matlabMexIsNumeric(const Parameter* parameter) +bool matlabMexIsNumeric(const Parameter parameter) { return mxIsNumeric((const mxArray*)parameter); } -bool matlabMexIsChar(const Parameter* parameter) +bool matlabMexIsChar(const Parameter parameter) { return mxIsChar((const mxArray*)parameter); } -bool matlabMexIsSparse(const Parameter* parameter) +bool matlabMexIsSparse(const Parameter parameter) { return mxIsSparse((const mxArray*)parameter); } -bool matlabMexIsStruct(const Parameter* parameter) +bool matlabMexIsStruct(const Parameter parameter) { return mxIsStruct((const mxArray*)parameter); } -Parameter* matlabMexCreateString(const char* string) +Parameter matlabMexCreateString(const char* string) { - return (Parameter*)mxCreateString(string); + return (Parameter)mxCreateString(string); } void matlabReportErrorAndRaiseSignal(const char* identifier, const char* message) @@ -121,17 +121,17 @@ char* matlabStrDupHostAllocated(const char* string) return msz; } -Parameter* matlabCreateStructArray(size_t ndim, const size_t* dims, int nfields, const char** field_names) +Parameter matlabCreateStructArray(size_t ndim, const size_t* dims, int nfields, const char** field_names) { - return (Parameter*)mxCreateStructArray(ndim, dims, nfields, field_names); + return (Parameter)mxCreateStructArray(ndim, dims, nfields, field_names); } -void matlabSetFieldByNumber(Parameter* pa, size_t i, int fieldnum, Parameter* value) +void matlabSetFieldByNumber(Parameter pa, size_t i, int fieldnum, Parameter value) { mxSetFieldByNumber((mxArray*)pa, i, fieldnum, (mxArray*)value); } -char* matlabConvertToUTF8String(const Parameter* parameter) +char* matlabConvertToUTF8String(const Parameter parameter) { return mxArrayToUTF8String((const mxArray*)parameter); } @@ -172,13 +172,13 @@ mxClassID AppExtensionClassIdToMxClassId(enum AppExtensionClassId class_id) } } -Parameter* matlabCreateNumericMatrixReal(size_t m, size_t n, enum AppExtensionClassId class_id) +Parameter matlabCreateNumericMatrixReal(size_t m, size_t n, enum AppExtensionClassId class_id) { mxClassID mx_class_id = AppExtensionClassIdToMxClassId(class_id); - return (Parameter*)mxCreateNumericMatrix(m, n, mx_class_id, mxREAL); + return (Parameter)mxCreateNumericMatrix(m, n, mx_class_id, mxREAL); } -enum AppExtensionClassId matlabGetClassId(const Parameter* parameter) +enum AppExtensionClassId matlabGetClassId(const Parameter parameter) { mxClassID mx_class_id = mxGetClassID((const mxArray*)parameter); switch (mx_class_id) @@ -210,17 +210,17 @@ enum AppExtensionClassId matlabGetClassId(const Parameter* parameter) } } -size_t matlabGetNumberOfElements(const Parameter* parameter) +size_t matlabGetNumberOfElements(const Parameter parameter) { return mxGetNumberOfElements((const mxArray*)parameter); } -size_t matlabGetNumberOfDimensions(const Parameter* parameter) +size_t matlabGetNumberOfDimensions(const Parameter parameter) { return mxGetNumberOfDimensions((const mxArray*)parameter); } -void matlabGetSizeOfDimensions(const Parameter* parameter, size_t number_of_dimension, size_t* sizes) +void matlabGetSizeOfDimensions(const Parameter parameter, size_t number_of_dimension, size_t* sizes) { const size_t* ptr_sizes = mxGetDimensions((const mxArray*)parameter); for (size_t i = 0; i < number_of_dimension; ++i) @@ -229,20 +229,20 @@ void matlabGetSizeOfDimensions(const Parameter* parameter, size_t number_of_dime } } -Parameter* matlabGetField(const Parameter* parameter, const char* field_name) +Parameter matlabGetField(const Parameter parameter, const char* field_name) { if (!matlabMexIsStruct(parameter)) { return NULL; } - return (Parameter*)mxGetField((const mxArray*)parameter, 0, field_name); + return (Parameter)mxGetField((const mxArray*)parameter, 0, field_name); } -Parameter* matlabCreateNumericArrayReal(size_t ndim, const size_t* dims, enum AppExtensionClassId class_id) +Parameter matlabCreateNumericArrayReal(size_t ndim, const size_t* dims, enum AppExtensionClassId class_id) { mxClassID mx_class_id = AppExtensionClassIdToMxClassId(class_id); - return (Parameter*)mxCreateNumericArray(ndim, dims, mx_class_id, mxREAL); + return (Parameter)mxCreateNumericArray(ndim, dims, mx_class_id, mxREAL); } struct IAppExtensionFunctions g_appExtensionFunctions = diff --git a/MatlabMex/mex_function.cpp b/MatlabMex/mex_function.cpp index 7f83186..f6e0c78 100644 --- a/MatlabMex/mex_function.cpp +++ b/MatlabMex/mex_function.cpp @@ -18,5 +18,5 @@ void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) gIsInitialized = true; } - mexlibCZI::mexFunction(nlhs, reinterpret_cast(plhs), nrhs, reinterpret_cast(prhs), &g_appExtensionFunctions); + mexlibCZI::mexFunction(nlhs, reinterpret_cast(plhs), nrhs, (const Parameter*)prhs, &g_appExtensionFunctions); } diff --git a/OctaveOct/octavelibczi.c b/OctaveOct/octavelibczi.c index fb6d066..559deb5 100644 --- a/OctaveOct/octavelibczi.c +++ b/OctaveOct/octavelibczi.c @@ -24,89 +24,89 @@ static double matlabMexGetNaNDouble(void) return mxGetNaN(); } -static void* matlabMexGetData(const Parameter* parameter) +static void* matlabMexGetData(const Parameter parameter) { return mxGetData((const mxArray*)parameter); } -static uint8_t* matlabMexGetUint8s(const Parameter* parameter) +static uint8_t* matlabMexGetUint8s(const Parameter parameter) { return mxGetUint8s((const mxArray*)parameter); } -static int8_t* matlabMexGetInt8s(const Parameter* parameter) +static int8_t* matlabMexGetInt8s(const Parameter parameter) { return mxGetInt8s((const mxArray*)parameter); } -static uint16_t* matlabMexGetUint16s(const Parameter* parameter) +static uint16_t* matlabMexGetUint16s(const Parameter parameter) { return mxGetUint16s((const mxArray*)parameter); } -static int16_t* matlabMexGetInt16s(const Parameter* parameter) +static int16_t* matlabMexGetInt16s(const Parameter parameter) { return mxGetInt16s((const mxArray*)parameter); } -static uint32_t* matlabMexGetUint32s(const Parameter* parameter) +static uint32_t* matlabMexGetUint32s(const Parameter parameter) { return mxGetUint32s((const mxArray*)parameter); } -static int32_t* matlabMexGetInt32s(const Parameter* parameter) +static int32_t* matlabMexGetInt32s(const Parameter parameter) { return mxGetInt32s((const mxArray*)parameter); } -static uint64_t* matlabMexGetUint64s(const Parameter* parameter) +static uint64_t* matlabMexGetUint64s(const Parameter parameter) { return mxGetUint64s((const mxArray*)parameter); } -static int64_t* matlabMexGetInt64s(const Parameter* parameter) +static int64_t* matlabMexGetInt64s(const Parameter parameter) { return mxGetInt64s((const mxArray*)parameter); } -static double* matlabMexGetDoubles(const Parameter* parameter) +static double* matlabMexGetDoubles(const Parameter parameter) { return mxGetDoubles((const mxArray*)parameter); } -static float* matlabMexGetSingles(const Parameter* parameter) +static float* matlabMexGetSingles(const Parameter parameter) { return mxGetSingles((const mxArray*)parameter); } -static bool* matlabMexGetLogicals(const Parameter* parameter) +static bool* matlabMexGetLogicals(const Parameter parameter) { return (bool*)mxGetLogicals((const mxArray*)parameter); } -static bool matlabMexIsNumeric(const Parameter* parameter) +static bool matlabMexIsNumeric(const Parameter parameter) { return mxIsNumeric((const mxArray*)parameter); } -static bool matlabMexIsChar(const Parameter* parameter) +static bool matlabMexIsChar(const Parameter parameter) { return mxIsChar((const mxArray*)parameter); } -static bool matlabMexIsSparse(const Parameter* parameter) +static bool matlabMexIsSparse(const Parameter parameter) { return mxIsSparse((const mxArray*)parameter); } -static bool matlabMexIsStruct(const Parameter* parameter) +static bool matlabMexIsStruct(const Parameter parameter) { return mxIsStruct((const mxArray*)parameter); } -static Parameter* matlabMexCreateString(const char* string) +static Parameter matlabMexCreateString(const char* string) { - return (Parameter*)mxCreateString(string); + return (Parameter)mxCreateString(string); } static void matlabReportErrorAndRaiseSignal(const char* identifier, const char* message) @@ -123,17 +123,17 @@ static char* matlabStrDupHostAllocated(const char* string) return msz; } -static Parameter* matlabCreateStructArray(size_t ndim, const size_t* dims, int nfields, const char** field_names) +static Parameter matlabCreateStructArray(size_t ndim, const size_t* dims, int nfields, const char** field_names) { - return (Parameter*)mxCreateStructArray(ndim, dims, nfields, field_names); + return (Parameter)mxCreateStructArray(ndim, dims, nfields, field_names); } -static void matlabSetFieldByNumber(Parameter* pa, size_t i, int fieldnum, Parameter* value) +static void matlabSetFieldByNumber(Parameter pa, size_t i, int fieldnum, Parameter value) { mxSetFieldByNumber((mxArray*)pa, i, fieldnum, (mxArray*)value); } -static char* matlabConvertToUTF8String(const Parameter* parameter) +static char* matlabConvertToUTF8String(const Parameter parameter) { //return mxArrayToUTF8String((const mxArray*)parameter); return mxArrayToString((const mxArray*)parameter); @@ -175,13 +175,13 @@ static mxClassID AppExtensionClassIdToMxClassId(enum AppExtensionClassId class_i } } -static Parameter* matlabCreateNumericMatrixReal(size_t m, size_t n, enum AppExtensionClassId class_id) +static Parameter matlabCreateNumericMatrixReal(size_t m, size_t n, enum AppExtensionClassId class_id) { mxClassID mx_class_id = AppExtensionClassIdToMxClassId(class_id); - return (Parameter*)mxCreateNumericMatrix(m, n, mx_class_id, mxREAL); + return (Parameter)mxCreateNumericMatrix(m, n, mx_class_id, mxREAL); } -static enum AppExtensionClassId matlabGetClassId(const Parameter* parameter) +static enum AppExtensionClassId matlabGetClassId(const Parameter parameter) { mxClassID mx_class_id = mxGetClassID((const mxArray*)parameter); switch (mx_class_id) @@ -213,17 +213,17 @@ static enum AppExtensionClassId matlabGetClassId(const Parameter* parameter) } } -static size_t matlabGetNumberOfElements(const Parameter* parameter) +static size_t matlabGetNumberOfElements(const Parameter parameter) { return mxGetNumberOfElements((const mxArray*)parameter); } -static size_t matlabGetNumberOfDimensions(const Parameter* parameter) +static size_t matlabGetNumberOfDimensions(const Parameter parameter) { return mxGetNumberOfDimensions((const mxArray*)parameter); } -static void matlabGetSizeOfDimensions(const Parameter* parameter, size_t number_of_dimension, size_t* sizes) +static void matlabGetSizeOfDimensions(const Parameter parameter, size_t number_of_dimension, size_t* sizes) { const size_t* ptr_sizes = mxGetDimensions((const mxArray*)parameter); for (size_t i = 0; i < number_of_dimension; ++i) @@ -232,20 +232,20 @@ static void matlabGetSizeOfDimensions(const Parameter* parameter, size_t number_ } } -static Parameter* matlabGetField(const Parameter* parameter, const char* field_name) +static Parameter matlabGetField(const Parameter parameter, const char* field_name) { if (!matlabMexIsStruct(parameter)) { return NULL; } - return (Parameter*)mxGetField((const mxArray*)parameter, 0, field_name); + return (Parameter)mxGetField((const mxArray*)parameter, 0, field_name); } -static Parameter* matlabCreateNumericArrayReal(size_t ndim, const size_t* dims, enum AppExtensionClassId class_id) +static Parameter matlabCreateNumericArrayReal(size_t ndim, const size_t* dims, enum AppExtensionClassId class_id) { mxClassID mx_class_id = AppExtensionClassIdToMxClassId(class_id); - return (Parameter*)mxCreateNumericArray(ndim, dims, mx_class_id, mxREAL); + return (Parameter)mxCreateNumericArray(ndim, dims, mx_class_id, mxREAL); } static struct IAppExtensionFunctions g_appExtensionFunctions = @@ -306,14 +306,14 @@ static bool gIsInitialized = false; static void(*pfn_OnShutdown)(void); static void(*pfn_OnInitialize)(void); -static void(*pfn_mexFunction)(int nlhs, Parameter* plhs[], int nrhs, const Parameter* prhs[], struct IAppExtensionFunctions* app_functions); +static void(*pfn_mexFunction)(int nlhs, Parameter plhs[], int nrhs, const Parameter prhs[], struct IAppExtensionFunctions* app_functions); static void Initialize() { HMODULE hModule = LoadLibraryW(L"libmexlibczi.dll"); pfn_OnInitialize = (void(__cdecl*)())GetProcAddress(hModule, "OnInitialize"); pfn_OnShutdown = (void(__cdecl*)())GetProcAddress(hModule, "OnShutdown"); - pfn_mexFunction = (void(__cdecl*)(int, Parameter * [], int, const Parameter * [], struct IAppExtensionFunctions*))GetProcAddress(hModule, "mexFunction"); + pfn_mexFunction = (void(__cdecl*)(int, Parameter[], int, const Parameter[], struct IAppExtensionFunctions*))GetProcAddress(hModule, "mexFunction"); pfn_OnInitialize(); mexAtExit(pfn_OnShutdown); @@ -344,5 +344,5 @@ void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) } - pfn_mexFunction(nlhs, (Parameter**)(plhs), nrhs, (const Parameter**)(prhs), &g_appExtensionFunctions); + pfn_mexFunction(nlhs, (Parameter*)(plhs), nrhs, (const Parameter*)(prhs), &g_appExtensionFunctions); } diff --git a/lib/include/function.h b/lib/include/function.h index 2a65e6c..67ae0ab 100644 --- a/lib/include/function.h +++ b/lib/include/function.h @@ -4,7 +4,7 @@ namespace mexlibCZI { - void mexFunction(int nlhs, Parameter* plhs[], int nrhs, const Parameter* prhs[], IAppExtensionFunctions* app_functions); + void mexFunction(int nlhs, Parameter plhs[], int nrhs, const Parameter prhs[], IAppExtensionFunctions* app_functions); void OnInitialize(); diff --git a/lib/src/function.cpp b/lib/src/function.cpp index 0194c1d..7b39db0 100644 --- a/lib/src/function.cpp +++ b/lib/src/function.cpp @@ -11,7 +11,7 @@ using namespace mexlibCZI; using namespace std; -void mexlibCZI::mexFunction(int nlhs, Parameter* plhs[], int nrhs, const Parameter* prhs[], IAppExtensionFunctions* app_functions) +void mexlibCZI::mexFunction(int nlhs, Parameter plhs[], int nrhs, const Parameter prhs[], IAppExtensionFunctions* app_functions) { if (nrhs < 1) { diff --git a/lib/src/functions/func_getversion.cpp b/lib/src/functions/func_getversion.cpp index 757e834..8c8d5c5 100644 --- a/lib/src/functions/func_getversion.cpp +++ b/lib/src/functions/func_getversion.cpp @@ -32,7 +32,7 @@ void MexFunction_GetVersion_Execute(MatlabArgs* args) } static constexpr size_t _1_by_1[2] = { 1, 1 }; - auto* s = args->app_functions->pfn_CreateStructArray( + Parameter s = args->app_functions->pfn_CreateStructArray( 2, _1_by_1, static_cast(keys.size()), diff --git a/lib/src/implementation/CziReader.cpp b/lib/src/implementation/CziReader.cpp index f4803c5..5c37bb8 100644 --- a/lib/src/implementation/CziReader.cpp +++ b/lib/src/implementation/CziReader.cpp @@ -29,14 +29,14 @@ std::array CziReader::GetScaling() }; } -Parameter* CziReader::GetScalingAsMatlabStruct(IAppExtensionFunctions* app_functions) +Parameter CziReader::GetScalingAsMatlabStruct(IAppExtensionFunctions* app_functions) { static const char* fieldNames[] = { "scaleX", "scaleY", "scaleZ" }; static const size_t dims[2] = { 1, 1 }; //auto mexApi = MexApi::GetInstance(); //auto* s = mexApi.MxCreateStructArray( - auto* s = app_functions->pfn_CreateStructArray( + Parameter s = app_functions->pfn_CreateStructArray( 2, dims, sizeof(fieldNames) / sizeof(fieldNames[0]), @@ -72,7 +72,7 @@ void CziReader::InitializeInfoFromCzi() }); } -Parameter* CziReader::GetInfo(IAppExtensionFunctions* app_functions) +Parameter CziReader::GetInfo(IAppExtensionFunctions* app_functions) { auto statistics = this->reader->GetStatistics(); @@ -112,20 +112,20 @@ std::string CziReader::GetMetadataXml() return m->GetXml(); } -Parameter* CziReader::GetMetadataXmlAsMxArray(IAppExtensionFunctions* app_functions) +Parameter CziReader::GetMetadataXmlAsMxArray(IAppExtensionFunctions* app_functions) { //auto s = MexApi::GetInstance().MxCreateString(this->GetMetadataXml().c_str()); auto s = app_functions->pfn_CreateString(this->GetMetadataXml().c_str()); return s; } -Parameter* CziReader::GetDefaultDisplaySettingsAsMxArray(IAppExtensionFunctions* app_functions) +Parameter CziReader::GetDefaultDisplaySettingsAsMxArray(IAppExtensionFunctions* app_functions) { const auto displaySettings = this->GetDisplaySettingsFromCzi(); return CziReader::ConvertToMatlabStruct(*displaySettings, app_functions); } -Parameter* CziReader::GetSubBlockImage(int sbBlkNo, IAppExtensionFunctions* app_functions) +Parameter CziReader::GetSubBlockImage(int sbBlkNo, IAppExtensionFunctions* app_functions) { auto sbBlk = this->reader->ReadSubBlock(sbBlkNo); if (!sbBlk) @@ -139,7 +139,7 @@ Parameter* CziReader::GetSubBlockImage(int sbBlkNo, IAppExtensionFunctions* app_ return ConvertToMxArray(bm.get(), app_functions); } -Parameter* CziReader::GetMultiChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const char* displaySettingsJson, IAppExtensionFunctions* app_functions) +Parameter CziReader::GetMultiChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const char* displaySettingsJson, IAppExtensionFunctions* app_functions) { if (displaySettingsJson == nullptr || *displaySettingsJson == '\0') { @@ -162,7 +162,7 @@ Parameter* CziReader::GetMultiChannelScalingTileComposite(const libCZI::IntRect& } } -Parameter* CziReader::GetMultiChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const libCZI::IDisplaySettings* displaySettings, IAppExtensionFunctions* app_functions) +Parameter CziReader::GetMultiChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const libCZI::IDisplaySettings* displaySettings, IAppExtensionFunctions* app_functions) { std::vector activeChannels = libCZI::CDisplaySettingsHelper::GetActiveChannels(displaySettings); @@ -221,7 +221,7 @@ Parameter* CziReader::GetMultiChannelScalingTileComposite(const libCZI::IntRect& return arr; } -Parameter* CziReader::GetMultiChannelScalingTileCompositeAllChannelsDisabled(const libCZI::IntRect& roi, float zoom, IAppExtensionFunctions* app_functions) +Parameter CziReader::GetMultiChannelScalingTileCompositeAllChannelsDisabled(const libCZI::IntRect& roi, float zoom, IAppExtensionFunctions* app_functions) { auto accessor = reader->CreateSingleChannelScalingTileAccessor(); const auto sizeResult = accessor->CalcSize(roi, zoom); @@ -234,13 +234,13 @@ Parameter* CziReader::GetMultiChannelScalingTileCompositeAllChannelsDisabled(con return arr; } -Parameter* CziReader::GetSingleChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, IAppExtensionFunctions* app_functions) +Parameter CziReader::GetSingleChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, IAppExtensionFunctions* app_functions) { const RgbFloatColor backgndCol{ 0,0,0 }; return this->GetSingleChannelScalingTileComposite(roi, planeCoordinate, zoom, backgndCol, app_functions); } -Parameter* CziReader::GetSingleChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const libCZI::RgbFloatColor& backgroundColor, IAppExtensionFunctions* app_functions) +Parameter CziReader::GetSingleChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const libCZI::RgbFloatColor& backgroundColor, IAppExtensionFunctions* app_functions) { auto scsta = this->reader->CreateSingleChannelScalingTileAccessor(); libCZI::IntSize size = scsta->CalcSize(roi, zoom); @@ -273,7 +273,7 @@ std::shared_ptr CziReader::GetDisplaySettingsFromCzi() return this->displaySettingsFromCzi; } -/*static*/Parameter* CziReader::ConvertToMxArray(libCZI::IBitmapData* bitmapData, IAppExtensionFunctions* app_functions) +/*static*/Parameter CziReader::ConvertToMxArray(libCZI::IBitmapData* bitmapData, IAppExtensionFunctions* app_functions) { //auto mexApi = MexApi::GetInstance(); switch (bitmapData->GetPixelType()) @@ -425,7 +425,7 @@ std::shared_ptr CziReader::GetDisplaySettingsFromCzi() } } -/*static*/Parameter* CziReader::ConvertToMatlabStruct(const libCZI::IDimBounds* bounds, IAppExtensionFunctions* app_functions) +/*static*/Parameter CziReader::ConvertToMatlabStruct(const libCZI::IDimBounds* bounds, IAppExtensionFunctions* app_functions) { vector dimensions; for (auto i = (std::underlying_type::type)(libCZI::DimensionIndex::MinDim); i <= (std::underlying_type::type)(libCZI::DimensionIndex::MaxDim); ++i) @@ -467,7 +467,7 @@ std::shared_ptr CziReader::GetDisplaySettingsFromCzi() return s; } -/*static*/Parameter* CziReader::ConvertToMatlabStruct(const std::map& boundingBoxMap, IAppExtensionFunctions* app_functions) +/*static*/Parameter CziReader::ConvertToMatlabStruct(const std::map& boundingBoxMap, IAppExtensionFunctions* app_functions) { static const char* fieldNames[] = { "sceneIndex", "boundingBox", "boundingBoxLayer0" }; size_t dims[2] = { 1, boundingBoxMap.size() }; @@ -490,7 +490,7 @@ std::shared_ptr CziReader::GetDisplaySettingsFromCzi() return s; } -/*static*/ Parameter* CziReader::ConvertToMatlabStruct(const libCZI::IntRect& rect, IAppExtensionFunctions* app_functions) +/*static*/ Parameter CziReader::ConvertToMatlabStruct(const libCZI::IntRect& rect, IAppExtensionFunctions* app_functions) { //auto mexApi = MexApi::GetInstance(); //auto* m = mexApi.MxCreateNumericMatrix(1, 4, mxINT32_CLASS, mxREAL); @@ -504,7 +504,7 @@ std::shared_ptr CziReader::GetDisplaySettingsFromCzi() return m; } -/*static*/ Parameter* CziReader::ConvertToMatlabStruct(const libCZI::IntSize& size, IAppExtensionFunctions* app_functions) +/*static*/ Parameter CziReader::ConvertToMatlabStruct(const libCZI::IntSize& size, IAppExtensionFunctions* app_functions) { //auto mexApi = MexApi::GetInstance(); //auto* m = mexApi.MxCreateNumericMatrix(1, 2, mxINT32_CLASS, mxREAL); @@ -516,7 +516,7 @@ std::shared_ptr CziReader::GetDisplaySettingsFromCzi() return m; } -/*static*/ Parameter* CziReader::ConvertToMatlabStruct(const libCZI::IDisplaySettings& ds, IAppExtensionFunctions* app_functions) +/*static*/ Parameter CziReader::ConvertToMatlabStruct(const libCZI::IDisplaySettings& ds, IAppExtensionFunctions* app_functions) { static const char* tintingModesNone = "none"; static const char* tintingModesColor = "color"; @@ -627,7 +627,7 @@ std::shared_ptr CziReader::GetDisplaySettingsFromCzi() return s; } -Parameter* CziReader::ReadSubBlock(int no, IAppExtensionFunctions* app_functions) +Parameter CziReader::ReadSubBlock(int no, IAppExtensionFunctions* app_functions) { auto sbBlk = this->reader->ReadSubBlock(no); if (!sbBlk) @@ -641,7 +641,7 @@ Parameter* CziReader::ReadSubBlock(int no, IAppExtensionFunctions* app_functions return MexUtils::Int32To1x1Matrix(h, app_functions); } -Parameter* CziReader::GetInfoFromSubBlock(int subBlkHandle, IAppExtensionFunctions* app_functions) +Parameter CziReader::GetInfoFromSubBlock(int subBlkHandle, IAppExtensionFunctions* app_functions) { auto sbBlk = this->sbBlkStore.GetForHandle(subBlkHandle); if (!sbBlk) @@ -655,7 +655,7 @@ Parameter* CziReader::GetInfoFromSubBlock(int subBlkHandle, IAppExtensionFunctio return CziReader::ConvertToMatlabStruct(sbInfo, app_functions); } -Parameter* CziReader::GetMetadataFromSubBlock(int subBlkHandle, IAppExtensionFunctions* app_functions) +Parameter CziReader::GetMetadataFromSubBlock(int subBlkHandle, IAppExtensionFunctions* app_functions) { auto sbBlk = this->sbBlkStore.GetForHandle(subBlkHandle); if (!sbBlk) @@ -679,7 +679,7 @@ Parameter* CziReader::GetMetadataFromSubBlock(int subBlkHandle, IAppExtensionFun return app_functions->pfn_CreateString(metadataXml.c_str()); } -Parameter* CziReader::GetBitmapFromSubBlock(int subBlkHandle, IAppExtensionFunctions* app_functions) +Parameter CziReader::GetBitmapFromSubBlock(int subBlkHandle, IAppExtensionFunctions* app_functions) { auto sbBlk = this->sbBlkStore.GetForHandle(subBlkHandle); if (!sbBlk) @@ -698,7 +698,7 @@ bool CziReader::ReleaseSubBlock(int subBlkHandle) return this->sbBlkStore.RemoveSubBlock(subBlkHandle); } -/*static*/Parameter* CziReader::ConvertToMatlabStruct(const libCZI::SubBlockInfo& sbBlkInfo, IAppExtensionFunctions* app_functions) +/*static*/Parameter CziReader::ConvertToMatlabStruct(const libCZI::SubBlockInfo& sbBlkInfo, IAppExtensionFunctions* app_functions) { //auto mexApi = MexApi::GetInstance(); array fieldNames = { "Mode", "Pixeltype", "Coordinate", "LogicalRect", "PhysicalSize", "MIndex", "Zoom" }; diff --git a/lib/src/implementation/CziReader.h b/lib/src/implementation/CziReader.h index bba6e7b..500ab18 100644 --- a/lib/src/implementation/CziReader.h +++ b/lib/src/implementation/CziReader.h @@ -25,42 +25,42 @@ class CziReader void Open(const std::string& utf8_filename); - Parameter* GetInfo(IAppExtensionFunctions* app_functions); + Parameter GetInfo(IAppExtensionFunctions* app_functions); std::string GetMetadataXml(); - Parameter* GetMetadataXmlAsMxArray(IAppExtensionFunctions* app_functions); + Parameter GetMetadataXmlAsMxArray(IAppExtensionFunctions* app_functions); - Parameter* GetDefaultDisplaySettingsAsMxArray(IAppExtensionFunctions* app_functions); + Parameter GetDefaultDisplaySettingsAsMxArray(IAppExtensionFunctions* app_functions); - Parameter* GetSubBlockImage(int sbBlkNo, IAppExtensionFunctions* app_functions); - Parameter* GetMultiChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const char* displaySettingsJson, IAppExtensionFunctions* app_functions); - Parameter* GetSingleChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, IAppExtensionFunctions* app_functions); - Parameter* GetSingleChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const libCZI::RgbFloatColor& backgroundColor, IAppExtensionFunctions* app_functions); + Parameter GetSubBlockImage(int sbBlkNo, IAppExtensionFunctions* app_functions); + Parameter GetMultiChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const char* displaySettingsJson, IAppExtensionFunctions* app_functions); + Parameter GetSingleChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, IAppExtensionFunctions* app_functions); + Parameter GetSingleChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const libCZI::RgbFloatColor& backgroundColor, IAppExtensionFunctions* app_functions); std::array GetScaling(); - Parameter* GetScalingAsMatlabStruct(IAppExtensionFunctions* app_functions); + Parameter GetScalingAsMatlabStruct(IAppExtensionFunctions* app_functions); - Parameter* ReadSubBlock(int no, IAppExtensionFunctions* app_functions); - Parameter* GetInfoFromSubBlock(int subBlkHandle, IAppExtensionFunctions* app_functions); - Parameter* GetMetadataFromSubBlock(int subBlkHandle, IAppExtensionFunctions* app_functions); - Parameter* GetBitmapFromSubBlock(int subBlkHandle, IAppExtensionFunctions* app_functions); + Parameter ReadSubBlock(int no, IAppExtensionFunctions* app_functions); + Parameter GetInfoFromSubBlock(int subBlkHandle, IAppExtensionFunctions* app_functions); + Parameter GetMetadataFromSubBlock(int subBlkHandle, IAppExtensionFunctions* app_functions); + Parameter GetBitmapFromSubBlock(int subBlkHandle, IAppExtensionFunctions* app_functions); bool ReleaseSubBlock(int subBlkHandle); private: - static Parameter* ConvertToMatlabStruct(const libCZI::IDimBounds* bounds, IAppExtensionFunctions* app_functions); + static Parameter ConvertToMatlabStruct(const libCZI::IDimBounds* bounds, IAppExtensionFunctions* app_functions); /// Initializes the members "displaySettingsFromCzi" and "scalingInfoFromCzi". void InitializeInfoFromCzi(); std::shared_ptr GetDisplaySettingsFromCzi(); const libCZI::ScalingInfo& GetScalingInfoFromCzi(); - Parameter* GetMultiChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const libCZI::IDisplaySettings* displaySettings, IAppExtensionFunctions* app_functions); - Parameter* GetMultiChannelScalingTileCompositeAllChannelsDisabled(const libCZI::IntRect& roi, float zoom, IAppExtensionFunctions* app_functions); + Parameter GetMultiChannelScalingTileComposite(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, float zoom, const libCZI::IDisplaySettings* displaySettings, IAppExtensionFunctions* app_functions); + Parameter GetMultiChannelScalingTileCompositeAllChannelsDisabled(const libCZI::IntRect& roi, float zoom, IAppExtensionFunctions* app_functions); - static Parameter* ConvertToMxArray(libCZI::IBitmapData* bitmapData, IAppExtensionFunctions* app_functions); - static Parameter* ConvertToMatlabStruct(const std::map& boundingBoxMap, IAppExtensionFunctions* app_functions); - static Parameter* ConvertToMatlabStruct(const libCZI::IntRect& rect, IAppExtensionFunctions* app_functions); - static Parameter* ConvertToMatlabStruct(const libCZI::IntSize& size, IAppExtensionFunctions* app_functions); - static Parameter* ConvertToMatlabStruct(const libCZI::IDisplaySettings& ds, IAppExtensionFunctions* app_functions); - static Parameter* ConvertToMatlabStruct(const libCZI::SubBlockInfo& sbBlkInfo, IAppExtensionFunctions* app_functions); + static Parameter ConvertToMxArray(libCZI::IBitmapData* bitmapData, IAppExtensionFunctions* app_functions); + static Parameter ConvertToMatlabStruct(const std::map& boundingBoxMap, IAppExtensionFunctions* app_functions); + static Parameter ConvertToMatlabStruct(const libCZI::IntRect& rect, IAppExtensionFunctions* app_functions); + static Parameter ConvertToMatlabStruct(const libCZI::IntSize& size, IAppExtensionFunctions* app_functions); + static Parameter ConvertToMatlabStruct(const libCZI::IDisplaySettings& ds, IAppExtensionFunctions* app_functions); + static Parameter ConvertToMatlabStruct(const libCZI::SubBlockInfo& sbBlkInfo, IAppExtensionFunctions* app_functions); static void CopyTransposeGray8(libCZI::IBitmapData* bitmapData, void* pDst, size_t lineLength); static void CopyTransposeGray16(libCZI::IBitmapData* bitmapData, void* pDst, size_t lineLength); diff --git a/lib/src/implementation/argsutils.cpp b/lib/src/implementation/argsutils.cpp index d0efbe1..04943a5 100644 --- a/lib/src/implementation/argsutils.cpp +++ b/lib/src/implementation/argsutils.cpp @@ -6,7 +6,7 @@ using namespace std; using namespace libCZI; -/*static*/std::string CArgsUtils::GetAsUtf8String(const Parameter* pArr, IAppExtensionFunctions* app_functions) +/*static*/std::string CArgsUtils::GetAsUtf8String(const Parameter pArr, IAppExtensionFunctions* app_functions) { if (!app_functions->pfn_IsChar(pArr)) { @@ -19,7 +19,7 @@ using namespace libCZI; return argStr; } -/*static*/bool CArgsUtils::TryGetInt32(const Parameter* pArr, std::int32_t* ptr, IAppExtensionFunctions* app_functions) +/*static*/bool CArgsUtils::TryGetInt32(const Parameter pArr, std::int32_t* ptr, IAppExtensionFunctions* app_functions) { //const mxClassID id = MexApi::GetInstance().MxGetClassID(pArr); const AppExtensionClassId id = app_functions->pfn_GetClassId(pArr); @@ -135,7 +135,7 @@ using namespace libCZI; return true; } -/*static*/bool CArgsUtils::TryGetInt32(const Parameter* pArr, size_t index, std::int32_t* ptr, IAppExtensionFunctions* app_functions) +/*static*/bool CArgsUtils::TryGetInt32(const Parameter pArr, size_t index, std::int32_t* ptr, IAppExtensionFunctions* app_functions) { //size_t numOfElements = MexApi::GetInstance().MxGetNumberOfElements(pArr); size_t numOfElements = app_functions->pfn_GetNumberOfElements(pArr); @@ -260,12 +260,12 @@ using namespace libCZI; return true; } -/*static*/bool CArgsUtils::TryGetSingle(const Parameter* pArr, float* ptr, IAppExtensionFunctions* app_functions) +/*static*/bool CArgsUtils::TryGetSingle(const Parameter pArr, float* ptr, IAppExtensionFunctions* app_functions) { return CArgsUtils::TryGetSingle(pArr, 0, ptr, app_functions); } -/*static*/bool CArgsUtils::TryGetSingle(const Parameter* pArr, size_t index, float* ptr, IAppExtensionFunctions* app_functions) +/*static*/bool CArgsUtils::TryGetSingle(const Parameter pArr, size_t index, float* ptr, IAppExtensionFunctions* app_functions) { //size_t numOfElements = MexApi::GetInstance().MxGetNumberOfElements(pArr); size_t numOfElements = app_functions->pfn_GetNumberOfElements(pArr); @@ -380,7 +380,7 @@ using namespace libCZI; return true; } -/*static*/bool CArgsUtils::IsNumericArrayOfMinSize(const Parameter* pArr, size_t minElementCount, IAppExtensionFunctions* app_functions) +/*static*/bool CArgsUtils::IsNumericArrayOfMinSize(const Parameter pArr, size_t minElementCount, IAppExtensionFunctions* app_functions) { //auto mexApi = MexApi::GetInstance(); //const mxClassID id = mexApi.MxGetClassID(pArr); @@ -404,14 +404,14 @@ using namespace libCZI; return numOfElements >= minElementCount; } -/*static*/bool CArgsUtils::IsStructure(const Parameter* pArr, IAppExtensionFunctions* app_functions) +/*static*/bool CArgsUtils::IsStructure(const Parameter pArr, IAppExtensionFunctions* app_functions) { return app_functions->pfn_IsStruct(pArr); /*auto mexApi = MexApi::GetInstance(); return mexApi.MxIsStruct(pArr);*/ } -/*static*/bool CArgsUtils::TryGetIntRect(const Parameter* pArr, libCZI::IntRect* rect, IAppExtensionFunctions* app_functions) +/*static*/bool CArgsUtils::TryGetIntRect(const Parameter pArr, libCZI::IntRect* rect, IAppExtensionFunctions* app_functions) { IntRect r; r.Invalidate(); @@ -436,7 +436,7 @@ using namespace libCZI; return true; } -/*static*/bool CArgsUtils::TryGetDimCoordinate(const Parameter* pArr, libCZI::CDimCoordinate* coord, IAppExtensionFunctions* app_functions) +/*static*/bool CArgsUtils::TryGetDimCoordinate(const Parameter pArr, libCZI::CDimCoordinate* coord, IAppExtensionFunctions* app_functions) { string argStr; if (!CArgsUtils::TryGetString(pArr, &argStr, app_functions)) @@ -466,7 +466,7 @@ using namespace libCZI; return true; } -/*static*/bool CArgsUtils::TryGetString(const Parameter* pArr, std::string* str, IAppExtensionFunctions* app_functions) +/*static*/bool CArgsUtils::TryGetString(const Parameter pArr, std::string* str, IAppExtensionFunctions* app_functions) { //auto mexApi = MexApi::GetInstance(); //if (!mexApi.MxIsChar(pArr)) @@ -486,7 +486,7 @@ using namespace libCZI; return true; } -/*static*/bool CArgsUtils::TryGetArrayInfo(const Parameter* pArr, ArrayInfo* array_info, IAppExtensionFunctions* app_functions) +/*static*/bool CArgsUtils::TryGetArrayInfo(const Parameter pArr, ArrayInfo* array_info, IAppExtensionFunctions* app_functions) { //auto mexApi = MexApi::GetInstance(); //if (!mexApi.MxIsNumeric(pArr)) @@ -559,7 +559,7 @@ using namespace libCZI; return true;*/ } -/*static*/bool CArgsUtils::TryGetPixelType(const Parameter* argument, libCZI::PixelType* pixel_type, IAppExtensionFunctions* app_functions) +/*static*/bool CArgsUtils::TryGetPixelType(const Parameter argument, libCZI::PixelType* pixel_type, IAppExtensionFunctions* app_functions) { string string_argument; if (CArgsUtils::TryGetString(argument, &string_argument, app_functions)) @@ -612,7 +612,7 @@ using namespace libCZI; return false; } -/*static*/bool CArgsUtils::TryGetIntValueOfField(const Parameter* argument, const char* field_name, std::int32_t* int_value, IAppExtensionFunctions* app_functions) +/*static*/bool CArgsUtils::TryGetIntValueOfField(const Parameter argument, const char* field_name, std::int32_t* int_value, IAppExtensionFunctions* app_functions) { //auto mexApi = MexApi::GetInstance(); //const auto field = mexApi.MxGetField(argument, field_name); @@ -625,7 +625,7 @@ using namespace libCZI; return CArgsUtils::TryGetInt32(field, int_value, app_functions); } -/*static*/bool CArgsUtils::TryGetStringValueOfField(const Parameter* argument, const char* field_name, std::string* str, IAppExtensionFunctions* app_functions) +/*static*/bool CArgsUtils::TryGetStringValueOfField(const Parameter argument, const char* field_name, std::string* str, IAppExtensionFunctions* app_functions) { /*auto mexApi = MexApi::GetInstance(); const auto field = mexApi.MxGetField(argument, field_name);*/ @@ -636,4 +636,4 @@ using namespace libCZI; } return CArgsUtils::TryGetString(field, str, app_functions); -} \ No newline at end of file +} diff --git a/lib/src/implementation/argsutils.h b/lib/src/implementation/argsutils.h index 15a2209..d68e050 100644 --- a/lib/src/implementation/argsutils.h +++ b/lib/src/implementation/argsutils.h @@ -19,24 +19,24 @@ class CArgsUtils void* data; }; - static std::string GetAsUtf8String(const Parameter* pArr, IAppExtensionFunctions* app_functions); + static std::string GetAsUtf8String(const Parameter pArr, IAppExtensionFunctions* app_functions); - static bool TryGetInt32(const Parameter* pArr, std::int32_t* ptr, IAppExtensionFunctions* app_functions); - static bool TryGetInt32(const Parameter* pArr, size_t index, std::int32_t* ptr, IAppExtensionFunctions* app_functions); + static bool TryGetInt32(const Parameter pArr, std::int32_t* ptr, IAppExtensionFunctions* app_functions); + static bool TryGetInt32(const Parameter pArr, size_t index, std::int32_t* ptr, IAppExtensionFunctions* app_functions); - static bool TryGetSingle(const Parameter* pArr, float* ptr, IAppExtensionFunctions* app_functions); - static bool TryGetSingle(const Parameter* pArr, size_t index, float* ptr, IAppExtensionFunctions* app_functions); + static bool TryGetSingle(const Parameter pArr, float* ptr, IAppExtensionFunctions* app_functions); + static bool TryGetSingle(const Parameter pArr, size_t index, float* ptr, IAppExtensionFunctions* app_functions); - static bool IsNumericArrayOfMinSize(const Parameter* pArr, size_t minElementCount, IAppExtensionFunctions* app_functions); - static bool IsStructure(const Parameter* pArr, IAppExtensionFunctions* app_functions); + static bool IsNumericArrayOfMinSize(const Parameter pArr, size_t minElementCount, IAppExtensionFunctions* app_functions); + static bool IsStructure(const Parameter pArr, IAppExtensionFunctions* app_functions); - static bool TryGetIntRect(const Parameter* pArr, libCZI::IntRect* rect, IAppExtensionFunctions* app_functions); + static bool TryGetIntRect(const Parameter pArr, libCZI::IntRect* rect, IAppExtensionFunctions* app_functions); - static bool TryGetDimCoordinate(const Parameter* pArr, libCZI::CDimCoordinate* coord, IAppExtensionFunctions* app_functions); + static bool TryGetDimCoordinate(const Parameter pArr, libCZI::CDimCoordinate* coord, IAppExtensionFunctions* app_functions); - static bool TryGetArrayInfo(const Parameter* pArr, ArrayInfo* array_info, IAppExtensionFunctions* app_functions); + static bool TryGetArrayInfo(const Parameter pArr, ArrayInfo* array_info, IAppExtensionFunctions* app_functions); - static bool TryGetString(const Parameter* pArr, std::string* str, IAppExtensionFunctions* app_functions); + static bool TryGetString(const Parameter pArr, std::string* str, IAppExtensionFunctions* app_functions); /// Attempts to interpret the given mxArray as a pixel type. /// It can be either a string or a scalar integer. @@ -45,9 +45,9 @@ class CArgsUtils /// \param [out] pixel_type If non-null and successful, the pixel type is put here. /// /// \returns True if it succeeds; false otherwise. - static bool TryGetPixelType(const Parameter* argument, libCZI::PixelType* pixel_type, IAppExtensionFunctions* app_functions); + static bool TryGetPixelType(const Parameter argument, libCZI::PixelType* pixel_type, IAppExtensionFunctions* app_functions); - static bool TryGetIntValueOfField(const Parameter* argument, const char* field_name, std::int32_t* int_value, IAppExtensionFunctions* app_functions); + static bool TryGetIntValueOfField(const Parameter argument, const char* field_name, std::int32_t* int_value, IAppExtensionFunctions* app_functions); - static bool TryGetStringValueOfField(const Parameter* argument, const char* field_name, std::string* str, IAppExtensionFunctions* app_functions); + static bool TryGetStringValueOfField(const Parameter argument, const char* field_name, std::string* str, IAppExtensionFunctions* app_functions); }; diff --git a/lib/src/implementation/utils.cpp b/lib/src/implementation/utils.cpp index b7139c9..97cd895 100644 --- a/lib/src/implementation/utils.cpp +++ b/lib/src/implementation/utils.cpp @@ -255,7 +255,7 @@ class Converters /*static*/size_t MexUtils::Dims_1_by_1[2] = { 1, 1 }; -/*static*/Parameter* MexUtils::FloatTo1x1Matrix(float v, IAppExtensionFunctions* app_functions) +/*static*/Parameter MexUtils::FloatTo1x1Matrix(float v, IAppExtensionFunctions* app_functions) { //auto m = MexApi::GetInstance().MxCreateNumericMatrix(1, 1, mxSINGLE_CLASS, mxREAL); auto m = app_functions->pfn_CreateNumericMatrixReal(1, 1, AppExtensionClassId_Single); @@ -265,7 +265,7 @@ class Converters return m; } -/*static*/Parameter* MexUtils::DoubleTo1x1Matrix(double v, IAppExtensionFunctions* app_functions) +/*static*/Parameter MexUtils::DoubleTo1x1Matrix(double v, IAppExtensionFunctions* app_functions) { //auto m = MexApi::GetInstance().MxCreateNumericMatrix(1, 1, mxDOUBLE_CLASS, mxREAL); auto m = app_functions->pfn_CreateNumericMatrixReal(1, 1, AppExtensionClassId_Double); @@ -275,7 +275,7 @@ class Converters return m; } -/*static*/Parameter* MexUtils::DoublesAsNx1Matrix(IAppExtensionFunctions* app_functions, int count, ...) +/*static*/Parameter MexUtils::DoublesAsNx1Matrix(IAppExtensionFunctions* app_functions, int count, ...) { //auto m = MexApi::GetInstance().MxCreateNumericMatrix(count, 1, mxDOUBLE_CLASS, mxREAL); auto m = app_functions->pfn_CreateNumericMatrixReal(count, 1, AppExtensionClassId_Double); @@ -294,7 +294,7 @@ class Converters return m; } -/*static*/Parameter* MexUtils::Int32To1x1Matrix(int v, IAppExtensionFunctions* app_functions) +/*static*/Parameter MexUtils::Int32To1x1Matrix(int v, IAppExtensionFunctions* app_functions) { //auto* m = MexApi::GetInstance().MxCreateNumericMatrix(1, 1, mxINT32_CLASS, mxREAL); auto* m = app_functions->pfn_CreateNumericMatrixReal(1, 1, AppExtensionClassId_Int32); @@ -304,7 +304,7 @@ class Converters return m; } -/*static*/Parameter* MexUtils::BooleanTo1x1Matrix(bool b, IAppExtensionFunctions* app_functions) +/*static*/Parameter MexUtils::BooleanTo1x1Matrix(bool b, IAppExtensionFunctions* app_functions) { //auto* m = MexApi::GetInstance().MxCreateNumericMatrix(1, 1, mxLOGICAL_CLASS, mxREAL); auto* m = app_functions->pfn_CreateNumericMatrixReal(1, 1, AppExtensionClassId_Logical); diff --git a/lib/src/implementation/utils.h b/lib/src/implementation/utils.h index 93fc8ae..e6a6469 100644 --- a/lib/src/implementation/utils.h +++ b/lib/src/implementation/utils.h @@ -27,11 +27,11 @@ class MexUtils { public: static size_t Dims_1_by_1[2]; - static Parameter* FloatTo1x1Matrix(float v, IAppExtensionFunctions* app_functions); - static Parameter* DoubleTo1x1Matrix(double v, IAppExtensionFunctions* app_functions); - static Parameter* Int32To1x1Matrix(int v, IAppExtensionFunctions* app_functions); - static Parameter* BooleanTo1x1Matrix(bool b, IAppExtensionFunctions* app_functions); - static Parameter* DoublesAsNx1Matrix(IAppExtensionFunctions* app_functions, int count, ...); + static Parameter FloatTo1x1Matrix(float v, IAppExtensionFunctions* app_functions); + static Parameter DoubleTo1x1Matrix(double v, IAppExtensionFunctions* app_functions); + static Parameter Int32To1x1Matrix(int v, IAppExtensionFunctions* app_functions); + static Parameter BooleanTo1x1Matrix(bool b, IAppExtensionFunctions* app_functions); + static Parameter DoublesAsNx1Matrix(IAppExtensionFunctions* app_functions, int count, ...); private: static double CoerceValueDbl(double d, IAppExtensionFunctions* app_functions); }; diff --git a/lib/src/mexFunctions.h b/lib/src/mexFunctions.h index 5ce6a69..c1d364e 100644 --- a/lib/src/mexFunctions.h +++ b/lib/src/mexFunctions.h @@ -5,9 +5,9 @@ struct MatlabArgs { int nlhs; - /*mxArray*/Parameter** plhs; + /*mxArray*/Parameter* plhs; int nrhs; - const /*mxArray*/Parameter** prhs; + const /*mxArray*/Parameter* prhs; IAppExtensionFunctions* app_functions; }; diff --git a/libmexlibczi/exportedfunctions.cpp b/libmexlibczi/exportedfunctions.cpp index c8e0571..02dd50a 100644 --- a/libmexlibczi/exportedfunctions.cpp +++ b/libmexlibczi/exportedfunctions.cpp @@ -1,11 +1,11 @@ #include -extern "C" __declspec(dllexport) void mexFunction(int nlhs, Parameter* plhs[], int nrhs, const Parameter* prhs[], IAppExtensionFunctions* app_functions) +extern "C" __declspec(dllexport) void mexFunction(int nlhs, Parameter plhs[], int nrhs, const Parameter prhs[], IAppExtensionFunctions* app_functions) { - mexlibCZI::mexFunction(nlhs, reinterpret_cast(plhs), nrhs, reinterpret_cast(prhs), app_functions); + mexlibCZI::mexFunction(nlhs, plhs, nrhs, prhs, app_functions); } -extern "C" __declspec(dllexport) void OnInitialize() +extern "C" __declspec(dllexport) void OnInitialize() { mexlibCZI::OnInitialize(); }