14#include <peak_icv_c/algorithms/code_reader/peak_icv_code_reader.h>
73 PEAK_COMMON_NO_DISCARD std::string
GetText()
const;
84 friend peak::common::detail::BackendAccessor<CodeReaderResult>;
87 PEAK_COMMON_NO_DISCARD peak_icv_code_reader_result_handle GetHandle()
const override;
88 static peak_icv_code_reader_result_handle createHandle();
89 peak_icv_code_reader_result_handle m_handle;
94 m_handle = std::exchange(other.m_handle,
nullptr);
99 if (m_handle != other.m_handle)
101 if (m_handle !=
nullptr)
104 return PEAK_ICV_C_ABI_PREFIX peak_icv_BarcodeReaderResult_Destroy(m_handle);
108 m_handle = std::exchange(other.m_handle,
nullptr);
118inline peak_icv_code_reader_result_handle CodeReaderResult::GetHandle()
const
123inline peak_icv_code_reader_result_handle CodeReaderResult::createHandle()
125 peak_icv_code_reader_result_handle handle{};
127 return PEAK_ICV_C_ABI_PREFIX peak_icv_BarcodeReaderResult_Create(&handle);
133 : m_handle{ createHandle() }
138 if (m_handle !=
nullptr)
140 std::ignore = PEAK_ICV_C_ABI_PREFIX peak_icv_BarcodeReaderResult_Destroy(m_handle);
146 size_t text_size_in_bytes{};
148 return PEAK_ICV_C_ABI_PREFIX peak_icv_BarcodeReaderResult_GetText_GetSizeInBytes(m_handle, &text_size_in_bytes);
151 std::vector<char> data(text_size_in_bytes);
153 return PEAK_ICV_C_ABI_PREFIX peak_icv_BarcodeReaderResult_GetText(m_handle, data.data(), data.size());
156 return { data.begin(), data.end() - 1 };
161 peak_icv_code_type cType{};
163 return PEAK_ICV_C_ABI_PREFIX peak_icv_BarcodeReaderResult_GetType(m_handle, &cType);
166 return static_cast<CodeType>(cType);
Class that represents a code that was found in an image.
CodeType GetType() const
Provides the type of the code.
std::string GetText() const
Provides the decoded text of the code.
~CodeReaderResult() override
CodeReaderResult & operator=(const CodeReaderResult &other)=delete
CodeReaderResult(const CodeReaderResult &other)=delete
CodeReaderResult()
Creates an empty instance of a code result.
CodeType
Enum that holds the possible code types for detection and identification.
void ExecuteAndMapReturnCodes(const CallableType &callableObject)