code128.hpp
1 #pragma once
2 
3 #include "reader_with_boolean_check_digit_config_base.hpp"
4 
5 namespace Cvb
6 {
7  CVB_BEGIN_INLINE_NS
8 
9  namespace Barcode
10  {
11  using namespace Internal;
12 
13 
15 
18  {
19 
20 
21  public:
22  virtual Symbology Type() const override { return Symbology::Code128; };
23 
25 
31  static std::unique_ptr<Code128> FromHandle(const HandleGuard<ReaderConfig>& guard, bool& isActiveOut)
32  {
33  auto pConfig = std::unique_ptr<Code128>(new Code128());
34  isActiveOut = pConfig->ReadFromHandle(guard);
35  return pConfig;
36  }
37 
38  protected:
39  virtual bool ReadFromHandle_(const HandleGuard<ReaderConfig>& guard) override
40  {
41  CExports::cvbbool_t active;
42  CVB_CALL_CAPI(CvcBcGetCode128(reinterpret_cast<std::intptr_t>(guard.Handle()),
43  &active,
44  &minDigits_,
45  &maxDigits_,
46  checkQuietzone_.Ptr(),
47  evalCheckDigit_.Ptr(),
48  transmitCheckDigit_.Ptr(),
49  inverse_.Ptr()
50  ));
51  return SmartBool(active);
52  }
53 
54  virtual void WriteToHandle_(bool active, HandleGuard<ReaderConfig>& guard) override
55  {
56  Internal::DoResCall([&]()
57  {
58  return CVB_CALL_CAPI(CvcBcSetCode128(reinterpret_cast<std::intptr_t>(guard.Handle()),
59  SmartBool(active),
60  minDigits_,
61  maxDigits_,
62  checkQuietzone_,
63  evalCheckDigit_,
64  transmitCheckDigit_,
65  inverse_
66  ));
67  });
68  }
69  protected:
70  Code128()
71  : ReaderWithBooleanCheckDigitConfigBase()
72  {
73  }
74 
75  };
76 
77  using Code128Ptr = std::shared_ptr<Code128>;
78  }
79 
80  CVB_END_INLINE_NS
81 }
STL class.
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:96
virtual Symbology Type() const override
Symbology of configuration object.
Definition: code128.hpp:22
Root namespace for the Image Manager interface.
Definition: version.hpp:11
Configuration to access parameters of Code128.
Definition: code128.hpp:17
STL class.
Configuration to access parameters of ReaderWithBooleanCheckDigitConfigBase.
Definition: reader_with_boolean_check_digit_config_base.hpp:19
static std::unique_ptr< Code128 > FromHandle(const HandleGuard< ReaderConfig > &guard, bool &isActiveOut)
Create object from handle.
Definition: code128.hpp:31