interleaved_2_of_5.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 
14 
17  {
18 
19  public:
20  virtual Symbology Type() const override { return Symbology::Interleaved2of5; }
21 
23 
29  static std::unique_ptr<Interleaved2of5> FromHandle(const HandleGuard<ReaderConfig>& guard, bool& isActiveOut)
30  {
32  isActiveOut = pConfig->ReadFromHandle(guard);
33  return pConfig;
34  }
35 
36  protected:
37  virtual bool ReadFromHandle_(const HandleGuard<ReaderConfig>& guard) override
38  {
39  CExports::cvbbool_t active;
40  CVB_CALL_CAPI(CvcBcGet2of5Interleaved(reinterpret_cast<std::intptr_t>(guard.Handle()),
41  &active,
42  &minDigits_,
43  &maxDigits_,
44  checkQuietzone_.Ptr(),
45  evalCheckDigit_.Ptr(),
46  transmitCheckDigit_.Ptr(),
47  inverse_.Ptr()
48  ));
49  return SmartBool(active);
50  }
51 
52  virtual void WriteToHandle_(bool active, HandleGuard<ReaderConfig>& guard) override
53  {
54  Internal::DoResCall([&]()
55  {
56  return CVB_CALL_CAPI(CvcBcSet2of5Interleaved(reinterpret_cast<std::intptr_t>(guard.Handle()),
57  SmartBool(active),
58  minDigits_,
59  maxDigits_,
60  checkQuietzone_,
61  evalCheckDigit_,
62  transmitCheckDigit_,
63  inverse_
64  ));
65  });
66  }
67  protected:
69  : ReaderWithBooleanCheckDigitConfigBase()
70  {
71  absoluteMinDigits_ = 2;
72  }
73 
74  };
75 
76  using Interleaved2of5Ptr = std::shared_ptr<Interleaved2of5>;
77  }
78 
79  CVB_END_INLINE_NS
80 }
STL class.
virtual Symbology Type() const override
Symbology of configuration object.
Definition: interleaved_2_of_5.hpp:20
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:96
Configuration to access parameters of Interleaved2of5.
Definition: interleaved_2_of_5.hpp:16
Root namespace for the Image Manager interface.
Definition: version.hpp:11
static std::unique_ptr< Interleaved2of5 > FromHandle(const HandleGuard< ReaderConfig > &guard, bool &isActiveOut)
Create object from handle.
Definition: interleaved_2_of_5.hpp:29
STL class.
Configuration to access parameters of ReaderWithBooleanCheckDigitConfigBase.
Definition: reader_with_boolean_check_digit_config_base.hpp:19