backend-device-factory.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2023 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
7 #include <rsutils/subscription.h>
8 
9 
10 namespace librealsense {
11 
12 
13 class device_watcher_singleton;
14 
15 
16 namespace platform {
17 struct backend_device_group;
18 class platform_device_info;
19 } // namespace platform
20 
21 
22 // This factory creates "backend devices", or devices that require the backend to be detected and used. In other words,
23 // UVC devices.
24 //
25 // The factory abstracts away platform-specific concepts such that all the user has to do is supply a callback to know
26 // when changes in the list of devices have been made.
27 //
28 // Any devices created here will have a device-info that derives from platform::platform_device_info. This factory
29 // manages these device-info objects such that lifetime is tracked and updated appropriately, without the caller's
30 // knowledge.
31 //
33 {
35 
36  std::shared_ptr< device_watcher_singleton > const _device_watcher;
37  rsutils::subscription const _dtor; // raii generic code, used to automatically unsubscribe our callback
38 
39 public:
40  backend_device_factory( std::shared_ptr< context > const &, callback && );
42 
43  // Query any subset of available devices and return them as device-info objects
44  // Devices will match both the requested mask and the device-mask from the context settings
45  //
46  std::vector< std::shared_ptr< device_info > > query_devices( unsigned mask ) const override;
47 
48 private:
49  std::vector< std::shared_ptr< platform::platform_device_info > >
51 };
52 
53 
54 } // namespace librealsense
librealsense
Definition: algo.h:18
librealsense::device_factory
Definition: device-factory.h:26
subscription.h
librealsense::platform::backend_device_group
Definition: backend-device-group.h:50
librealsense::backend_device_factory::query_devices
std::vector< std::shared_ptr< device_info > > query_devices(unsigned mask) const override
Definition: backend-device-factory.cpp:172
mask
GLint GLuint mask
Definition: glad/glad/glad.h:1460
librealsense::backend_device_factory::_dtor
const rsutils::subscription _dtor
Definition: backend-device-factory.h:37
librealsense::backend_device_factory::_device_watcher
const std::shared_ptr< device_watcher_singleton > _device_watcher
Definition: backend-device-factory.h:36
librealsense::backend_device_factory::~backend_device_factory
~backend_device_factory()
Definition: backend-device-factory.cpp:167
librealsense::backend_device_factory::create_devices_from_group
std::vector< std::shared_ptr< platform::platform_device_info > > create_devices_from_group(platform::backend_device_group, int mask) const
Definition: backend-device-factory.cpp:191
librealsense::backend_device_factory
Definition: backend-device-factory.h:32
librealsense::backend_device_factory::backend_device_factory
backend_device_factory(std::shared_ptr< context > const &, callback &&)
Definition: backend-device-factory.cpp:129
librealsense::backend_device_factory::super
device_factory super
Definition: backend-device-factory.h:34
rsutils::subscription
Definition: subscription.h:25
device-factory.h
librealsense::device_factory::callback
std::function< void(std::vector< std::shared_ptr< device_info > > const &devices_removed, std::vector< std::shared_ptr< device_info > > const &devices_added) > callback
Definition: device-factory.h:40


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Mon Apr 22 2024 02:12:55