data_matrix_grading.hpp
1 #pragma once
2 
3 #include "../../_cexports/c_barcode.h"
4 #include "grader_2d_config_base.hpp"
5 
6 namespace Cvb
7 {
8  CVB_BEGIN_INLINE_NS
9 
10  namespace Barcode
11  {
12 
14 
17  {
18  public:
19 
20 
22 
27  void SetGradePrintGrowth(bool printGrowth)
28  {
29  SetDirty();
30  printGrowth_ = printGrowth;
31  };
32 
33 
35 
40  bool GradePrintGrowth() const
41  {
42  return printGrowth_;
43  };
44 
45  protected:
46  SmartBool printGrowth_;
47 
48  public:
49  virtual Symbology Type() const override { return Symbology::DataMatrixGrading; };
50 
52 
58  static std::unique_ptr<DataMatrixGrading> FromHandle(const HandleGuard<ReaderConfig>& guard, bool& isActiveOut)
59  {
61  isActiveOut = pConfig->ReadFromHandle(guard);
62  return pConfig;
63  }
64 
65  protected:
66  virtual bool ReadFromHandle_(const HandleGuard<ReaderConfig>& guard) override
67  {
68  short rMin, rMax;
69  CExports::cvbbool_t active;
70  CVB_CALL_CAPI(CvcBcGetCodeGradingEx(reinterpret_cast<std::intptr_t>(guard.Handle()),
71  &active,
72  symbolContrast_.Ptr(),
73  axialNonUniformity_.Ptr(),
74  gridNonUniformity_.Ptr(),
75  unusedErrorCorrection_.Ptr(),
76  printGrowth_.Ptr(),
77  angleOfDistortion_.Ptr(),
78  modulation_.Ptr(),
79  reflectanceMargin_.Ptr(),
80  fixedPatternDamage_.Ptr(),
81  &rMin,
82  &rMax));
83  reflectanceReference_ = Cvb::ValueRange<int>(rMin, rMax);
84 
85  return SmartBool(active);
86  }
87 
88  virtual void WriteToHandle_(bool active, HandleGuard<ReaderConfig>& guard) override
89  {
90  Internal::DoResCall([&]()
91  {
92  return CVB_CALL_CAPI(CvcBcSetCodeGradingEx(reinterpret_cast<std::intptr_t>(guard.Handle()), SmartBool(active),
93  symbolContrast_,
94  axialNonUniformity_,
95  gridNonUniformity_,
96  unusedErrorCorrection_,
97  printGrowth_,
98  angleOfDistortion_,
99  modulation_,
100  reflectanceMargin_,
101  fixedPatternDamage_,
102  static_cast<short>(reflectanceReference_.Min()),
103  static_cast<short>(reflectanceReference_.Max())));
104  });
105  }
106 
107  DataMatrixGrading()
108  : Grader2DConfigBase()
109  {
110  }
111 
112 
113  };
114 
115  using DataMatrixGradingPtr = std::shared_ptr<DataMatrixGrading>;
116  }
117 
118  CVB_END_INLINE_NS
119 }
STL class.
T Min() const noexcept
Gets the minimum value.
Definition: value_range.hpp:50
T Max() const noexcept
Gets the maximum value.
Definition: value_range.hpp:72
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:96
virtual Symbology Type() const override
Symbology of configuration object.
Definition: data_matrix_grading.hpp:49
Root namespace for the Image Manager interface.
Definition: version.hpp:11
static std::unique_ptr< DataMatrixGrading > FromHandle(const HandleGuard< ReaderConfig > &guard, bool &isActiveOut)
Create object from handle.
Definition: data_matrix_grading.hpp:58
void SetGradePrintGrowth(bool printGrowth)
Activates (true) or deactivates (false) the print growth when grading.
Definition: data_matrix_grading.hpp:27
Configuration to access parameters of Grader2DConfigBase.
Definition: grader_2d_config_base.hpp:18
STL class.
bool GradePrintGrowth() const
Activates (true) or deactivates (false) the print growth when grading.
Definition: data_matrix_grading.hpp:40
Configuration to access parameters of DataMatrixGrading.
Definition: data_matrix_grading.hpp:16