Skip to content

Commit

Permalink
Issue #230: used template method GetNamedParameter in MTConnector.dll
Browse files Browse the repository at this point in the history
  • Loading branch information
vdemydiuk committed Nov 13, 2020
1 parent 80703b1 commit 8438f0c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions MTConnector/MTConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ template <typename T> T Execute(std::function<T()> func, wchar_t* err, T default
catch (Exception^ e)
{
convertSystemString(err, e->Message);
MtAdapter::GetInstance()->LogError(e->Message);
}
return result;
}
Expand Down Expand Up @@ -167,44 +168,44 @@ _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<bool>([&expertHandle, &paramIndex, res]() {
*res = (int)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
*res = MtAdapter::GetInstance()->GetCommandParameter<int>(expertHandle, paramIndex);
return true;
}, err, false);
}

// --- index parameters

_DLLAPI bool _stdcall getDoubleValue(int expertHandle, int paramIndex, double* res, wchar_t* err)
{
return Execute<bool>([&expertHandle, &paramIndex, res]() {
*res = (double)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
*res = MtAdapter::GetInstance()->GetCommandParameter<double>(expertHandle, paramIndex);
return true;
}, err, false);
}

_DLLAPI bool _stdcall getStringValue(int expertHandle, int paramIndex, wchar_t* res, wchar_t* err)
{
return Execute<bool>([&expertHandle, &paramIndex, res]() {
convertSystemString(res, (String^)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex));
convertSystemString(res, MtAdapter::GetInstance()->GetCommandParameter<String^>(expertHandle, paramIndex));
return true;
}, err, false);
}

_DLLAPI bool _stdcall getBooleanValue(int expertHandle, int paramIndex, int* res, wchar_t* err)
{
return Execute<bool>([&expertHandle, &paramIndex, res]() {
*res = (bool)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
*res = MtAdapter::GetInstance()->GetCommandParameter<bool>(expertHandle, paramIndex);
return true;
}, err, false);
}

_DLLAPI bool _stdcall getLongValue(int expertHandle, int paramIndex, __int64* res, wchar_t* err)
{
return Execute<bool>([&expertHandle, &paramIndex, res]() {
*res = (__int64)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
*res = MtAdapter::GetInstance()->GetCommandParameter<__int64>(expertHandle, paramIndex);
return true;
}, err, false);
}
Expand Down

0 comments on commit 8438f0c

Please sign in to comment.