3#include "../_decl/decl_result_handle.hpp"
4#include "../_decl/decl_symbology_conversion.hpp"
5#include "../../point_2d.hpp"
6#include "../../size_2d.hpp"
14 inline Cvb::optional<Result2D> ResultHandle::TryCreateResult2D(
size_t i)
const
19 CVCRGetDecoderResultDouble(Handle(), i, CExports::CVCRResultPropertyDouble::CVCRRPF_Width, width))
23 const auto height = Internal::DoResCallValueOut<double>([&](
double &value) {
25 CVCRGetDecoderResultDouble(Handle(), i, CExports::CVCRResultPropertyDouble::CVCRRPF_Height, value));
29 const auto rows = Internal::DoResCallValueOut<int>([&](
int &value) {
31 CVCRGetDecoderResultInt(Handle(), i, CExports::CVCRResultPropertyInt::CVCRRPI_Rows, value));
35 const auto cols = Internal::DoResCallValueOut<int>([&](
int &value) {
37 CVCRGetDecoderResultInt(Handle(), i, CExports::CVCRResultPropertyInt::CVCRRPI_Columns, value));
41 const auto quality = Internal::DoResCallValueOut<int>([&](
int &value) {
43 CVCRGetDecoderResultInt(Handle(), i, CExports::CVCRResultPropertyInt::CVCRRPI_Quality, value));
47 const auto errorCorrectionCodewords = Internal::DoResCallValueOut<int>([&](
int &value) {
48 return CVB_CALL_CAPI(CVCRGetDecoderResultInt(
49 Handle(), i, CExports::CVCRResultPropertyInt::CVCRRPI_ErrorCorrectionCodewords, value));
53 const auto errorCorrectionErasureCodewords = Internal::DoResCallValueOut<int>([&](
int &value) {
54 return CVB_CALL_CAPI(CVCRGetDecoderResultInt(
55 Handle(), i, CExports::CVCRResultPropertyInt::CVCRRPI_ErrorCorrectionErasureCodewords, value));
59 const auto compositeType =
62 CVCRGetDecoderResultInt(Handle(), i, CExports::CVCRResultPropertyInt::CVCRRPI_CompositeType, value));
65 return Result2D(quality, rows, cols, Cvb::Size2D<double>(width, height), errorCorrectionCodewords,
66 errorCorrectionErasureCodewords, compositeType);
72 inline std::vector<Result> ResultHandle::CreateResultVector()
const
75 const auto numSymbolsDetected = Internal::DoResCallValueOut<size_t>(
76 [&](
size_t &value) {
return CVB_CALL_CAPI(CVCRGetDecoderResultCount(Handle(), value)); });
77 auto results = std::vector<Result>(numSymbolsDetected);
79 for (
size_t i = 0; i < numSymbolsDetected; i++)
85 CVB_CALL_CAPI_CHECKED(CVCRGetDecoderResultDataTyped(Handle(), i,
reinterpret_cast<Char *
>(NULL), size));
86 String data(size - 1,
'\0');
87 CVB_CALL_CAPI_CHECKED(CVCRGetDecoderResultDataTyped(Handle(), i, &data[0], size));
91 const auto symbolInt = Internal::DoResCallValueOut<int>([&](
int &value) {
93 CVCRGetDecoderResultInt(Handle(), i, CExports::CVCRResultPropertyInt::CVCRRPI_Symbology, value));
95 const auto isExtendedSymbology = Internal::DoResCallValueOut<int>([&](
int &value) {
96 return CVB_CALL_CAPI(CVCRGetDecoderResultInt(
97 Handle(), i, CExports::CVCRResultPropertyInt::CVCRRPI_IsExtendedSymbology, value));
99 if (isExtendedSymbology == 1)
101 symbology = SymbologyConversion::Convert(
static_cast<CExports::CVCRValueSymbologyEx
>(symbolInt));
105 symbology = SymbologyConversion::Convert(
static_cast<CExports::CVCRValueSymbology
>(symbolInt));
109 const auto decodeStatus =
111 return CVB_CALL_CAPI(
112 CVCRGetDecoderResultInt(Handle(), i, CExports::CVCRResultPropertyInt::CVCRRPI_DecodeStatus, value));
116 Cvb::Point2D<int> center;
117 Internal::DoResCall([&]() {
118 return CVB_CALL_CAPI(
119 CVCRGetDecoderResultCenter(Handle(), i, *
reinterpret_cast<CExports::CVCRPoint *
>(¢er)));
123 std::array<Point2D<int>, 4> corners;
124 Internal::DoResCall([&]() {
125 return CVB_CALL_CAPI(
126 CVCRGetDecoderResultCorners(Handle(), i,
reinterpret_cast<CExports::CVCRPoint *
>(corners.data())));
130 const auto result2D = TryCreateResult2D(i);
131 results[i] = Result(std::move(data), center, std::move(corners), symbology, decodeStatus, result2D);
Namespace for all decoding functionalities.
Definition decl_config_2d_codes.hpp:10
Symbology
Enum class listing all supported symbologies.
Definition decl_config_base.hpp:35
@ Unknown
Unknown symbology.
Definition decl_config_base.hpp:37
CompositeType
Enum class representing the type of composite code.
Definition result.hpp:58
DecodeStatus
Enum class for decoding status.
Definition result.hpp:46
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
char Char
Character type for wide characters or unicode characters.
Definition string.hpp:63
std::string String
String for wide characters or unicode characters.
Definition string.hpp:49