From 8438f0c94b26f6d52e1430cc40b72b7476c7d96c Mon Sep 17 00:00:00 2001 From: Viacheslav Demydiuk Date: Fri, 13 Nov 2020 21:58:56 +0200 Subject: [PATCH] Issue #230: used template method GetNamedParameter in MTConnector.dll --- MTConnector/MTConnector.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/MTConnector/MTConnector.cpp b/MTConnector/MTConnector.cpp index ed41a7b6..607248ea 100755 --- a/MTConnector/MTConnector.cpp +++ b/MTConnector/MTConnector.cpp @@ -37,6 +37,7 @@ template T Execute(std::function func, wchar_t* err, T default catch (Exception^ e) { convertSystemString(err, e->Message); + MtAdapter::GetInstance()->LogError(e->Message); } return result; } @@ -167,20 +168,20 @@ _DLLAPI bool _stdcall getCommandType(int expertHandle, int* res, wchar_t* err) }, err, false); } +// --- index parameters + _DLLAPI bool _stdcall getIntValue(int expertHandle, int paramIndex, int* res, wchar_t* err) { return Execute([&expertHandle, ¶mIndex, res]() { - *res = (int)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex); + *res = MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex); return true; }, err, false); } -// --- index parameters - _DLLAPI bool _stdcall getDoubleValue(int expertHandle, int paramIndex, double* res, wchar_t* err) { return Execute([&expertHandle, ¶mIndex, res]() { - *res = (double)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex); + *res = MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex); return true; }, err, false); } @@ -188,7 +189,7 @@ _DLLAPI bool _stdcall getDoubleValue(int expertHandle, int paramIndex, double* r _DLLAPI bool _stdcall getStringValue(int expertHandle, int paramIndex, wchar_t* res, wchar_t* err) { return Execute([&expertHandle, ¶mIndex, res]() { - convertSystemString(res, (String^)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex)); + convertSystemString(res, MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex)); return true; }, err, false); } @@ -196,7 +197,7 @@ _DLLAPI bool _stdcall getStringValue(int expertHandle, int paramIndex, wchar_t* _DLLAPI bool _stdcall getBooleanValue(int expertHandle, int paramIndex, int* res, wchar_t* err) { return Execute([&expertHandle, ¶mIndex, res]() { - *res = (bool)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex); + *res = MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex); return true; }, err, false); } @@ -204,7 +205,7 @@ _DLLAPI bool _stdcall getBooleanValue(int expertHandle, int paramIndex, int* res _DLLAPI bool _stdcall getLongValue(int expertHandle, int paramIndex, __int64* res, wchar_t* err) { return Execute([&expertHandle, ¶mIndex, res]() { - *res = (__int64)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex); + *res = MtAdapter::GetInstance()->GetCommandParameter<__int64>(expertHandle, paramIndex); return true; }, err, false); }