14#include <peak_icv_c/backend/peak_icv_dll_defines.h>
15#include <peak_icv_c/library/peak_icv_library.h>
16#include <peak_icv_c/types/peak_icv_simple_types.h>
29template <
class CallableType>
32 const auto errorCode = callableObject();
33 if (errorCode != PEAK_ICV_STATUS_SUCCESS)
35 throw Exception(
"Could not query the last error!", PEAK_ICV_STATUS_INTERNAL_ERROR);
41 size_t lastErrorDescriptionSize{};
43 return PEAK_ICV_C_ABI_PREFIX peak_icv_GetLastErrorMessage_GetCount(&lastErrorDescriptionSize);
46 std::vector<char> lastErrorDescription(lastErrorDescriptionSize);
48 return PEAK_ICV_C_ABI_PREFIX peak_icv_GetLastErrorMessage(lastErrorDescription.data(), lastErrorDescriptionSize);
51 return { lastErrorDescription.data() };
55template <
class CallableType>
58 const auto errorCode = callableObject();
59 if (errorCode != PEAK_ICV_STATUS_SUCCESS)
65 case PEAK_ICV_STATUS_LIBRARY_NOT_INITIALIZED:
66 case PEAK_ICV_STATUS_DYNAMIC_DEPENDENCY_MISSING:
69 case PEAK_ICV_STATUS_NULL_POINTER:
72 case PEAK_ICV_STATUS_MISMATCH:
75 case PEAK_ICV_STATUS_NOT_SUPPORTED:
78 case PEAK_ICV_STATUS_NOT_POSSIBLE:
81 case PEAK_ICV_STATUS_OUT_OF_RANGE:
84 case PEAK_ICV_STATUS_MATH_ERROR:
87 case PEAK_ICV_STATUS_TARGET_NOT_FOUND:
90 case PEAK_ICV_STATUS_CORRUPTED:
93 case PEAK_ICV_STATUS_IO_ERROR:
96 case PEAK_ICV_STATUS_INTERNAL_ERROR:
97 case PEAK_ICV_STATUS_INVALID_BUFFER_SIZE:
98 case PEAK_ICV_STATUS_INVALID_HANDLE:
102 throw Exception(
"Generic Error!", errorCode);
Occurs when reading from a file or stream that is incomplete, damaged, or in an unexpected format.
Base class for all exceptions thrown by the IDS peak ICV library.
Occurs when a file operation fails (e.g., missing file, insufficient permissions, or inaccessible dir...
Occurs when a failure happens during processing due to an unhandled internal routine condition.
Occurs when a required dependency is missing, the library is not initialized, or a misconfiguration a...
Occurs when a mathematical computation fails (e.g., division by zero or invalid matrix operations).
Occurs when input parameters do not match expected conditions (e.g., two input images have different ...
Occurs when an operation cannot be performed due to logical constraints (e.g., camera calibration wit...
Occurs when a requested operation is not implemented or supported (e.g., exporting to an unsupported ...
Occurs when attempting to access an object or value via an uninitialized or null pointer.
Occurs when a provided value falls outside the allowed valid range.
Occurs when an expected target object (e.g., calibration plate or marker) is not detected in the inpu...
void ExecuteAndMapReturnCodesLight(const CallableType &callableObject)
std::string GetLastError()
void ExecuteAndMapReturnCodes(const CallableType &callableObject)