CVB++ 14.0
code11.hpp
1#pragma once
2
3#include "reader_common_1d_config_base.hpp"
4
5namespace Cvb
6{
7 CVB_BEGIN_INLINE_NS
8
9 namespace Barcode
10 {
11 using namespace Internal;
12
14
17 {
18public:
19
21
27 {
28 if(checkDigit_ != checkDigit)
29 SetDirty();
30 checkDigit_ = checkDigit;
31 }
32
34
40 {
41 return checkDigit_;
42 };
43
44
45
46 protected:
47 Code11CheckDigit checkDigit_;
48
49
50 public:
51 virtual Symbology Type() const override { return Symbology::Code11; };
52
54
60 static std::unique_ptr<Code11> FromHandle(const HandleGuard<ReaderConfig>& guard, bool& isActiveOut)
61 {
62 auto pConfig = std::unique_ptr<Code11>(new Code11());
63 isActiveOut = pConfig->ReadFromHandle(guard);
64 return pConfig;
65 }
66
67 protected:
68 virtual bool ReadFromHandle_(const HandleGuard<ReaderConfig>& guard) override
69 {
70 CExports::cvbbool_t active;
71 short tmpCheckDigit;
72 CVB_CALL_CAPI(CvcBcGetCode11(reinterpret_cast<std::intptr_t>(guard.Handle()),
73 &active,
74 &minDigits_,
75 &maxDigits_,
76 checkQuietzone_.Ptr(),
77 &tmpCheckDigit,
78 transmitCheckDigit_.Ptr(),
79 inverse_.Ptr()
80 ));
81 checkDigit_ = static_cast<Code11CheckDigit>(tmpCheckDigit);
82 return SmartBool(active);
83 }
84
85 virtual void WriteToHandle_(bool active, HandleGuard<ReaderConfig>& guard) override
86 {
87 Internal::DoResCall([&]()
88 {
89 return CVB_CALL_CAPI(CvcBcSetCode11(reinterpret_cast<std::intptr_t>(guard.Handle()),
90 SmartBool(active),
91 minDigits_,
92 maxDigits_,
93 checkQuietzone_,
94 static_cast<short>(checkDigit_),
95 transmitCheckDigit_,
96 inverse_
97 ));
98 });
99 }
100 protected:
101 Code11()
102 : ReaderCommon1DConfigBase()
103 {
104 }
105
106 };
107
108 using Code11Ptr = std::shared_ptr<Code11>;
109 }
110
111 CVB_END_INLINE_NS
112}
Configuration to access parameters of Code11.
Definition: code11.hpp:17
static std::unique_ptr< Code11 > FromHandle(const HandleGuard< ReaderConfig > &guard, bool &isActiveOut)
Create object from handle.
Definition: code11.hpp:60
Code11CheckDigit CheckDigit() const
Returns whether to evaluate/ignore check digit.
Definition: code11.hpp:39
void SetCheckDigit(Code11CheckDigit checkDigit)
Evaluate/ignore check digit.
Definition: code11.hpp:26
Configuration to access parameters of ReaderCommon1DConfigBase.
Definition: reader_common_1d_config_base.hpp:19
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:97
@ Code11
Code 11 Barcode.
Code11CheckDigit
Available check digits for Code11.
Definition: barcode.hpp:179
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24