code39.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 public:
20 
22 
27  void SetAllowFullAscii(bool fullAscii)
28  {
29  SetDirty();
30  fullAscii_ = fullAscii;
31  }
32 
34 
39  bool AllowFullAscii() const
40  {
41  return fullAscii_;
42  };
43 
44 
45 
46  protected:
47  SmartBool fullAscii_;
48 
49 
50  public:
51  virtual Symbology Type() const override { return Symbology::Code39; };
52 
54 
60  static std::unique_ptr<Code39> FromHandle(const HandleGuard<ReaderConfig>& guard, bool& isActiveOut)
61  {
62  auto pConfig = std::unique_ptr<Code39>(new Code39());
63  isActiveOut = pConfig->ReadFromHandle(guard);
64  return pConfig;
65  }
66 
67  protected:
68  virtual bool ReadFromHandle_(const HandleGuard<ReaderConfig>& guard) override
69  {
70  CExports::cvbbool_t active;
71  CVB_CALL_CAPI(CvcBcGetCode39(reinterpret_cast<std::intptr_t>(guard.Handle()),
72  &active,
73  &minDigits_,
74  &maxDigits_,
75  checkQuietzone_.Ptr(),
76  evalCheckDigit_.Ptr(),
77  transmitCheckDigit_.Ptr(),
78  transmitStartStop_.Ptr(),
79  fullAscii_.Ptr(),
80  inverse_.Ptr()
81  ));
82 
83  return SmartBool(active);
84  }
85 
86  virtual void WriteToHandle_(bool active, HandleGuard<ReaderConfig>& guard) override
87  {
88  Internal::DoResCall([&]()
89  {
90  return CVB_CALL_CAPI(CvcBcSetCode39(reinterpret_cast<std::intptr_t>(guard.Handle()),
91  SmartBool(active),
92  minDigits_,
93  maxDigits_,
94  checkQuietzone_,
95  evalCheckDigit_,
96  transmitCheckDigit_,
97  transmitStartStop_,
98  fullAscii_,
99  inverse_
100  ));
101  });
102  }
103  protected:
104  Code39()
105  : ReaderWithTransmitStartStopConfigBase()
106  {
107  }
108 
109  };
110 
111  using Code39Ptr = std::shared_ptr<Code39>;
112  }
113 
114  CVB_END_INLINE_NS
115 }
STL class.
static std::unique_ptr< Code39 > FromHandle(const HandleGuard< ReaderConfig > &guard, bool &isActiveOut)
Create object from handle.
Definition: code39.hpp:60
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:96
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
void SetAllowFullAscii(bool fullAscii)
Permit/do not permit complete ASCII code.
Definition: code39.hpp:27
STL class.
Configuration to access parameters of Code39.
Definition: code39.hpp:17
bool AllowFullAscii() const
Returns whether to permit/do not permit complete ASCII code.
Definition: code39.hpp:39
virtual Symbology Type() const override
Symbology of configuration object.
Definition: code39.hpp:51