Skip to content

Commit

Permalink
cosmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
ptahmose committed Oct 17, 2024
1 parent 6d8d0d8 commit 4d9a211
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 148 deletions.
2 changes: 1 addition & 1 deletion OctaveOct/notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ cd D:\dev\MyGitHub\MEXlibCZI\OctaveOct

mkoctfile --mex octavelibczi.c

octlvlibczi('GetVersion')
octavelibczi('GetVersion')
4 changes: 0 additions & 4 deletions lib/src/functions/func_addsubblock.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#include "func_addsubblock.h"
//#include "libraryInfo.h"
#include "../implementation/CziWriterManager.h"
#include <limits>
#include <memory>
#include <optional>

#include "../implementation/argsutils.h"
#include "../implementation/dbgprint.h"
//#include "mexapi.h"
#include "../implementation/utils.h"

using namespace std;
Expand Down
3 changes: 2 additions & 1 deletion lib/src/functions/func_close.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include "func_close.h"
#include "../implementation/CziReaderManager.h"
#include <stdexcept>
#include "../implementation/argsutils.h"
#include "../implementation/dbgprint.h"

#include <stdexcept>

using namespace std;

void MexFunction_Close_CheckArguments(MatlabArgs* args)
Expand Down
6 changes: 2 additions & 4 deletions lib/src/functions/func_closecziwriter.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#include "func_open.h"
//#include "libraryInfo.h"
//#include <vector>
#include <memory>

#include "../implementation/CziWriterManager.h"
#include "../implementation/dbgprint.h"
//#include "mexapi.h"
#include "../implementation/utils.h"

#include <memory>

using namespace std;


Expand Down
2 changes: 1 addition & 1 deletion lib/src/functions/func_createcziwriter.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "func_open.h"
//#include "libraryInfo.h"
#include "../implementation/CziWriterManager.h"

#include <vector>
#include <memory>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "func_getmultichannelscalingtilecomposite.h"
#include "../implementation/CziReaderManager.h"
#include <vector>
#include <memory>
#include "../implementation/argsutils.h"
#include "../implementation/utils.h"
Expand Down
10 changes: 2 additions & 8 deletions lib/src/functions/func_getversion.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#include "func_getversion.h"
//#include <stdexcept>
//#include "libraryInfo.h"
//#include <vector>
//#include "argsutils.h"
//#include "CziReaderManager.h"
//#include "utils.h"
#include "../implementation/libraryinfo.h"
#include <vector>
#include "../implementation/libraryinfo.h"

using namespace std;

Expand Down Expand Up @@ -36,7 +30,7 @@ void MexFunction_GetVersion_Execute(MatlabArgs* args)
2,
_1_by_1,
static_cast<int>(keys.size()),
&fieldNamesRawStrings[0]);
fieldNamesRawStrings.data());

for (int i = 0; i < static_cast<int>(keys.size()); ++i)
{
Expand Down
93 changes: 14 additions & 79 deletions lib/src/implementation/CziReader.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/src/implementation/CziUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ bool ChannelDisplaySettingsValidity::Get(Property prop) const
{
libCZI::DisplaySettingsPOD dsPod;

// we create "default channel-display-settings", and the apply the information provided with "partialDs"
// we create "default channel-display-settings", and then apply the information provided with "partialDs"
for (auto it = partialDs.cbegin(); it != partialDs.cend(); ++it)
{
ChannelDisplaySettingsPOD channelDisplaySettings;
Expand Down
10 changes: 6 additions & 4 deletions lib/src/implementation/argsutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ class MexArray;
class CArgsUtils
{
public:
/// Information about a Matlab array. We are only interested in max. 3-dimensional arrays
/// at this time, that's why we have a fixed-size array for the dimensions.
struct ArrayInfo
{
static constexpr size_t kMaxDimensions = 3;
AppExtensionClassId class_id;
std::uint8_t number_of_dimensions;
std::array<size_t, kMaxDimensions> dimensions;
void* data;
AppExtensionClassId class_id; ///< This identifies the data-type of the elements.
std::uint8_t number_of_dimensions; ///< Number of dimensions - can be expected to be less than or equal to kMaxDimensions.
std::array<size_t, kMaxDimensions> dimensions; ///< The size of each dimension.
void* data; ///< Pointer to the data.
};

static std::string GetAsUtf8String(const Parameter pArr, IAppExtensionFunctions* app_functions);
Expand Down
15 changes: 1 addition & 14 deletions lib/src/implementation/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <cstdarg>
#include "CziReaderManager.h"
#include "CziWriterManager.h"
//#include "mexapi.h"
#include <app_api.h>
#include "dbgprint.h"
#if _WIN32
Expand Down Expand Up @@ -257,29 +256,23 @@ class Converters

/*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);
//float* ptr = MexApi::GetInstance().MxGetSingles(m);
float* ptr = app_functions->pfn_GetSingles(m);
*ptr = v;
return m;
}

/*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);
//double* ptr = MexApi::GetInstance().MxGetDoubles(m);
double* ptr = app_functions->pfn_GetDoubles(m);
*ptr = MexUtils::CoerceValueDbl(v, app_functions);
return m;
}

/*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);
//double* ptr = MexApi::GetInstance().MxGetDoubles(m);
double* ptr = app_functions->pfn_GetDoubles(m);
va_list list;
va_start(list, count);
Expand All @@ -296,19 +289,15 @@ class Converters

/*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);
//int* ptr = MexApi::GetInstance().MxGetInt32s(m);
int* ptr = app_functions->pfn_GetInt32s(m);
*ptr = v;
return m;
}

/*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);
//bool* ptr = MexApi::GetInstance().MxGetLogicals(m);
bool* ptr = app_functions->pfn_GetLogicals(m);
*ptr = b;
return m;
Expand All @@ -318,12 +307,10 @@ class Converters
{
if (isnan(d))
{
//return MexApi::GetInstance().GetDblNan();
return app_functions->pfn_GetNaNDouble();
}
else if (isinf(d))
{
//return MexApi::GetInstance().GetDblInf();
return app_functions->pfn_GetInfDouble();
}
else
Expand Down Expand Up @@ -372,4 +359,4 @@ libCZI::BitmapLockInfo Bitmap::Lock()
void Bitmap::Unlock()
{
// nothing to do
}
}
1 change: 0 additions & 1 deletion lib/src/implementation/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <cstdint>
#include "CziReader.h"
#include "CziWriter.h"
//#include "mexapi.h"
#include <app_api.h>
#include "argsutils.h"

Expand Down
1 change: 0 additions & 1 deletion libmexlibczi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
set(libmexlibcziSourceFiles
"DllMain.cpp"
"exportedfunctions.cpp"
)

Expand Down
27 changes: 0 additions & 27 deletions libmexlibczi/DllMain.cpp

This file was deleted.

0 comments on commit 4d9a211

Please sign in to comment.