mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-22 09:37:59 +02:00
WIP
This commit is contained in:
@ -207,80 +207,4 @@ class qDefs : public QWidget {
|
||||
return Message(qDefs::WARNING, message + std::string("\nCaught exception:\n") + exceptionMessage, source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap around to ignore non critical exceptions
|
||||
*/
|
||||
template <class CT> struct NonDeduced { using type = CT; };
|
||||
|
||||
// only executing multiSlsDetector function
|
||||
template <typename RT, typename... CT>
|
||||
static void IgnoreNonCriticalExceptions(multiSlsDetector* det,
|
||||
const std::string message, const std::string source,
|
||||
RT (multiSlsDetector::*somefunc)(CT...),
|
||||
typename NonDeduced<CT>::type... Args) {
|
||||
try {
|
||||
((det->*somefunc)(Args...));
|
||||
}
|
||||
// catch them here as they are not critical
|
||||
catch (const sls::NonCriticalError &e) {
|
||||
ExceptionMessage(message, e.what(), source);
|
||||
}
|
||||
};
|
||||
|
||||
// executing multiSlsDetector funtion and using return value to set QWidget function
|
||||
template <class W, typename WRT, typename RT, typename... CT>
|
||||
static void IgnoreNonCriticalExceptions(multiSlsDetector* det,
|
||||
const std::string message, const std::string source,
|
||||
W* wid, void (W::*someQfunc)(WRT),
|
||||
RT (multiSlsDetector::*somefunc)(CT...),
|
||||
typename NonDeduced<CT>::type... Args) {
|
||||
try {
|
||||
auto val = ((det->*somefunc)(Args...));
|
||||
(wid->*someQfunc)(static_cast<RT>(val));
|
||||
}
|
||||
// catch them here as they are not critical
|
||||
catch (const sls::NonCriticalError &e) {
|
||||
ExceptionMessage(message, e.what(), source);
|
||||
}
|
||||
};
|
||||
|
||||
// executing multiSlsDetector funtion and using return value to set QWidget function
|
||||
// (handling -1 for comboboxes)
|
||||
/*template <class W, typename WRT, typename RT, typename... CT>
|
||||
static void IgnoreNonCriticalExceptionsandMinus1(multiSlsDetector* det,
|
||||
const std::string message, const std::string source,
|
||||
W* wid, void (W::*someQfunc)(WRT),
|
||||
RT (multiSlsDetector::*somefunc)(CT...),
|
||||
typename NonDeduced<CT>::type... Args) {
|
||||
try {
|
||||
int val = static_cast<int>((det->*somefunc)(Args...));
|
||||
if (val == -1) {
|
||||
Message(qDefs::WARNING, message + std::string(" is inconsistent for all detectors\n"), source);
|
||||
} else {
|
||||
(wid->*someQfunc)(val);
|
||||
}
|
||||
}
|
||||
// catch them here as they are not critical
|
||||
catch (const sls::NonCriticalError &e) {
|
||||
ExceptionMessage(message, e.what(), source);
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
// executing multiSlsDetector funtion and returning its value (integers, where value cannot be -1)
|
||||
/* can easily get out of hand
|
||||
template <typename RT, typename... CT>
|
||||
static RT IgnoreNonCriticalExceptionsandReturn(
|
||||
multiSlsDetector* det, const std::string loc,
|
||||
RT (multiSlsDetector::*somefunc)(CT...),
|
||||
typename NonDeduced<CT>::type... Args) {
|
||||
try {
|
||||
return ((det->*somefunc)(Args...));
|
||||
}
|
||||
// catch them here as they are not critical
|
||||
catch (const sls::NonCriticalError &e) {
|
||||
Message(qDefs::WARNING, e.what(), loc);
|
||||
return static_cast<RT>(-1);
|
||||
}
|
||||
};*/
|
||||
};
|
||||
|
Reference in New Issue
Block a user