device.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 <chrono>
7 #include <memory>
8 #include <vector>
9 
10 #include "backend.h"
11 #include "archive.h"
12 #include "hw-monitor.h"
13 #include "option.h"
14 #include "sensor.h"
15 #include "sync.h"
16 #include "core/streaming.h"
17 
18 #include "context.h"
19 
20 namespace librealsense
21 {
22  stream_interface* find_profile(rs2_stream stream, int index, std::vector<stream_interface*> profiles);
23 
25  {
26  public:
27  static std::shared_ptr<matcher> create(rs2_matchers matcher, std::vector<stream_interface*> profiles);
28 
29  private:
30  static std::shared_ptr<matcher> create_DLR_C_matcher(std::vector<stream_interface*> profiles);
31  static std::shared_ptr<matcher> create_DLR_matcher(std::vector<stream_interface*> profiles);
32  static std::shared_ptr<matcher> create_DI_C_matcher(std::vector<stream_interface*> profiles);
33  static std::shared_ptr<matcher> create_DI_matcher(std::vector<stream_interface*> profiles);
34 
35  static std::shared_ptr<matcher> create_identity_matcher(stream_interface* profiles);
36  static std::shared_ptr<matcher> create_frame_number_matcher(std::vector<stream_interface*> profiles);
37  static std::shared_ptr<matcher> create_timestamp_matcher(std::vector<stream_interface*> profiles);
38 
39  static std::shared_ptr<matcher> create_timestamp_composite_matcher(std::vector<std::shared_ptr<matcher>> matchers);
40  static std::shared_ptr<matcher> create_frame_number_composite_matcher(std::vector<std::shared_ptr<matcher>> matchers);
41  };
42 
43  class device : public virtual device_interface, public info_container
44  {
45  public:
46  virtual ~device();
47  size_t get_sensors_count() const override;
48 
49  sensor_interface& get_sensor(size_t subdevice) override;
50  const sensor_interface& get_sensor(size_t subdevice) const override;
51 
52  void hardware_reset() override;
53 
54  virtual std::shared_ptr<matcher> create_matcher(const frame_holder& frame) const override;
55 
56  size_t find_sensor_idx(const sensor_interface& s) const;
57 
58  std::shared_ptr<context> get_context() const override {
59  return _context;
60  }
61 
63  {
64  return _group;
65  }
66 
67  std::pair<uint32_t, rs2_extrinsics> get_extrinsics(const stream_interface& stream) const override;
68 
69  bool is_valid() const override
70  {
71  std::lock_guard<std::mutex> lock(_device_changed_mtx);
72  return _is_valid;
73  }
74 
75  void tag_profiles(stream_profiles profiles) const override;
76 
77  virtual bool compress_while_record() const override { return true; }
78 
79  virtual bool contradicts(const stream_profile_interface* a, const std::vector<stream_profile>& others) const override;
80 
81  virtual void stop_activity() const;
82 
83  protected:
84  int add_sensor(const std::shared_ptr<sensor_interface>& sensor_base);
85  int assign_sensor(const std::shared_ptr<sensor_interface>& sensor_base, uint8_t idx);
86  void register_stream_to_extrinsic_group(const stream_interface& stream, uint32_t groupd_index);
87  std::vector<rs2_format> map_supported_color_formats(rs2_format source_format);
88 
89  explicit device(std::shared_ptr<context> ctx,
91  bool device_changed_notifications = false);
92 
93  std::map<int, std::pair<uint32_t, std::shared_ptr<const stream_interface>>> _extrinsics;
94 
95  private:
96  std::vector<std::shared_ptr<sensor_interface>> _sensors;
97  std::shared_ptr<context> _context;
99  bool _is_valid, _device_changed_notifications;
100  mutable std::mutex _device_changed_mtx;
103  };
104 }
static const textual_icon lock
Definition: model-views.h:218
static std::shared_ptr< matcher > create_timestamp_composite_matcher(std::vector< std::shared_ptr< matcher >> matchers)
Definition: device.cpp:121
std::mutex _device_changed_mtx
Definition: device.h:100
static std::shared_ptr< matcher > create_DLR_matcher(std::vector< stream_interface * > profiles)
Definition: device.cpp:68
GLdouble s
uint64_t _callback_id
Definition: device.h:101
GLuint GLuint stream
Definition: glext.h:1790
unsigned char uint8_t
Definition: stdint.h:78
GLuint index
GLboolean GLboolean GLboolean GLboolean a
static std::shared_ptr< matcher > create_DLR_C_matcher(std::vector< stream_interface * > profiles)
Definition: device.cpp:42
stream_interface * find_profile(rs2_stream stream, int index, std::vector< stream_interface * > profiles)
Definition: device.cpp:29
bool is_valid() const override
Definition: device.h:69
static std::shared_ptr< matcher > create_frame_number_matcher(std::vector< stream_interface * > profiles)
Definition: device.cpp:95
unsigned int uint32_t
Definition: stdint.h:80
rs2_matchers
Specifies types of different matchers.
Definition: rs_types.h:230
GLboolean GLuint group
Definition: glext.h:5688
std::map< int, std::pair< uint32_t, std::shared_ptr< const stream_interface > > > _extrinsics
Definition: device.h:93
unsigned __int64 uint64_t
Definition: stdint.h:90
virtual bool compress_while_record() const override
Definition: device.h:77
rs2_format
A stream&#39;s format identifies how binary data is encoded within a frame.
Definition: rs_sensor.h:59
std::vector< std::shared_ptr< stream_profile_interface >> stream_profiles
Definition: streaming.h:165
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:42
std::shared_ptr< context > get_context() const override
Definition: device.h:58
static std::shared_ptr< matcher > create_DI_C_matcher(std::vector< stream_interface * > profiles)
Definition: device.cpp:55
static std::shared_ptr< matcher > create_frame_number_composite_matcher(std::vector< std::shared_ptr< matcher >> matchers)
Definition: device.cpp:117
lazy< std::vector< tagged_profile > > _profiles_tags
Definition: device.h:102
std::shared_ptr< context > _context
Definition: device.h:97
static std::shared_ptr< matcher > create_identity_matcher(stream_interface *profiles)
Definition: device.cpp:112
std::vector< std::shared_ptr< sensor_interface > > _sensors
Definition: device.h:96
def get_extrinsics(src, dst)
Definition: t265_stereo.py:57
const platform::backend_device_group _group
Definition: device.h:98
platform::backend_device_group get_device_data() const override
Definition: device.h:62
static std::shared_ptr< matcher > create_timestamp_matcher(std::vector< stream_interface * > profiles)
Definition: device.cpp:103
auto device
Definition: pyrs_net.cpp:17
static std::shared_ptr< matcher > create(rs2_matchers matcher, std::vector< stream_interface * > profiles)
Definition: device.cpp:11
static std::shared_ptr< matcher > create_DI_matcher(std::vector< stream_interface * > profiles)
Definition: device.cpp:82


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