CVB++ 14.0
planet.hpp
1#pragma once
2
3#include "reader_planet_postnet_config_base.hpp"
4
5namespace Cvb
6{
7 CVB_BEGIN_INLINE_NS
8
9 namespace Barcode
10 {
11 using namespace Internal;
12
13
15
18 {
19public:
20
22
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}
Configuration to access parameters of ReaderPlanetPostnetConfigBase.
Definition: reader_planet_postnet_config_base.hpp:20
Configuration to access parameters of Planet.
Definition: planet.hpp:18
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
void SetLevels(PlanetLevels levels)
Specifies the levels for the allowed code types.
Definition: planet.hpp:27
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:97
@ Planet
Planet Barcode.
PlanetLevels
Available level flags for Planet codes.
Definition: barcode.hpp:239
CodeOrientation
Directions that a four state code may have.
Definition: barcode.hpp:190
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24