rss.hpp
1 #pragma once
2 
3 #include "reader_2d_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 
17  class Rss : public Reader2DConfigBase
18  {
19 public:
20 
22 
27  void SetComposition(RssComposition composition)
28  {
29  if(composition_ != composition)
30  SetDirty();
31  composition_ = composition;
32  }
33 
35 
41  {
42  return composition_;
43  }
44 
45 
47 
52  void SetOrientation(CodeOrientation orientation)
53  {
54  if(orientation_ != orientation)
55  SetDirty();
56  orientation_ = orientation;
57  }
58 
60 
66  {
67  return orientation_;
68  }
69 
71 
76  void SetTypes(RssTypes types)
77  {
78  if(types_ != types)
79  SetDirty();
80  types_ = types;
81  }
82 
84 
89  RssTypes Types() const
90  {
91  return types_;
92  };
93 
94 
95  protected:
96  RssComposition composition_;
97  CodeOrientation orientation_;
98  RssTypes types_;
99 
100 
101  public:
102  virtual Symbology Type() const override { return Symbology::RSS; };
103 
105 
111  static std::unique_ptr<Rss> FromHandle(const HandleGuard<ReaderConfig>& guard, bool& isActiveOut)
112  {
113  auto pConfig = std::unique_ptr<Rss>(new Rss());
114  isActiveOut = pConfig->ReadFromHandle(guard);
115  return pConfig;
116  }
117 
118  protected:
119  virtual bool ReadFromHandle_(const HandleGuard<ReaderConfig>& guard) override
120  {
121  CExports::cvbbool_t active;
122  short tmpTypes;
123  short tmpComposite;
124  short tmpDirection;
125  CVB_CALL_CAPI(CvcBcGetRSS(reinterpret_cast<std::intptr_t>(guard.Handle()), &active,
126  inverse_.Ptr(),
127  mirrored_.Ptr(),
128  &tmpTypes,
129  &tmpComposite,
130  &tmpDirection));
131  types_ = static_cast<RssTypes>(tmpTypes);
132  composition_ = static_cast<RssComposition>(tmpComposite);
133  orientation_ = static_cast<CodeOrientation>(tmpDirection);
134  return SmartBool(active);
135  }
136 
137  virtual void WriteToHandle_(bool active, HandleGuard<ReaderConfig>& guard) override
138  {
139  Internal::DoResCall([&]()
140  {
141  return CVB_CALL_CAPI(CvcBcSetRSS(reinterpret_cast<std::intptr_t>(guard.Handle()),
142  SmartBool(active),
143  inverse_,
144  mirrored_,
145  static_cast<short>(types_),
146  static_cast<short>(composition_),
147  static_cast<short>(orientation_)));
148  });
149  }
150  protected:
151  Rss()
152  : Reader2DConfigBase()
153  {
154  }
155 
156  };
157 
158  using RssPtr = std::shared_ptr<Rss>;
159  }
160 
161  CVB_END_INLINE_NS
162 }
RssTypes
Types of RSS codes to read.
Definition: barcode.hpp:406
static std::unique_ptr< Rss > FromHandle(const HandleGuard< ReaderConfig > &guard, bool &isActiveOut)
Create object from handle.
Definition: rss.hpp:111
STL class.
Configuration to access parameters of Reader2DConfigBase.
Definition: reader_2d_config_base.hpp:18
RssTypes Types() const
Returns the RSS types.
Definition: rss.hpp:89
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:96
CodeOrientation
Directions that a four state code may have.
Definition: barcode.hpp:189
CodeOrientation Orientation() const
Returns the possible orientations in which the RSS code may occur.
Definition: rss.hpp:65
Configuration to access parameters of Rss.
Definition: rss.hpp:17
void SetOrientation(CodeOrientation orientation)
Selects the possible orientations in which the RSS code may occur.
Definition: rss.hpp:52
void SetTypes(RssTypes types)
Sets the RSS types.
Definition: rss.hpp:76
Root namespace for the Image Manager interface.
Definition: version.hpp:11
RssComposition Composition() const
Returns the bit field which specifies the permitted RSS composite components.
Definition: rss.hpp:40
STL class.
void SetComposition(RssComposition composition)
Sets the bit field which specifies the permitted RSS composite components.
Definition: rss.hpp:27
RssComposition
Composition flags for RSS codes.
Definition: barcode.hpp:427
virtual Symbology Type() const override
Symbology of configuration object.
Definition: rss.hpp:102