Class context

Class Documentation

class context

default librealsense context class includes realsense API version as provided by RS2_API_VERSION macro

Public Types

enum uninitialized_t

Values:

enumerator uninitialized

Public Functions

inline context(uninitialized_t)
inline context(char const *json_settings = nullptr)
inline context(std::string const &json_settings)
inline operator bool() const
inline device_list query_devices() const

create a static snapshot of all connected devices at the time of the call

Returns:

the list of devices connected devices at the time of the call

inline device_list query_devices(int mask) const

create a static snapshot of all connected devices at the time of the call

Returns:

the list of devices connected devices at the time of the call

inline std::vector<sensor> query_all_sensors() const

Generate a flat list of all available sensors from all RealSense devices.

Returns:

List of sensors

inline device get_sensor_parent(const sensor &s) const
template<class T>
inline void set_devices_changed_callback(T callback)

register devices changed callback

Parameters:

callback[in] devices changed callback

inline playback load_device(const std::string &file)

Creates a device from a RealSense file

On successful load, the device will be appended to the context and a devices_changed event triggered

Parameters:

file – Path to a RealSense File

Returns:

A playback device matching the given file

inline void unload_device(const std::string &file)
inline void unload_tracking_module()
inline context(std::shared_ptr<rs2_context> ctx)
inline explicit operator std::shared_ptr<rs2_context>()

Protected Attributes

std::shared_ptr<rs2_context> _context

Friends

friend class rs2::pipeline
friend class rs2::device_hub
friend class rs2::software_device