CVB++ 14.0
four_state_australian.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:
19
21
27 {
28 if(levels_ != levels)
29 SetDirty();
30 levels_ = levels;
31 }
32
34
40 {
41 return levels_;
42 };
43
45
51 {
52 if(orientation_ != orientation)
53 SetDirty();
54 orientation_ = orientation;
55 }
56
58
64 {
65 return orientation_;
66 };
67
68
69
70 protected:
72 CodeOrientation orientation_;
73
74
75 public:
76 virtual Symbology Type() const override { return Symbology::FourStateAustralian; };
77
79
85 static std::unique_ptr<FourStateAustralian> FromHandle(const HandleGuard<ReaderConfig>& guard, bool& isActiveOut)
86 {
88 isActiveOut = pConfig->ReadFromHandle(guard);
89 return pConfig;
90 }
91
92 protected:
93 virtual bool ReadFromHandle_(const HandleGuard<ReaderConfig>& guard) override
94 {
95 CExports::cvbbool_t active;
96 unsigned short tmpLevels;
97 short tmpOrientation;
98 CVB_CALL_CAPI(CvcBcGetFourStateAustralian(reinterpret_cast<std::intptr_t>(guard.Handle()),
99 &active,
100 &tmpLevels,
101 &tmpOrientation,
102 &threshold_,
103 inverse_.Ptr(),
104 mirrored_.Ptr(),
105 &quietzoneWidth_
106 ));
107 levels_ = static_cast<FourStateAustralianLevels>(tmpLevels);
108 orientation_ = static_cast<CodeOrientation>(tmpOrientation);
109 return SmartBool(active);
110 }
111
112 virtual void WriteToHandle_(bool active, HandleGuard<ReaderConfig>& guard) override
113 {
114 Internal::DoResCall([&]()
115 {
116 return CVB_CALL_CAPI(CvcBcSetFourStateAustralian(reinterpret_cast<std::intptr_t>(guard.Handle()),
117 SmartBool(active),
118 static_cast<unsigned short>(levels_),
119 static_cast<short>(orientation_),
120 threshold_,
121 inverse_,
122 mirrored_,
123 quietzoneWidth_
124 ));
125 });
126 }
127 protected:
128 FourStateAustralian()
129 : ReaderFourStateConfigBase()
130 {
131 }
132
133 };
134
135 using FourStateAustralianPtr = std::shared_ptr<FourStateAustralian>;
136 }
137
138 CVB_END_INLINE_NS
139}
Configuration to access parameters of ReaderFourStateConfigBase.
Definition: reader_four_state_config_base.hpp:20
Configuration to access parameters of FourStateAustralian (4-State Australian).
Definition: four_state_australian.hpp:17
void SetLevels(FourStateAustralianLevels levels)
Bit field which specifies the permitted subtypes of the 4-State Australian.
Definition: four_state_australian.hpp:26
CodeOrientation Orientation() const
Returns the direction of the 4-State Australian in the image.
Definition: four_state_australian.hpp:63
FourStateAustralianLevels Levels() const
Returns the bit field which specifies the permitted subtypes of the 4-State Australian.
Definition: four_state_australian.hpp:39
static std::unique_ptr< FourStateAustralian > FromHandle(const HandleGuard< ReaderConfig > &guard, bool &isActiveOut)
Create object from handle.
Definition: four_state_australian.hpp:85
void SetOrientation(CodeOrientation orientation)
Direction of the 4-State Australian in the image.
Definition: four_state_australian.hpp:50
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:97
@ FourStateAustralian
Four State Australian Barcode.
FourStateAustralianLevels
Available level flags Four State Australian codes.
Definition: barcode.hpp:202
CodeOrientation
Directions that a four state code may have.
Definition: barcode.hpp:190
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24