CVB++ 14.0
four_state_usps.hpp
1#pragma once
2
3#include "reader_four_state_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:
20
26 {
27 if(lsb_ != lsb)
28 SetDirty();
29 lsb_ = lsb;
30 }
31
33
39 {
40 return lsb_;
41 };
42
43
44
45 protected:
46 FourStateLsb lsb_;
47
48
49 public:
50 virtual Symbology Type() const override { return Symbology::FourStateUsps; };
51
53
59 static std::unique_ptr<FourStateUsps> FromHandle(const HandleGuard<ReaderConfig>& guard, bool& isActiveOut)
60 {
62 isActiveOut = pConfig->ReadFromHandle(guard);
63 return pConfig;
64 }
65
66 protected:
67 virtual bool ReadFromHandle_(const HandleGuard<ReaderConfig>& guard) override
68 {
69 CExports::cvbbool_t active;
70 short tmpLsb;
71 CVB_CALL_CAPI(CvcBcGetFourStateUSPS(reinterpret_cast<std::intptr_t>(guard.Handle()),
72 &active,
73 &tmpLsb,
74 &threshold_,
75 inverse_.Ptr(),
76 mirrored_.Ptr(),
77 &quietzoneWidth_
78 ));
79 lsb_ = static_cast<FourStateLsb>(tmpLsb);
80 return SmartBool(active);
81 }
82
83 virtual void WriteToHandle_(bool active, HandleGuard<ReaderConfig>& guard) override
84 {
85 Internal::DoResCall([&]()
86 {
87 return CVB_CALL_CAPI(CvcBcSetFourStateUSPS(reinterpret_cast<std::intptr_t>(guard.Handle()),
88 active,
89 static_cast<short>(lsb_),
90 threshold_,
91 inverse_,
92 mirrored_,
93 quietzoneWidth_
94 ));
95 });
96 }
97 protected:
98 FourStateUsps()
99 : ReaderFourStateConfigBase()
100 {
101 }
102
103 };
104
105 using FourStateUspsPtr = std::shared_ptr<FourStateUsps>;
106 }
107
108 CVB_END_INLINE_NS
109}
Configuration to access parameters of ReaderFourStateConfigBase.
Definition: reader_four_state_config_base.hpp:20
Configuration to access parameters of FourStateUsps.
Definition: four_state_usps.hpp:17
static std::unique_ptr< FourStateUsps > FromHandle(const HandleGuard< ReaderConfig > &guard, bool &isActiveOut)
Create object from handle.
Definition: four_state_usps.hpp:59
FourStateLsb LsbPosition() const
Returns the position of the "low significant bit" of the code in the image.
Definition: four_state_usps.hpp:38
void SetLsbPosition(FourStateLsb lsb)
Sets the position of the "low significant bit" of the code in the image.
Definition: four_state_usps.hpp:25
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:97
@ FourStateUsps
Four State USPS Barcode.
FourStateLsb
LSB settings for four state codes.
Definition: barcode.hpp:226
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24