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