planet.hpp
1 #pragma once
2 
3 #include "reader_planet_postnet_config_base.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 SetLevels(PlanetLevels levels)
28  {
29  if(levels_ != levels)
30  SetDirty();
31  levels_ = levels;
32  }
33 
35 
41  {
42  return levels_;
43  };
44 
45 
46 
47  protected:
48  PlanetLevels levels_;
49 
50 
51  public:
52  virtual Symbology Type() const override { return Symbology::Planet; };
53 
55 
61  static std::unique_ptr<Planet> FromHandle(const HandleGuard<ReaderConfig>& guard, bool& isActiveOut)
62  {
63  auto pConfig = std::unique_ptr<Planet>(new Planet());
64  isActiveOut = pConfig->ReadFromHandle(guard);
65  return pConfig;
66  }
67 
68  protected:
69  virtual bool ReadFromHandle_(const HandleGuard<ReaderConfig>& guard) override
70  {
71  CExports::cvbbool_t active;
72  unsigned short tmpLevels;
73  short tmpOrientation;
74  CVB_CALL_CAPI(CvcBcGetPlanet(reinterpret_cast<std::intptr_t>(guard.Handle()),
75  &active,
76  &tmpLevels,
77  &tmpOrientation,
78  &threshold_,
79  inverse_.Ptr(),
80  mirrored_.Ptr(),
81  evalCheckDigit_.Ptr(),
82  transmitCheckDigit_.Ptr(),
83  &quietzoneWidth_
84  ));
85  levels_ = static_cast<PlanetLevels>(tmpLevels);
86  orientation_ = static_cast<CodeOrientation>(tmpOrientation);
87  return SmartBool(active);
88  }
89 
90  virtual void WriteToHandle_(bool active, HandleGuard<ReaderConfig>& guard) override
91  {
92  Internal::DoResCall([&]()
93  {
94  return CVB_CALL_CAPI(CvcBcSetPlanet(reinterpret_cast<std::intptr_t>(guard.Handle()),
95  active,
96  static_cast<unsigned short>(levels_),
97  static_cast<short>(orientation_),
98  threshold_,
99  inverse_,
100  mirrored_,
101  evalCheckDigit_,
102  transmitCheckDigit_,
103  quietzoneWidth_
104  ));
105  });
106  }
107  protected:
108  Planet()
109  : ReaderPlanetPostnetConfigBase()
110  {
111  }
112 
113  };
114 
115  using PlanetPtr = std::shared_ptr<Planet>;
116  }
117 
118  CVB_END_INLINE_NS
119 }
STL class.
PlanetLevels Levels() const
Returns the levels for the allowed code types.
Definition: planet.hpp:40
static std::unique_ptr< Planet > FromHandle(const HandleGuard< ReaderConfig > &guard, bool &isActiveOut)
Create object from handle.
Definition: planet.hpp:61
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:96
Configuration to access parameters of ReaderPlanetPostnetConfigBase.
Definition: reader_planet_postnet_config_base.hpp:19
Root namespace for the Image Manager interface.
Definition: version.hpp:11
PlanetLevels
Available level flags for Planet codes.
Definition: barcode.hpp:238
void SetLevels(PlanetLevels levels)
Specifies the levels for the allowed code types.
Definition: planet.hpp:27
STL class.
virtual Symbology Type() const override
Symbology of configuration object.
Definition: planet.hpp:52
Configuration to access parameters of Planet.
Definition: planet.hpp:17