codabar.hpp
1 #pragma once
2 
3 #include "reader_with_transmit_start_stop_config.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  public:
21  virtual Symbology Type() const override { return Symbology::Codabar; };
22 
24 
30  static std::unique_ptr<Codabar> FromHandle(const HandleGuard<ReaderConfig>& guard, bool& isActiveOut)
31  {
32  auto pConfig = std::unique_ptr<Codabar>(new Codabar());
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(CvcBcGetCodabar(reinterpret_cast<std::intptr_t>(guard.Handle()),
42  &active,
43  &minDigits_,
44  &maxDigits_,
45  checkQuietzone_.Ptr(),
46  evalCheckDigit_.Ptr(),
47  transmitCheckDigit_.Ptr(),
48  transmitStartStop_.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(CvcBcSetCodabar(reinterpret_cast<std::intptr_t>(guard.Handle()),
59  SmartBool(active),
60  minDigits_,
61  maxDigits_,
62  checkQuietzone_,
63  evalCheckDigit_,
64  transmitCheckDigit_,
65  transmitStartStop_,
66  inverse_
67  ));
68  });
69  }
70  protected:
71  Codabar()
72  : ReaderWithTransmitStartStopConfigBase()
73  {
74  }
75 
76  };
77 
78  using CodabarPtr = std::shared_ptr<Codabar>;
79  }
80 
81  CVB_END_INLINE_NS
82 }
static std::unique_ptr< Codabar > FromHandle(const HandleGuard< ReaderConfig > &guard, bool &isActiveOut)
Create object from handle.
Definition: codabar.hpp:30
STL class.
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:96
Configuration to access parameters of Codabar.
Definition: codabar.hpp:17
Configuration to access parameters of ReaderWithTransmitStartStopConfigBase.
Definition: reader_with_transmit_start_stop_config.hpp:18
Root namespace for the Image Manager interface.
Definition: version.hpp:11
STL class.
virtual Symbology Type() const override
Symbology of configuration object.
Definition: codabar.hpp:21