option.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2015 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
6 #include "backend.h"
7 #include "archive.h"
8 #include "hw-monitor.h"
9 #include "sensor.h"
10 #include "core/streaming.h"
11 #include "command_transfer.h"
12 #include "error-handling.h"
13 #include <chrono>
14 #include <memory>
15 #include <vector>
16 #include <cmath>
17 #include <type_traits>
18 
19 namespace librealsense
20 {
22  {
23  public:
24  void add_observer(std::function<void(float)> callback)
25  {
26  _callbacks.push_back(callback);
27  }
28 
29  void notify(float val)
30  {
31  for (auto callback : _callbacks)
32  {
33  callback(val);
34  }
35  }
36 
37  private:
38  std::vector<std::function<void(float)>> _callbacks;
39  };
40 
41  class readonly_option : public option
42  {
43  public:
44  bool is_read_only() const override { return true; }
45 
46  void set(float) override
47  {
48  throw not_implemented_exception("This option is read-only!");
49  }
50 
51  void enable_recording(std::function<void(const option&)> record_action) override
52  {
53  //empty
54  }
55  };
56 
58  {
59  public:
61  : _val(lazy<float>([val]() {return val; })), _desc(std::move(desc)) {}
62 
64  : _val(std::move(val)), _desc(std::move(desc)) {}
65 
66  float query() const override { return *_val; }
67  option_range get_range() const override { return { *_val, *_val, 0, *_val }; }
68  bool is_enabled() const override { return true; }
69 
70  const char* get_description() const override { return _desc.c_str(); }
71 
72  void update(std::shared_ptr<extension_snapshot> ext) override
73  {
74  if (auto opt = As<option>(ext))
75  {
76  auto new_val = opt->query();
77  _val = lazy<float>([new_val]() {return new_val; });
78  _desc = opt->get_description();
79  }
80  }
81  private:
84  };
85 
86  class LRS_EXTENSION_API option_base : public virtual option
87  {
88  public:
89  option_base(const option_range& opt_range)
90  : _opt_range(opt_range)
91  {}
92 
93  bool is_valid(float value) const;
94 
95  option_range get_range() const override;
96 
97  virtual void enable_recording(std::function<void(const option&)> recording_action) override;
98  protected:
100  std::function<void(const option&)> _recording_function = [](const option&) {};
101  };
102 
103  template<class T>
104  class enum_option : public virtual option
105  {
106  public:
107  const char* get_value_description(float val) const override
108  {
109  return get_string((T)((int)val));
110  }
111  };
112 
113  class option_description : public virtual option
114  {
115  public:
117  :_description(description) {}
118 
119  const char* get_description() const override
120  {
121  return _description.c_str();
122  }
123 
124  protected:
126  };
127 
128  template<class T>
129  class cascade_option : public T, public observable_option
130  {
131  public:
132  template <class... Args>
133  cascade_option(Args&&... args) :
134  T(std::forward<Args>(args)...) {}
135 
136  void set(float value) override
137  {
138  auto old = T::query();
139  T::set(value);
140  try
141  {
142  notify(value);
143  }
144  catch (...)
145  {
146  if (old != value)
147  T::set(old);
148  LOG_WARNING("An exception was thrown while notifying inside cascase_option::set");
149  throw;
150  }
151 
152  }
153 
154  virtual void set_with_no_signal(float value)
155  {
156  T::set(value);
157  }
158  };
159 
160  template<class T>
162  {
163  public:
164  ptr_option(T min, T max, T step, T def, T* value, const std::string& desc)
165  : option_base({ static_cast<float>(min),
166  static_cast<float>(max),
167  static_cast<float>(step),
168  static_cast<float>(def), }),
169  _min(min), _max(max), _step(step), _def(def), _value(value), _desc(desc)
170  {
171  static_assert((std::is_arithmetic<T>::value), "ptr_option class supports arithmetic built-in types only");
172  _on_set = [](float x) {};
173  }
174 
175  ptr_option(T min, T max, T step, T def, T* value, const std::string& desc,
176  const std::map<float, std::string>& description_per_value)
177  : option_base({ static_cast<float>(min),
178  static_cast<float>(max),
179  static_cast<float>(step),
180  static_cast<float>(def), }),
181  _min(min), _max(max), _step(step), _def(def), _value(value), _desc(desc), _item_desc(description_per_value)
182  {
183  static_assert((std::is_arithmetic<T>::value), "ptr_option class supports arithmetic built-in types only");
184  _on_set = [](float x) {};
185  }
186 
187 
188  void set(float value) override
189  {
190  T val = static_cast<T>(value);
191  if ((_max < val) || (_min > val))
192  throw invalid_value_exception(to_string() << "Given value " << value << " is outside [" << _min << "," << _max << "] range!");
193  *_value = val;
194  _on_set(value);
195  }
196 
197  float query() const override
198  {
199  return static_cast<float>(*_value);
200  }
201 
202  bool is_enabled() const override { return true; }
203 
204  void enable_recording(std::function<void(const option&)> record_action) override {}
205 
206  const char* get_description() const override { return _desc.c_str(); }
207 
208  const char* get_value_description(float val) const override
209  {
210  auto it = _item_desc.find(val);
211  if (it != _item_desc.end())
212  {
213  return it->second.c_str();
214  }
215  return nullptr;
216  }
217 
218  void set_description(float val, const std::string& desc)
219  {
220  _item_desc[val] = desc;
221  }
222 
223  void on_set(std::function<void(float)> on_set) { _on_set = on_set; }
224  private:
225  T _min, _max, _step, _def; // stored separately so that logic can be done in base type
228  std::map<float, std::string> _item_desc;
229  std::function<void(float)> _on_set;
230  };
231 
233  {
234  public:
235  float_option(option_range range) : option_base(range), _value(range.def) {}
236 
237  void set(float value) override;
238  float query() const override { return _value; }
239  bool is_enabled() const override { return true; }
240  // TODO: expose this outwards
241  const char* get_description() const override { return "A simple custom option for a processing block or software device"; }
242  protected:
243  float _value;
244  };
245 
246  template<class T>
248  {
249  public:
251  :float_option(range), option_description(description) {}
252 
253  const char* get_description() const override { return option_description::get_description(); }
254  };
255 
257  {
258  public:
260  : float_option(range) {}
261 
262  bool is_read_only() const override { return true; }
263  const char* get_description() const override { return "A simple read-only custom option for a software device"; }
264  void set(float) override
265  {
266  // TODO: Use get_description() to give a more useful error message when user-supplied descriptions are implemented
267  throw not_implemented_exception("This option is read-only!");
268  }
269 
270  void update(float val) { float_option::set(val); }
271  };
272 
274  {
275  public:
276  bool_option(bool default_on = true) : float_option(option_range{ 0, 1, 1, default_on ? 1.f : 0.f }) {}
277  bool is_true() { return (_value > _opt_range.min); }
278  // TODO: expose this outwards
279  const char* get_description() const override { return "A simple custom option for a processing block"; }
280 
281  using ptr = std::shared_ptr< bool_option >;
282  };
283 
284  class uvc_pu_option : public option
285  {
286  public:
287  void set(float value) override;
288 
289  float query() const override;
290 
291  option_range get_range() const override;
292 
293  bool is_enabled() const override
294  {
295  return true;
296  }
297 
299  : _ep(ep), _id(id)
300  {
301  }
302 
303  uvc_pu_option(uvc_sensor& ep, rs2_option id, const std::map<float, std::string>& description_per_value)
304  : _ep(ep), _id(id), _description_per_value(description_per_value)
305  {
306  }
307 
308  const char* get_description() const override;
309 
310  const char* get_value_description(float val) const override
311  {
312  if (_description_per_value.find(val) != _description_per_value.end())
313  return _description_per_value.at(val).c_str();
314  return nullptr;
315  }
316  void enable_recording(std::function<void(const option&)> record_action) override
317  {
318  _record = record_action;
319  }
320  private:
323  const std::map<float, std::string> _description_per_value;
324  std::function<void(const option&)> _record = [](const option&) {};
325  };
326 
327  // XU control with exclusing access to setter/getters
328  template<typename T>
329  class uvc_xu_option : public option
330  {
331  public:
332  void set(float value) override
333  {
334  _ep.invoke_powered(
335  [this, value](platform::uvc_device& dev)
336  {
337  T t = static_cast<T>(value);
338  if (!dev.set_xu(_xu, _id, reinterpret_cast<uint8_t*>(&t), sizeof(T)))
339  throw invalid_value_exception(to_string() << "set_xu(id=" << std::to_string(_id) << ") failed!" << " Last Error: " << strerror(errno));
340  _recording_function(*this);
341  });
342  }
343 
344  float query() const override
345  {
346  return static_cast<float>(_ep.invoke_powered(
347  [this](platform::uvc_device& dev)
348  {
349  T t;
350  if (!dev.get_xu(_xu, _id, reinterpret_cast<uint8_t*>(&t), sizeof(T)))
351  throw invalid_value_exception(to_string() << "get_xu(id=" << std::to_string(_id) << ") failed!" << " Last Error: " << strerror(errno));
352 
353  return static_cast<float>(t);
354  }));
355  }
356 
357  option_range get_range() const override
358  {
359  auto uvc_range = _ep.invoke_powered(
360  [this](platform::uvc_device& dev)
361  {
362  return dev.get_xu_range(_xu, _id, sizeof(T));
363  });
364 
365  if (uvc_range.min.size() < sizeof(int32_t)) return option_range{ 0,0,1,0 };
366 
367  auto min = *(reinterpret_cast<int32_t*>(uvc_range.min.data()));
368  auto max = *(reinterpret_cast<int32_t*>(uvc_range.max.data()));
369  auto step = *(reinterpret_cast<int32_t*>(uvc_range.step.data()));
370  auto def = *(reinterpret_cast<int32_t*>(uvc_range.def.data()));
371  return option_range{ static_cast<float>(min),
372  static_cast<float>(max),
373  static_cast<float>(step),
374  static_cast<float>(def) };
375  }
376 
377  bool is_enabled() const override { return true; }
378 
380  : _ep(ep), _xu(xu), _id(id), _desciption(std::move(description))
381  {}
382 
383  uvc_xu_option(uvc_sensor& ep, platform::extension_unit xu, uint8_t id, std::string description, const std::map<float, std::string>& description_per_value)
384  : _ep(ep), _xu(xu), _id(id), _desciption(std::move(description)), _description_per_value(description_per_value)
385  {}
386 
387  const char* get_description() const override
388  {
389  return _desciption.c_str();
390  }
391  void enable_recording(std::function<void(const option&)> record_action) override
392  {
393  _recording_function = record_action;
394  }
395  const char* get_value_description(float val) const override
396  {
397  if (_description_per_value.find(val) != _description_per_value.end())
398  return _description_per_value.at(val).c_str();
399  return nullptr;
400  }
401  protected:
406  std::function<void(const option&)> _recording_function = [](const option&) {};
407  const std::map<float, std::string> _description_per_value;
408  };
409 
410  template<typename T>
412  {
413  public:
415  : uvc_xu_option<T>(ep, xu, id, description)
416  {}
417 
418  protected_xu_option(uvc_sensor& ep, platform::extension_unit xu, uint8_t id, std::string description, const std::map<float, std::string>& description_per_value)
419  : uvc_xu_option<T>( ep, xu, id, description, description_per_value)
420  {}
421 
422  void set(float value) override
423  {
424  std::lock_guard<std::mutex> lk(_mtx);
426  }
427 
428  float query() const override
429  {
430  std::lock_guard<std::mutex> lk(_mtx);
431  return uvc_xu_option<T>::query();
432  }
433 
434  protected:
435 
436  mutable std::mutex _mtx;
437  };
438 
439  template<class T, class R, class W, class U>
441  {
442  public:
443  void set(float value) override
444  {
445  _struct_interface->set(_field, value);
446  _recording_function(*this);
447  }
448  float query() const override
449  {
450  return _struct_interface->get(_field);
451  }
452  option_range get_range() const override
453  {
454  return _range;
455  }
456  bool is_enabled() const override { return true; }
457 
459  U T::* field, const option_range& range)
460  : _struct_interface(struct_interface), _range(range), _field(field)
461  {
462  }
463 
464  const char* get_description() const override
465  {
466  return nullptr;
467  }
468 
469  void enable_recording(std::function<void(const option&)> record_action) override
470  {
471  _recording_function = record_action;
472  }
473  private:
474  std::shared_ptr<struct_interface<T, R, W>> _struct_interface;
476  U T::* _field;
477  std::function<void(const option&)> _recording_function = [](const option&) {};
478  };
479 
480  template<class T, class R, class W, class U>
481  std::shared_ptr<struct_field_option<T, R, W, U>> make_field_option(
483  U T::* field, const option_range& range)
484  {
485  return std::make_shared<struct_field_option<T, R, W, U>>
486  (struct_interface, field, range);
487  }
488 
490  {
491  public:
492  std::vector<uint8_t> send_receive(const std::vector<uint8_t>& data, int, bool require_response) override;
493 
496  : _uvc(uvc), _xu(std::move(xu)), _ctrl(ctrl)
497  {}
498 
499  private:
503  };
504 
505  class polling_error_handler;
506 
508  {
509  public:
510  polling_errors_disable(std::shared_ptr<polling_error_handler> handler)
511  : _polling_error_handler(handler), _value(1)
512  {}
513 
515 
516  void set(float value) override;
517 
518  float query() const override;
519 
520  option_range get_range() const override;
521 
522  bool is_enabled() const override;
523 
524 
525  const char* get_description() const override;
526 
527  const char* get_value_description(float value) const override;
528  void enable_recording(std::function<void(const option&)> record_action) override
529  {
530  _recording_function = record_action;
531  }
532  private:
533  std::weak_ptr<polling_error_handler> _polling_error_handler;
534  float _value;
535  std::function<void(const option&)> _recording_function = [](const option&) {};
536  };
537 
540  class proxy_option : public option
541  {
542  public:
543  explicit proxy_option(std::shared_ptr<option> proxy_option)
544  : _proxy(proxy_option)
545  {}
546 
547  const char* get_value_description(float val) const override
548  {
549  return _proxy->get_value_description(val);
550  }
551  const char* get_description() const override
552  {
553  return _proxy->get_description();
554  }
555  virtual void set(float value) override
556  {
557  return _proxy->set(value);
558  }
559  float query() const override
560  {
561  return _proxy->query();
562  }
563 
564  option_range get_range() const override
565  {
566  return _proxy->get_range();
567  }
568 
569  bool is_enabled() const override
570  {
571  return _proxy->is_enabled();
572  }
573 
574  bool is_read_only() const override
575  {
576  return _proxy->is_read_only();
577  }
578 
579  void enable_recording(std::function<void(const option&)> record_action) override
580  {
581  _recording_function = record_action;
582  }
583  protected:
584  std::shared_ptr<option> _proxy;
585  std::function<void(const option&)> _recording_function = [](const option&) {};
586  };
587 
591  {
592  public:
593  explicit auto_disabling_control(std::shared_ptr<option> auto_disabling,
594  std::shared_ptr<option> affected_option,
595  std::vector<float> move_to_manual_values = { 1.f },
596  float manual_value = 0.f)
597  : proxy_option(auto_disabling), _affected_control(affected_option)
598  , _move_to_manual_values(move_to_manual_values), _manual_value(manual_value)
599  {}
600 
601  void set(float value) override
602  {
603  auto strong = _affected_control.lock();
604  if (!strong)
605  return;
606 
607  auto move_to_manual = false;
608  auto val = strong->query();
609 
610  if (std::find(_move_to_manual_values.begin(),
611  _move_to_manual_values.end(), val) != _move_to_manual_values.end())
612  {
613  move_to_manual = true;
614  }
615 
616  if (move_to_manual)
617  {
618  LOG_DEBUG("Move option to manual mode in order to set a value");
619  strong->set(_manual_value);
620  }
621  _proxy->set(value);
622  _recording_function(*this);
623  }
624 
625  private:
626  std::weak_ptr<option> _affected_control;
627  std::vector<float> _move_to_manual_values;
629  };
630 
633  class gated_option : public proxy_option
634  {
635  public:
636  explicit gated_option(std::shared_ptr<option> leading_to_read_only,
637  std::vector<std::pair<std::shared_ptr<option>, std::string>> gated_options)
638  : proxy_option(leading_to_read_only)
639  {
640  for (auto& gated : gated_options)
641  {
642  _gated_options.push_back(gated);
643  }
644  }
645 
646  void set(float value) override
647  {
648 
649  bool gated_set = false;
650  for (auto& gated : _gated_options)
651  {
652  auto strong = gated.first.lock();
653  if (!strong)
654  return;
655  auto val = strong->query();
656  if (val)
657  {
658  gated_set = true;
659  LOG_WARNING(gated.second.c_str());
660  }
661  }
662 
663  if (!gated_set)
664  _proxy->set(value);
665 
666  _recording_function(*this);
667  }
668 
669  private:
670  std::vector < std::pair<std::weak_ptr<option>, std::string> > _gated_options;
671  };
672 
676  {
677  public:
678  explicit max_distance_option(std::shared_ptr<option> max_option,
679  std::shared_ptr<option> min_option)
680  : proxy_option(max_option), _min_option(min_option)
681  {}
682 
683  void set(float value) override
684  {
685  auto strong = _min_option.lock();
686  if (!strong)
687  return;
688 
689  auto min_value = strong->query();
690 
691  if (min_value > value)
692  {
693  auto min = strong->get_range().min;
694  strong->set(min);
695  }
696  _proxy->set(value);
697  _recording_function(*this);
698  }
699 
700  private:
701  std::weak_ptr<option> _min_option;
702  };
703 
707  {
708  public:
709  explicit min_distance_option(std::shared_ptr<option> min_option,
710  std::shared_ptr<option> max_option)
711  : proxy_option(min_option), _max_option(max_option)
712  {}
713 
714  void set(float value) override
715  {
716  auto strong = _max_option.lock();
717  if (!strong)
718  return;
719 
720  auto max_value = strong->query();
721 
722  if (max_value < value)
723  {
724  auto max = strong->get_range().max;
725  strong->set(max);
726  }
727  _proxy->set(value);
728  _recording_function(*this);
729  }
730 
731  private:
732  std::weak_ptr<option> _max_option;
733  };
734 
736  {
737  public:
738  void set(float value) override;
739 
740  float query() const override;
741 
742  bool is_enabled() const override { return true; }
743 
744  const char* get_description() const override
745  {
746  return "Enable/Disable Automatic Motion Data Correction";
747  }
748 
749  enable_motion_correction(sensor_base* mm_ep, const option_range& opt_range);
750 
751  private:
752  std::atomic<bool> _is_active;
753  };
754 
755 }
option_range get_range() const override
Definition: option.h:564
bool is_enabled() const override
Definition: option.h:456
const option_range _opt_range
Definition: option.h:99
option_range get_range() const override
Definition: option.h:452
auto_disabling_control(std::shared_ptr< option > auto_disabling, std::shared_ptr< option > affected_option, std::vector< float > move_to_manual_values={1.f}, float manual_value=0.f)
Definition: option.h:593
bool is_enabled() const override
Definition: option.h:68
std::weak_ptr< option > _max_option
Definition: option.h:732
gated_option(std::shared_ptr< option > leading_to_read_only, std::vector< std::pair< std::shared_ptr< option >, std::string >> gated_options)
Definition: option.h:636
const char * get_value_description(float val) const override
Definition: option.h:107
class provided a control that changes min distance value when changing max distance value ...
Definition: option.h:675
void enable_recording(std::function< void(const option &)> record_action) override
Definition: option.h:579
const char * get_string(rs2_rs400_visual_preset value)
const char * get_description() const override
Definition: option.h:206
readonly_float_option(const option_range &range)
Definition: option.h:259
void set(float value) override
Definition: option.cpp:35
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
Definition: rs_option.h:22
const char * get_value_description(float val) const override
Definition: option.h:310
option_range get_range() const override
Definition: option.h:357
std::vector< std::pair< std::weak_ptr< option >, std::string > > _gated_options
Definition: option.h:670
virtual void set(float value)=0
float_option_with_description(option_range range, std::string description)
Definition: option.h:250
std::vector< float > _move_to_manual_values
Definition: option.h:627
#define LOG_WARNING(...)
Definition: src/types.h:241
float query() const override
Definition: option.h:197
float_option(option_range range)
Definition: option.h:235
GLfloat value
const char * get_description() const override
Definition: option.h:263
uvc_pu_option(uvc_sensor &ep, rs2_option id)
Definition: option.h:298
std::string _desciption
Definition: option.h:405
bool is_enabled() const override
Definition: option.h:742
cascade_option(Args &&...args)
Definition: option.h:133
const char * get_description() const override
Definition: option.h:253
float query() const override
Definition: option.h:344
protected_xu_option(uvc_sensor &ep, platform::extension_unit xu, uint8_t id, std::string description)
Definition: option.h:414
const char * get_description() const override
Definition: option.h:119
GLsizei const GLchar *const * string
uvc_xu_option(uvc_sensor &ep, platform::extension_unit xu, uint8_t id, std::string description)
Definition: option.h:379
platform::extension_unit _xu
Definition: option.h:501
option_range get_range() const override
Definition: option.h:67
auto_disabling_control class provided a control that disable auto-control when changing the auto disa...
Definition: option.h:590
void enable_recording(std::function< void(const option &)> record_action) override
Definition: option.h:204
#define LRS_EXTENSION_API
Definition: src/types.h:20
unsigned char uint8_t
Definition: stdint.h:78
bool is_read_only() const override
Definition: option.h:44
const char * get_value_description(float val) const override
Definition: option.h:208
void enable_recording(std::function< void(const option &)> record_action) override
Definition: option.h:528
const char * get_description() const override
Definition: option.h:744
const char * get_value_description(float val) const override
Definition: option.h:547
void add_observer(std::function< void(float)> callback)
Definition: option.h:24
void notify(float val)
Definition: option.h:29
bool is_valid(const plane_3d &p)
Definition: rendering.h:243
GLdouble t
bool_option(bool default_on=true)
Definition: option.h:276
std::shared_ptr< option > _proxy
Definition: option.h:584
GLuint GLfloat * val
virtual bool get_xu(const extension_unit &xu, uint8_t ctrl, uint8_t *data, int len) const =0
void set(float value) override
Definition: option.h:332
std::string _desc
Definition: option.h:227
virtual void set_with_no_signal(float value)
Definition: option.h:154
struct_field_option(std::shared_ptr< struct_interface< T, R, W >> struct_interface, U T::*field, const option_range &range)
Definition: option.h:458
std::weak_ptr< option > _affected_control
Definition: option.h:626
std::shared_ptr< struct_field_option< T, R, W, U > > make_field_option(std::shared_ptr< struct_interface< T, R, W >> struct_interface, U T::*field, const option_range &range)
Definition: option.h:481
min_distance_option(std::shared_ptr< option > min_option, std::shared_ptr< option > max_option)
Definition: option.h:709
bool is_read_only() const override
Definition: option.h:574
void set_description(float val, const std::string &desc)
Definition: option.h:218
const char * get_description() const override
Definition: option.h:464
proxy_option(std::shared_ptr< option > proxy_option)
Definition: option.h:543
const char * get_description() const override
Definition: option.h:551
GLdouble x
virtual control_range get_xu_range(const extension_unit &xu, uint8_t ctrl, int len) const =0
const std::map< float, std::string > _description_per_value
Definition: option.h:323
std::atomic< bool > _is_active
Definition: option.h:752
std::shared_ptr< bool_option > ptr
Definition: option.h:281
void enable_recording(std::function< void(const option &)> record_action) override
Definition: option.h:316
polling_errors_disable(std::shared_ptr< polling_error_handler > handler)
Definition: option.h:510
uvc_pu_option(uvc_sensor &ep, rs2_option id, const std::map< float, std::string > &description_per_value)
Definition: option.h:303
const char * get_value_description(float val) const override
Definition: option.h:395
void enable_recording(std::function< void(const option &)> record_action) override
Definition: option.h:51
float query() const override
Definition: option.h:448
def find(dir, mask)
Definition: file.py:25
def callback(frame)
Definition: t265_stereo.py:91
T && forward(typename::boost::move_detail::remove_reference< T >::type &t) BOOST_NOEXCEPT
std::weak_ptr< option > _min_option
Definition: option.h:701
std::map< float, std::string > _item_desc
Definition: option.h:228
uvc_xu_option(uvc_sensor &ep, platform::extension_unit xu, uint8_t id, std::string description, const std::map< float, std::string > &description_per_value)
Definition: option.h:383
gated_option class will permit the user to perform only read (query) of the read_only option when its...
Definition: option.h:633
float query() const override
Definition: option.h:238
const_value_option(std::string desc, float val)
Definition: option.h:60
float query() const override
Definition: option.h:66
max_distance_option(std::shared_ptr< option > max_option, std::shared_ptr< option > min_option)
Definition: option.h:678
GLenum query
ptr_option(T min, T max, T step, T def, T *value, const std::string &desc)
Definition: option.h:164
static auto it
platform::extension_unit _xu
Definition: option.h:403
int min(int a, int b)
Definition: lz4s.c:73
bool is_read_only() const override
Definition: option.h:262
const_value_option(std::string desc, lazy< float > val)
Definition: option.h:63
float query() const override
Definition: option.h:428
command_transfer_over_xu(uvc_sensor &uvc, platform::extension_unit xu, uint8_t ctrl)
Definition: option.h:494
std::shared_ptr< struct_interface< T, R, W > > _struct_interface
Definition: option.h:474
bool is_enabled() const override
Definition: option.h:202
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
std::weak_ptr< polling_error_handler > _polling_error_handler
Definition: option.h:533
const char * get_description() const override
Definition: option.h:387
const std::map< float, std::string > _description_per_value
Definition: option.h:407
const char * get_description() const override
Definition: option.h:279
virtual bool set_xu(const extension_unit &xu, uint8_t ctrl, const uint8_t *data, int len)=0
ptr_option(T min, T max, T step, T def, T *value, const std::string &desc, const std::map< float, std::string > &description_per_value)
Definition: option.h:175
GLsizei range
void update(std::shared_ptr< extension_snapshot > ext) override
Definition: option.h:72
bool is_enabled() const override
Definition: option.h:569
const char * get_description() const override
Definition: option.h:70
bool is_enabled() const override
Definition: option.h:293
class provided a control that changes max distance value when changing min distance value ...
Definition: option.h:706
signed int int32_t
Definition: stdint.h:77
#define LOG_DEBUG(...)
Definition: src/types.h:239
void on_set(std::function< void(float)> on_set)
Definition: option.h:223
void enable_recording(std::function< void(const option &)> record_action) override
Definition: option.h:469
bool is_enabled() const override
Definition: option.h:377
option_description(std::string description)
Definition: option.h:116
float query() const override
Definition: option.h:559
protected_xu_option(uvc_sensor &ep, platform::extension_unit xu, uint8_t id, std::string description, const std::map< float, std::string > &description_per_value)
Definition: option.h:418
std::function< void(float)> _on_set
Definition: option.h:229
Definition: parser.hpp:150
option_base(const option_range &opt_range)
Definition: option.h:89
const char * get_description() const override
Definition: option.h:241
bool is_enabled() const override
Definition: option.h:239
std::vector< std::function< void(float)> > _callbacks
Definition: option.h:38
std::string to_string(T value)
void enable_recording(std::function< void(const option &)> record_action) override
Definition: option.h:391


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:38