CVB++ 14.0
read_result.hpp
1#pragma once
2
3#include "../../_cexports/c_barcode.h"
4#include "../../global.hpp"
5#include "cvb/string.hpp"
6#include "cvb/point_2d.hpp"
7#include "../barcode.hpp"
8
9
10namespace Cvb
11{
12 CVB_BEGIN_INLINE_NS
13
14 namespace Barcode
15 {
16
18
23 {
24 public:
25
27
30 ReadResult(CExports::CVC_BC_INFO& handle)
31 : handle_(handle)
32 {
33 }
34
35 virtual ~ReadResult() {}
36
37
39
43 virtual Cvb::String Text() const noexcept
44 {
45 return text_;
46 }
47
48
50
54 int CharactersRead() const
55 {
56 return static_cast<int>(handle_.char_read);
57 }
58
59
61
65 int DecodeTime() const
66 {
67 return static_cast<int>(handle_.decoding_time);
68 }
69
70
72
77 {
78 if ((handle_.p3_x == 0) && (handle_.p3_y == 0)
79 && (handle_.p4_x == 0) && (handle_.p4_y == 0))
81 Cvb::Point2D<double>(handle_.p1_x, handle_.p1_y),
82 Cvb::Point2D<double>(handle_.p2_x, handle_.p2_y)
83 };
84 else
86 Cvb::Point2D<double>(handle_.p1_x, handle_.p1_y),
87 Cvb::Point2D<double>(handle_.p2_x, handle_.p2_y),
88 Cvb::Point2D<double>(handle_.p3_x, handle_.p3_y),
89 Cvb::Point2D<double>(handle_.p4_x, handle_.p4_y)
90 };
91 }
92
93
95
99 int NumWords() const
100 {
101 return static_cast<int>(handle_.num_digits);
102 }
103
104
106
110 double Resolution() const
111 {
112 return static_cast<double>(handle_.resolution) / 10.0;
113 }
114
115
117
122 {
123 return static_cast<DecodeResult>(handle_.decoding_result);
124 }
125
126
127
129
134 {
135 return static_cast<Symbology>(handle_.type);
136 }
137
138
139
140 protected:
141 CExports::CVC_BC_INFO handle_;
142 Cvb::String text_;
143
144 friend class Reader;
145 };
146
147 }
148
149 CVB_END_INLINE_NS
150}
Base class for reading decoded barcode results.
Definition: read_result.hpp:23
Symbology Type() const
Symbology of the decoded result.
Definition: read_result.hpp:133
int NumWords() const
Contains the number of code words composing the read barcode.
Definition: read_result.hpp:99
virtual Cvb::String Text() const noexcept
The text content of the barcode.
Definition: read_result.hpp:43
int CharactersRead() const
The return value contains the number of characters in the read barcode.
Definition: read_result.hpp:54
double Resolution() const
The resolution specifies the smallest width unit in the code in multiples of a 10th of a pixel.
Definition: read_result.hpp:110
DecodeResult Result() const
Decoding result.
Definition: read_result.hpp:121
std::vector< Cvb::Point2D< double > > Location() const
Location of the barcode inside the image.
Definition: read_result.hpp:76
ReadResult(CExports::CVC_BC_INFO &handle)
Constructor to initialize object from info struct.
Definition: read_result.hpp:30
int DecodeTime() const
The return value specifies the time consumed for decoding in units of ms.
Definition: read_result.hpp:65
The key class for reading barcodes.
Definition: reader.hpp:32
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:97
DecodeResult
Possible barcode reading results.
Definition: barcode.hpp:443
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24