micro_pdf417.hpp
1 #pragma once
2 
3 #include "reader_2d_with_quietzone_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 
22 
27  void SetOrientation(CodeOrientation orientation)
28  {
29  if(orientation_ != orientation)
30  SetDirty();
31  orientation_ = orientation;
32  }
33 
35 
41  {
42  return orientation_;
43  }
44 
45 
46  protected:
47  CodeOrientation orientation_;
48 
49 
50  public:
51  virtual Symbology Type() const override { return Symbology::MicroPdf417; }
52 
54 
60  static std::unique_ptr<MicroPdf417> FromHandle(const HandleGuard<ReaderConfig>& guard, bool& isActiveOut)
61  {
62  auto pConfig = std::unique_ptr<MicroPdf417>(new MicroPdf417());
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  short tmpOrientation;
72  CVB_CALL_CAPI(CvcBcGetMicroPDF417(reinterpret_cast<std::intptr_t>(guard.Handle()),
73  &active,
74  &tmpOrientation,
75  mirrored_.Ptr(),
76  inverse_.Ptr(),
77  checkQuietzone_.Ptr()
78  ));
79  orientation_ = static_cast<CodeOrientation>(tmpOrientation);
80  return SmartBool(active);
81  }
82 
83  virtual void WriteToHandle_(bool active, HandleGuard<ReaderConfig>& guard) override
84  {
85  Internal::DoResCall([&]()
86  {
87  return CVB_CALL_CAPI(CvcBcSetMicroPDF417(reinterpret_cast<std::intptr_t>(guard.Handle()),
88  SmartBool(active),
89  static_cast<short>(orientation_),
90  mirrored_,
91  inverse_,
92  checkQuietzone_));
93  });
94  }
95  protected:
96  MicroPdf417()
97  : Reader2DWithQuietzoneConfigBase()
98  {
99  }
100 
101  };
102 
103  using MicroPdf417Ptr = std::shared_ptr<MicroPdf417>;
104  }
105 
106  CVB_END_INLINE_NS
107 }
STL class.
Micro PDF417 Matrix Code.
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:96
CodeOrientation
Directions that a four state code may have.
Definition: barcode.hpp:189
virtual Symbology Type() const override
Symbology of configuration object.
Definition: micro_pdf417.hpp:51
Root namespace for the Image Manager interface.
Definition: version.hpp:11
Configuration to access parameters of Reader2DWithQuietzoneConfigBase.
Definition: reader_2d_with_quietzone_config_base.hpp:18
static std::unique_ptr< MicroPdf417 > FromHandle(const HandleGuard< ReaderConfig > &guard, bool &isActiveOut)
Create object from handle.
Definition: micro_pdf417.hpp:60
STL class.
void SetOrientation(CodeOrientation orientation)
Specifies the orientation of the code in the image.
Definition: micro_pdf417.hpp:27
CodeOrientation Orientation() const
Returns the orientation of the code in the image.
Definition: micro_pdf417.hpp:40
Configuration to access parameters of MicroPdf417.
Definition: micro_pdf417.hpp:16