forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
108 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// License: Apache 2.0. See LICENSE file in root directory. | ||
// Copyright(c) 2023 Intel Corporation. All Rights Reserved. | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
#include <vector> | ||
#include <functional> | ||
|
||
|
||
struct rs2_device_info; | ||
|
||
|
||
namespace librealsense { | ||
|
||
|
||
class device_info; | ||
class context; | ||
|
||
|
||
// Interface for device factories, allowing for: | ||
// - notification callbacks for any device additions and removals | ||
// - querying of current devices in the system | ||
// | ||
// A device factory is contained by a context, 1:1. I.e., multiple factory instances may exist at once, each for a | ||
// different context. | ||
// | ||
|
||
class device_factory | ||
{ | ||
protected: | ||
context & _context; | ||
|
||
device_factory( context & ctx ) | ||
: _context( ctx ) | ||
{ | ||
} | ||
|
||
public: | ||
// Callbacks take this form. | ||
// | ||
using callback = std::function< void( std::vector< rs2_device_info > & devices_removed, | ||
std::vector< rs2_device_info > & devices_added ) >; | ||
|
||
virtual ~device_factory() = default; | ||
|
||
// Query any subset of available devices and return them as device-info objects from which actual devices can be | ||
// created as needed. | ||
// | ||
// Devices will match both the requested mask and the device-mask from the context settings. See | ||
// RS2_PRODUCT_LINE_... defines for possible values. | ||
// | ||
virtual std::vector< std::shared_ptr< device_info > > query_devices( unsigned mask ) const = 0; | ||
}; | ||
|
||
|
||
} // namespace librealsense |