9 #ifndef LIBREALSENSE_TYPES_H 10 #define LIBREALSENSE_TYPES_H 12 #include "../include/librealsense2/hpp/rs_types.hpp" 24 #include <condition_variable> 29 #if BUILD_EASYLOGGINGPP 30 #include "../third-party/easyloggingpp/src/easylogging++.h" 31 #endif // BUILD_EASYLOGGINGPP 33 typedef unsigned char byte;
41 #pragma warning(disable: 4250) 44 #include "../common/android_helpers.h" 49 #define UNKNOWN_VALUE "UNKNOWN" 56 std::ostringstream
ss;
58 operator std::string()
const {
return ss.str(); }
61 template<
typename T,
size_t size>
64 assert(dst !=
nullptr && src !=
nullptr);
65 for (
size_t i = 0; i <
size; i++)
72 template<
typename T,
size_t sizem,
size_t sizen>
73 inline size_t copy_2darray(T(&dst)[sizem][sizen],
const T(&src)[sizem][sizen])
75 assert(dst !=
nullptr && src !=
nullptr);
76 for (
size_t i = 0; i < sizem; i++)
78 for (
size_t j = 0; j < sizen; j++)
80 dst[i][j] = src[i][j];
86 void copy(
void* dst,
void const* src,
size_t size);
97 #if BUILD_EASYLOGGINGPP 99 #define LOG_DEBUG(...) do { CLOG(DEBUG ,"librealsense") << __VA_ARGS__; } while(false) 100 #define LOG_INFO(...) do { CLOG(INFO ,"librealsense") << __VA_ARGS__; } while(false) 101 #define LOG_WARNING(...) do { CLOG(WARNING ,"librealsense") << __VA_ARGS__; } while(false) 102 #define LOG_ERROR(...) do { CLOG(ERROR ,"librealsense") << __VA_ARGS__; } while(false) 103 #define LOG_FATAL(...) do { CLOG(FATAL ,"librealsense") << __VA_ARGS__; } while(false) 105 #else // BUILD_EASYLOGGINGPP 107 #define LOG_DEBUG(...) do { ; } while(false) 108 #define LOG_INFO(...) do { ; } while(false) 109 #define LOG_WARNING(...) do { ; } while(false) 110 #define LOG_ERROR(...) do { ; } while(false) 111 #define LOG_FATAL(...) do { ; } while(false) 113 #endif // BUILD_EASYLOGGINGPP 117 template<
typename T>
122 const T t = val < min ? min : val;
123 return t > max ? max : t;
125 return std::min(std::max(val, min), max);
144 return _exception_type;
147 const char*
what() const noexcept
override 156 _exception_type(exception_type)
213 std::string generate_last_error_message(
const std::string& msg)
const 215 return msg +
" Last Error: " + strerror(errno);
253 #pragma pack(push, 1) 261 for (
unsigned int i = 0; i < sizeof(T); ++i) reinterpret_cast<char *>(&le_value)[i] = reinterpret_cast<const char *>(&be_value)[
sizeof(T) - i - 1];
271 lazy() : _init([]() { T t{};
return t; }) {}
272 lazy(std::function<T()> initializer) : _init(
std::move(initializer)) {}
291 std::lock_guard<std::mutex> lock(other._mtx);
292 if (!other._was_init)
294 _init = move(other._init);
299 _init = move(other._init);
301 _ptr = move(other._ptr);
307 return *
this =
lazy<T>(std::move(func));
312 std::lock_guard<std::mutex> lock1(_mtx);
313 std::lock_guard<std::mutex> lock2(other._mtx);
314 if (!other._was_init)
316 _init = move(other._init);
321 _init = move(other._init);
323 _ptr = move(other._ptr);
332 std::lock_guard<std::mutex> lock(_mtx);
335 _ptr = std::unique_ptr<T>(
new T(_init()));
341 mutable std::mutex _mtx;
342 mutable bool _was_init =
false;
343 std::function<T()> _init;
344 mutable std::unique_ptr<T> _ptr;
352 static std::atomic<uint64_t> id(0);
360 template<
typename T,
int sz>
369 std::stringstream ss;
370 for (
auto i = 0; i <
arr_size(data); i++)
371 ss <<
" [" << i <<
"] = " << data[i] <<
"\t";
382 #define RS2_ENUM_HELPERS(TYPE, PREFIX) const char* get_string(TYPE value); \ 383 inline bool is_valid(TYPE value) { return value >= 0 && value < RS2_##PREFIX##_COUNT; } \ 384 inline std::ostream & operator << (std::ostream & out, TYPE value) { if(is_valid(value)) return out << get_string(value); else return out << (int)value; } \ 385 inline bool try_parse(const std::string& str, TYPE& res) \ 387 for (int i = 0; i < static_cast<int>(RS2_ ## PREFIX ## _COUNT); i++) { \ 388 auto v = static_cast<TYPE>(i); \ 389 if(str == get_string(v)) { res = v; return true; } \ 411 #pragma pack(push, 1) 436 for (
int j = 0; j < 3; j++)
437 for (
int i = 0; i < 3; i++)
438 r.orientation(i, j) = a.
rotation[j * 3 + i];
445 for (
int j = 0; j < 3; j++)
446 for (
int i = 0; i < 3; i++)
453 for (
int i = 0; i < 3; i++) r.
translation[i] = 0.f;
454 for (
int j = 0; j < 3; j++)
455 for (
int i = 0; i < 3; i++)
456 r.
rotation[j * 3 + i] = (i == j) ? 1.f : 0.f;
467 typedef std::tuple<platform::stream_profile_tuple, native_pixel_format_tuple, std::vector<output_tuple>>
request_mapping_tuple;
501 std::vector<std::pair<stream_descriptor, rs2_format>>
outputs;
512 if (o.first.type ==
stream && o.first.index == index)
520 if (o.first.type ==
stream && o.first.index == index)
526 operator std::vector<output_tuple>()
528 std::vector<output_tuple> tuple_outputs;
532 tuple_outputs.push_back(std::make_tuple(output.first.type, output.first.index, output.second));
534 return tuple_outputs;
554 class stream_profile_interface;
585 class frame_interface;
596 operator bool()
const {
return frame !=
nullptr; }
610 other.
frame =
nullptr;
626 int m_major, m_minor, m_patch, m_build;
628 std::string string_representation;
631 static std::vector<std::string> split(
const std::string& str);
632 static int parse_part(
const std::string&
name,
int part);
638 : m_major(major), m_minor(minor), m_patch(patch), m_build(build), is_any(is_any), string_representation(
to_string()) {}
646 : m_major(parse_part(
name, 0)), m_minor(parse_part(
name, 1)), m_patch(parse_part(
name, 2)), m_build(parse_part(
name, 3)), is_any(false), string_representation(
to_string()) {}
650 if (is_any || other.is_any)
return true;
651 if (m_major > other.m_major)
return false;
652 if ((m_major == other.m_major) && (m_minor > other.m_minor))
return false;
653 if ((m_major == other.m_major) && (m_minor == other.m_minor) && (m_patch > other.m_patch))
return false;
654 if ((m_major == other.m_major) && (m_minor == other.m_minor) && (m_patch == other.m_patch) && (m_build > other.m_build))
return false;
659 return is_any || (other.m_major == m_major && other.m_minor == m_minor && other.m_patch == m_patch && other.m_build == m_build);
669 return (from <= *
this) && (*
this <= until);
672 operator const char*()
const 674 return string_representation.c_str();
677 operator std::string()
const 679 return string_representation.c_str();
695 template<
class U>
double get(U T::* field) {
activate();
return static_cast<double>(
struct_.*field); }
700 template<
class T,
class R,
class W>
703 return std::make_shared<struct_interface<T, R, W>>(r, w);
707 template <
typename T,
typename S>
712 last_input(
std::numeric_limits<T>::lowest()), accumulated(0) {
716 (std::numeric_limits<T>::max() < std::numeric_limits<S>::max()) &&
717 (std::numeric_limits<T>::lowest() >= std::numeric_limits<S>::lowest())
718 ,
"Wraparound class requirements are not met");
723 accumulated +=
static_cast<T
>(input - last_input);
725 return (accumulated);
728 void reset() { last_input = std::numeric_limits<T>::lowest(); accumulated = 0; }
745 operator bool()
const {
return fptr !=
nullptr; }
749 try { fptr(
frame, user); }
catch (...)
751 LOG_ERROR(
"Received an execption from frame callback!");
783 operator bool()
const {
return nptr !=
nullptr; }
790 LOG_ERROR(
"Received an execption from frame callback!");
807 operator bool()
const {
return nptr !=
nullptr; }
811 try { nptr(removed, added, user); }
814 LOG_ERROR(
"Received an execption from frame callback!");
827 using internal_callback = std::function<void(rs2_device_list* removed, rs2_device_list* added)>;
834 : _callback(callback)
839 _callback(removed , added);
851 timestamp = std::chrono::duration<double, std::milli>(std::chrono::system_clock::now().time_since_epoch()).count();
883 std::mutex _callback_mutex;
892 return{ i.
width + pad_crop * 2, i.
height + pad_crop * 2, i.
ppx + pad_crop, i.
ppy + pad_crop,
898 const float sx =
static_cast<float>(width) / i.
width, sy = static_cast<float>(height) / i.
height;
905 inline uint32_t
pack(uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3)
907 return (c0 << 24) | (c1 << 16) | (c2 << 8) | c3;
910 template<
class T,
int C>
916 bool keep_allocating =
true;
917 std::condition_variable cv;
923 for (
auto i = 0; i < C; i++)
926 buffer[i] = std::move(T());
932 std::unique_lock<std::mutex> lock(mutex);
933 if (!keep_allocating)
return nullptr;
935 for (
auto i = 0; i < C; i++)
949 if (item < buffer || item >= buffer + C)
953 auto i = item - buffer;
954 auto old_value = std::move(buffer[i]);
955 buffer[i] = std::move(T());
958 std::unique_lock<std::mutex> lock(mutex);
973 std::unique_lock<std::mutex> lock(mutex);
974 keep_allocating =
false;
979 std::unique_lock<std::mutex> lock(mutex);
981 const auto ready = [
this]()
985 if (!ready() && !cv.wait_for(lock, std::chrono::hours(1000), ready))
1004 operator std::string()
1006 std::stringstream s;
1007 s <<
"id- " <<
id <<
1008 "\nvid- " << std::hex <<
vid <<
1009 "\npid- " << std::hex <<
pid <<
1021 return (a.
vid == b.
vid) &&
1038 operator std::string()
1040 std::stringstream s;
1042 s <<
"vid- " << std::hex <<
vid <<
1043 "\npid- " << std::hex <<
pid <<
1054 return (a.
id == b.
id) &&
1069 operator std::string()
1071 std::stringstream s;
1072 s <<
"id- " <<
id <<
1073 "\nvid- " << std::hex <<
vid <<
1074 "\npid- " << std::hex <<
pid <<
1085 return (a.
id == b.
id) &&
1095 devices_data(std::vector<uvc_device_info> uvc_devices, std::vector<usb_device_info> usb_devices, std::vector<hid_device_info> hid_devices)
1101 devices_data(std::vector<uvc_device_info> uvc_devices, std::vector<usb_device_info> usb_devices)
1114 operator std::string()
1145 std::chrono::high_resolution_clock::time_point
started;
1146 std::chrono::high_resolution_clock::time_point
ended;
1158 : invocation(other.invocation), owner(other.owner)
1160 other.invocation =
nullptr;
1164 : invocation(invocation), owner(owner)
1169 if (invocation) owner->
deallocate(invocation);
1174 invocation = other.invocation;
1175 owner = other.owner;
1176 other.invocation =
nullptr;
1182 return invocation !=
nullptr;
1192 std::function<void()> continuation;
1193 const void* protected_data =
nullptr;
1200 explicit frame_continuation(std::function<
void()> continuation,
const void* protected_data) : continuation(continuation), protected_data(protected_data) {}
1205 other.continuation = []() {};
1206 other.protected_data =
nullptr;
1212 continuation = []() {};
1213 protected_data =
nullptr;
1218 protected_data =
nullptr;
1219 continuation = [](){};
1222 const void*
get_data()
const {
return protected_data; }
1227 protected_data = other.protected_data;
1228 continuation = other.continuation;
1229 other.continuation = []() {};
1230 other.protected_data =
nullptr;
1246 std::function<
bool(
rs2_stream)> intrinsic_validator);
1253 std::function<bool(rs2_stream from_stream, rs2_stream to_stream)> extrinsic_validator;
1254 std::function<bool(rs2_stream stream)> intrinsic_validator;
1259 return std::find_if(data.begin(), data.end(), [](
byte b){
return b!=0; }) != data.end();
1271 uint32_t
calc_crc32(
const uint8_t *buf,
size_t bufsize);
1278 _backend(backend_ref),_active_object([this](
dispatcher::cancellable_timer cancellable_timer)
1302 _callback(_devices_data, curr);
1303 _devices_data = curr;
1312 _callback = std::move(callback);
1317 _active_object.
start();
1322 _active_object.
stop();
1339 template<
typename HostingClass,
typename... Args>
1342 friend HostingClass;
1350 std::lock_guard<std::mutex> locker(other.m_mutex);
1351 m_subscribers = std::move(other.m_subscribers);
1353 other.m_subscribers.clear();
1358 std::lock_guard<std::mutex> locker(other.m_mutex);
1359 m_subscribers = std::move(other.m_subscribers);
1361 other.m_subscribers.clear();
1367 std::lock_guard<std::mutex> locker(m_mutex);
1370 for (
int i = 0; i < (std::numeric_limits<int>::max)(); i++)
1372 if (m_subscribers.find(i) == m_subscribers.end())
1381 m_subscribers.emplace(token, func);
1389 std::lock_guard<std::mutex> locker(m_mutex);
1391 bool retVal =
false;
1392 typename std::map<int, std::function<void(Args...)>>::iterator it = m_subscribers.find(token);
1393 if (it != m_subscribers.end())
1395 m_subscribers.erase(token);
1416 bool raise(Args... args)
1418 std::vector<std::function<void(Args...)>> functions;
1419 bool retVal =
false;
1421 std::unique_lock<std::mutex> locker(m_mutex);
1422 if (m_subscribers.size() > 0)
1424 typename std::map<int, std::function<void(Args...)>>::iterator it = m_subscribers.begin();
1425 while (it != m_subscribers.end())
1427 functions.emplace_back(it->second);
1433 if (functions.size() > 0)
1435 for (
auto func : functions)
1437 func(std::forward<Args>(args)...);
1446 bool operator()(Args... args)
1448 return raise(std::forward<Args>(args)...);
1452 std::map<int, std::function<void(Args...)>> m_subscribers;
1455 template <
typename T>
1462 operator bool()
const 1480 if (!_valid)
throw std::runtime_error(
"bad optional access");
1486 if (!_valid)
throw std::runtime_error(
"bad optional access");
1487 return std::move(_value);
1508 return std::move(_value);
1525 return (hash<uint32_t>()(k.
height))
1526 ^ (hash<uint32_t>()(k.
width))
1527 ^ (hash<uint32_t>()(k.
fps))
1528 ^ (hash<uint32_t>()(k.
format))
1529 ^ (hash<uint32_t>()(k.
stream));
1540 return (hash<uint32_t>()(k.
height))
1541 ^ (hash<uint32_t>()(k.
width))
1542 ^ (hash<uint32_t>()(k.
fps))
1543 ^ (hash<uint32_t>()(k.
format));
1555 ^ (hash<librealsense::pixel_format_unpacker*>()(k.
unpacker))
1556 ^ (hash<librealsense::native_pixel_format*>()(k.
pf));
1564 return first == second;
1568 std::vector<std::shared_ptr<T>>
subtract_sets(
const std::vector<std::shared_ptr<T>>& first,
const std::vector<std::shared_ptr<T>>& second)
1570 std::vector<std::shared_ptr<T>> results;
1571 std::for_each(first.begin(), first.end(), [&](std::shared_ptr<T> data)
1573 if (std::find_if(second.begin(), second.end(), [&](std::shared_ptr<T> new_dev) {
1577 results.push_back(data);
1593 else if (width < 640)
bool operator<(const request_mapping &first, const request_mapping &second)
Definition: types.h:574
int arr_size(T(&)[sz])
Definition: types.h:361
internal_frame_callback(T on_frame)
Definition: types.h:763
S calc(const T input)
Definition: types.h:721
rs2_camera_info
Read-only strings that can be queried from the device. Not all information attributes are available o...
Definition: rs_sensor.h:22
float3x3 orientation
Definition: types.h:417
Definition: rs_types.hpp:27
const double DBL_EPSILON
Definition: types.h:38
rs2_intrinsics scale_intrinsics(const rs2_intrinsics &i, int width, int height)
Definition: types.h:896
float3 x
Definition: types.h:416
bool requires_processing() const
Definition: types.h:570
T & value() &
Definition: types.h:1478
void deallocate(T *item)
Definition: types.h:947
void stop_allocation()
Definition: types.h:971
std::string device_path
Definition: types.h:1002
T * allocate()
Definition: types.h:930
camera_disconnected_exception(const std::string &msg) noexcept
Definition: types.h:191
rs2_exception_type
Exception types are the different categories of errors that RealSense API might return.
Definition: rs_types.h:28
T & operator*() &
Definition: types.h:1502
int get_size() const
Definition: types.h:992
bool validate_extrinsics(rs2_stream from_stream, rs2_stream to_stream) const
wrong_api_call_sequence_exception(const std::string &msg) noexcept
Definition: types.h:239
float x
Definition: types.h:414
std::vector< usb_device_info > _usb_devices
Definition: types.h:1105
signal()
Definition: types.h:1344
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
Definition: rs_option.h:22
rs2_extrinsics from_pose(pose a)
Definition: types.h:441
unsigned char byte
Definition: types.h:33
io_exception(const std::string &msg) noexcept
Definition: types.h:184
Definition: streaming.h:63
std::tuple< rs2_stream, int, rs2_format > output_tuple
Definition: types.h:466
bool has_value() const
Definition: types.h:1466
Definition: rs_types.hpp:41
rs2_notification_category category
Definition: types.h:855
bool operator==(const devices_data &other)
Definition: types.h:1108
std::shared_ptr< rs2_frame_callback > frame_callback_ptr
Definition: types.h:822
Definition: serialization.h:324
notifications_callback()
Definition: types.h:780
void stop() override
Definition: types.h:1320
float w
Definition: types.h:415
rs2_distortion
Distortion model: defines how pixel coordinates should be mapped to sensor coordinates.
Definition: rs_types.h:43
float translation[3]
Definition: rs_sensor.h:82
Definition: concurrency.h:268
std::shared_ptr< struct_interface< T, R, W > > make_struct_interface(R r, W w)
Definition: types.h:701
Definition: rs_types.h:35
std::string array2str(T &data)
Definition: types.h:367
bool operator==(const firmware_version &other) const
Definition: types.h:657
std::string make_less_screamy(const char *str)
rs2_sr300_visual_preset
For SR300 devices: provides optimized settings (presets) for specific types of usage.
Definition: rs_option.h:70
res_type get_res_type(uint32_t width, uint32_t height)
Definition: types.h:1589
float y
Definition: types.h:414
frame_holder(frame_holder &&other)
Definition: types.h:607
const char * what() const noexcept override
Definition: types.h:147
Definition: concurrency.h:125
std::vector< std::shared_ptr< stream_profile_interface > > original_requests
Definition: types.h:563
float & operator[](int i)
Definition: types.h:413
virtual ~notification_decoder()=default
std::chrono::high_resolution_clock::time_point started
Definition: types.h:1145
float3 operator*(const float3 &a, float b)
Definition: types.h:421
bool operator==(const float3 &a, const float3 &b)
Definition: types.h:419
float & operator()(int i, int j)
Definition: types.h:416
void polling(dispatcher::cancellable_timer cancellable_timer)
Definition: types.h:1290
stream_descriptor(rs2_stream type, int index=0)
Definition: types.h:491
uint32_t width
Definition: types.h:473
R reader
Definition: types.h:688
std::function< void(frame_interface *)> on_frame
Definition: streaming.h:103
void(* frame_callback_function_ptr)(rs2_frame *frame, void *user)
Definition: types.h:735
unique_id & operator=(const unique_id &)=delete
T struct_
Definition: types.h:687
frame()
Definition: archive.h:69
backend_exception(const std::string &msg, rs2_exception_type exception_type) noexcept
Definition: types.h:199
std::string unique_id
Definition: types.h:1066
void stop()
Definition: concurrency.h:284
float & operator[](int i)
Definition: types.h:414
devices_changed_callback()
Definition: types.h:804
frame_callback(frame_callback_function_ptr on_frame, void *user)
Definition: types.h:743
float3 y
Definition: types.h:416
lazy(std::function< T()> initializer)
Definition: types.h:272
T * operator->() const
Definition: types.h:274
float coeffs[5]
Definition: rs_types.h:64
void(* notifications_callback_function_ptr)(rs2_notification *notification, void *user)
Definition: types.h:773
std::vector< std::shared_ptr< T > > subtract_sets(const std::vector< std::shared_ptr< T >> &first, const std::vector< std::shared_ptr< T >> &second)
Definition: types.h:1568
void release() override
Definition: types.h:818
virtual notification decode(int value)=0
bool check_not_all_zeros(std::vector< byte > data)
Definition: types.h:1257
bool operator>(const firmware_version &other) const
Definition: types.h:662
void log_to_file(rs2_log_severity min_severity, const char *file_path)
Definition: rs.hpp:26
signal & operator=(signal &&other)
Definition: types.h:1356
librealsense::small_heap< callback_invocation, 1 > callbacks_heap
Definition: types.h:1149
Definition: rs_types.h:31
void on_frame(rs2_frame *fref) override
Definition: types.h:765
static firmware_version any()
Definition: types.h:640
uint32_t height
Definition: types.h:473
T * operator->()
Definition: types.h:1494
notifications_callback_ptr get_callback() const
bool unsubscribe(int token)
Definition: types.h:1387
void activate()
Definition: types.h:694
rs2_extrinsics identity_matrix()
Definition: types.h:450
void release() override
Definition: types.h:842
native_pixel_format * pf
Definition: types.h:559
pixel_format_unpacker * unpacker
Definition: types.h:560
frame_holder clone() const
std::tuple< platform::stream_profile_tuple, native_pixel_format_tuple, std::vector< output_tuple > > request_mapping_tuple
Definition: types.h:467
float rotation[9]
Definition: rs_sensor.h:81
uint32_t fps
Definition: types.h:473
lazy & operator=(lazy &&other) noexcept
Definition: types.h:310
lazy & operator=(std::function< T()> func) noexcept
Definition: types.h:305
res_type
Definition: types.h:1583
float3x3 transpose(const float3x3 &a)
Definition: types.h:427
float ppx
Definition: rs_types.h:59
bool list_changed(const std::vector< T > &list1, const std::vector< T > &list2, std::function< bool(T, T)> equal=[](T first, T second) { return first==second;})
Definition: backend.h:38
bool active
Definition: types.h:690
pose inverse(const pose &a)
Definition: types.h:431
float3 position
Definition: types.h:417
bool try_sleep(int ms)
Definition: concurrency.h:135
pose to_pose(const rs2_extrinsics &a)
Definition: types.h:432
struct_interface(R r, W w)
Definition: types.h:692
std::unique_ptr< rs2_log_callback, void(*)(rs2_log_callback *)> log_callback_ptr
Definition: types.h:821
recoverable_exception(const std::string &msg, rs2_exception_type exception_type) noexcept
uint16_t mi
Definition: types.h:1035
arithmetic_wraparound()
Definition: types.h:711
std::function< void(devices_data old, devices_data curr)> device_changed_callback
Definition: types.h:1142
invalid_value_exception(const std::string &msg) noexcept
Definition: types.h:231
bool validate_intrinsics(rs2_stream stream) const
Definition: rs_types.h:37
T & operator*()
Definition: types.h:279
W writer
Definition: types.h:689
unrecoverable_exception(const std::string &msg, rs2_exception_type exception_type) noexcept
Definition: types.h:174
~polling_device_watcher()
Definition: types.h:1285
bool operator!=(const firmware_version &other) const
Definition: types.h:663
frame_continuation(frame_continuation &&other)
Definition: types.h:1203
Definition: rs_types.h:32
frame_continuation & operator=(frame_continuation &&other)
Definition: types.h:1224
std::string pid
Definition: types.h:1065
devices_changed_callback_internal(internal_callback callback)
Definition: types.h:833
std::shared_ptr< rs2_frame_processor_callback > frame_processor_callback_ptr
Definition: types.h:823
frame_holder & operator=(frame_holder &&other)
float z
Definition: types.h:414
std::vector< uvc_device_info > _uvc_devices
Definition: types.h:1104
rs2_matchers
Specifies types of different matchers.
Definition: rs_types.h:126
bool file_exists(const char *filename)
devices_changed_callback(devices_changed_function_ptr on_devices_changed, void *user)
Definition: types.h:805
T & operator=(const T &v)
Definition: types.h:1471
std::ostringstream ss
Definition: types.h:56
std::shared_ptr< rs2_notifications_callback > notifications_callback_ptr
Definition: types.h:824
T clamp_val(T val, const T &min, const T &max)
Definition: types.h:118
callback_invocation_holder & operator=(const callback_invocation_holder &)=delete
Definition: concurrency.h:128
firmware_version(const std::string &name)
Definition: types.h:645
uint16_t vid
Definition: types.h:998
const void * get_data() const
Definition: types.h:1222
std::string datetime_string()
const int RS2_USER_QUEUE_SIZE
Definition: types.h:35
platform::stream_profile profile
Definition: types.h:558
notifications_callback(notifications_callback_function_ptr on_notification, void *user)
Definition: types.h:781
rs2_playback_status
Definition: rs_record_playback.h:19
T && value() &&
Definition: types.h:1484
bool operator<=(const firmware_version &other) const
Definition: types.h:648
bool is_empty() const
Definition: types.h:991
~frame_continuation()
Definition: types.h:1234
std::function< void(rs2_device_list *removed, rs2_device_list *added)> internal_callback
Definition: types.h:827
void start()
Definition: concurrency.h:276
std::chrono::high_resolution_clock::time_point ended
Definition: types.h:1146
int width
Definition: rs_types.h:57
int type
Definition: types.h:856
frame_holder()
Definition: types.h:613
size_t operator()(const librealsense::stream_profile &k) const
Definition: types.h:1521
uint16_t mi
Definition: types.h:1000
rs2_format
Format identifies how binary data is encoded within a frame.
Definition: rs_sensor.h:52
callback_invocation_holder(callback_invocation *invocation, callbacks_heap *owner)
Definition: types.h:1163
void wait_until_empty()
Definition: types.h:977
void release() override
Definition: types.h:794
optional_value()
Definition: types.h:1459
std::string id
Definition: types.h:1063
std::string id
Definition: types.h:1031
Definition: rs_types.h:34
int x
Definition: types.h:412
devices_data(std::vector< uvc_device_info > uvc_devices, std::vector< usb_device_info > usb_devices, std::vector< hid_device_info > hid_devices)
Definition: types.h:1095
frame_callback()
Definition: types.h:742
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:36
void on_notification(rs2_notification *notification) override
Definition: types.h:784
windows_backend_exception(const std::string &msg) noexcept
Definition: types.h:223
size_t copy_array(T(&dst)[size], const T(&src)[size])
Definition: types.h:62
bool operator<(const firmware_version &other) const
Definition: types.h:664
float3 z
Definition: types.h:416
#define LOG_INFO(...)
Definition: types.h:108
#define RS2_ENUM_HELPERS(TYPE, PREFIX)
Definition: types.h:382
int operator+=(const std::function< void(Args...)> &func)
Definition: types.h:1402
void commit()
Definition: types.h:697
int index
Definition: types.h:494
notification(rs2_notification_category category, int type, rs2_log_severity severity, std::string description)
Definition: types.h:848
int index
Definition: types.h:472
float x
Definition: types.h:415
frame_continuation()
Definition: types.h:1198
rs2_stream stream
Definition: types.h:471
Cross-stream extrinsics: encode the topology describing how the different devices are connected...
Definition: rs_sensor.h:79
const T & operator*() const &
Definition: types.h:1498
callback_invocation_holder()
Definition: types.h:1153
optional_value(const T &v)
Definition: types.h:1460
std::string unique_id
Definition: types.h:1036
const T * operator->() const
Definition: types.h:1490
rs2_exception_type get_exception_type() const noexcept
Definition: types.h:142
rs2_distortion model
Definition: rs_types.h:63
float y
Definition: types.h:415
std::string device_path
Definition: types.h:1067
bool operator>=(const firmware_version &other) const
Definition: types.h:665
frame_interface * frame
Definition: types.h:589
~callback_invocation_holder()
Definition: types.h:1167
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:93
lazy(lazy &&other) noexcept
Definition: types.h:289
rs2_notification_category
Category of the librealsense notifications.
Definition: rs_types.h:17
Definition: rs_sensor.h:38
devices_data(std::vector< uvc_device_info > uvc_devices, std::vector< usb_device_info > usb_devices)
Definition: types.h:1101
not_implemented_exception(const std::string &msg) noexcept
Definition: types.h:247
signal(signal &&other)
Definition: types.h:1348
double timestamp
Definition: types.h:859
float fy
Definition: rs_types.h:62
float fx
Definition: rs_types.h:61
frame_interface * operator->()
Definition: types.h:591
T && operator*() &&
Definition: types.h:1506
void set_callback(notifications_callback_ptr callback)
int y
Definition: types.h:412
std::string serialized_data
Definition: types.h:860
void on_frame(rs2_frame *frame) override
Definition: types.h:746
void release() override
Definition: types.h:770
Video stream intrinsics.
Definition: rs_types.h:55
callback_invocation_holder(callback_invocation_holder &&other)
Definition: types.h:1157
uint16_t vid
Definition: types.h:1033
polling_device_watcher(const platform::backend *backend_ref)
Definition: types.h:1277
small_heap()
Definition: types.h:921
rs2_intrinsics pad_crop_intrinsics(const rs2_intrinsics &i, int pad_crop)
Definition: types.h:890
~notifications_processor()
stream_descriptor()
Definition: types.h:490
notifications_processor()
void on_devices_changed(rs2_device_list *removed, rs2_device_list *added) override
Definition: types.h:808
float z
Definition: types.h:415
std::string description
Definition: types.h:858
firmware_version(int major, int minor, int patch, int build, bool is_any=false)
Definition: types.h:637
librealsense_exception(const std::string &msg, rs2_exception_type exception_type) noexcept
Definition: types.h:153
uint16_t pid
Definition: types.h:999
bool is_between(const firmware_version &from, const firmware_version &until) const
Definition: types.h:667
void start(platform::device_changed_callback callback) override
Definition: types.h:1309
std::shared_ptr< rs2_devices_changed_callback > devices_changed_callback_ptr
Definition: types.h:825
static uint64_t generate_id()
Definition: types.h:350
int subscribe(const std::function< void(Args...)> &func)
Definition: types.h:1365
size_t copy_2darray(T(&dst)[sizem][sizen], const T(&src)[sizem][sizen])
Definition: types.h:73
float & operator[](int i)
Definition: types.h:415
callback_invocation_holder & operator=(callback_invocation_holder &&other)
Definition: types.h:1172
void release() override
Definition: types.h:755
int height
Definition: rs_types.h:58
std::string unique_id
Definition: types.h:1001
void log_to_console(rs2_log_severity min_severity)
Definition: rs.hpp:19
firmware_version()
Definition: types.h:635
std::tuple< uint32_t, int, size_t > native_pixel_format_tuple
Definition: types.h:465
to_string & operator<<(const T &val)
Definition: types.h:57
devices_data(std::vector< usb_device_info > usb_devices)
Definition: types.h:1098
float3 operator+(const float3 &a, const float3 &b)
Definition: types.h:420
Definition: rs_types.hpp:55
float float_4[4]
Definition: types.h:375
void on_devices_changed(rs2_device_list *removed, rs2_device_list *added) override
Definition: types.h:837
bool operator-=(int token)
Definition: types.h:1407
unique_id(const unique_id &)=delete
void(* devices_changed_function_ptr)(rs2_device_list *removed, rs2_device_list *added, void *user)
Definition: types.h:797
rs2_log_severity
Severity of the librealsense logger.
Definition: rs_types.h:81
float y
Definition: types.h:413
void raise_notification(const notification)
rs2_log_severity severity
Definition: types.h:857
uint32_t pack(uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3)
Definition: types.h:905
const char * get_message() const noexcept
Definition: types.h:137
void operator()()
Definition: types.h:1209
void reset()
Definition: types.h:1216
frame_continuation(std::function< void()> continuation, const void *protected_data)
Definition: types.h:1200
size_t operator()(const librealsense::request_mapping &k) const
Definition: types.h:1550
Definition: rs_types.h:33
void reset()
Definition: types.h:728
linux_backend_exception(const std::string &msg) noexcept
Definition: types.h:208
lazy()
Definition: types.h:271
bool contains(const T &first, const T &second)
Definition: types.h:1562
float3x3 calc_rotation_from_rodrigues_angles(const std::vector< double > rot)
rs2_frame_metadata_value
Per-Frame-Metadata are set of read-only properties that might be exposed for each individual frame...
Definition: rs_frame.h:28
rs2_stream type
Definition: types.h:493
std::vector< hid_device_info > _hid_devices
Definition: types.h:1106
const T & operator*() const
Definition: types.h:284
struct rs2_frame rs2_frame
Definition: rs_types.h:150
std::string vid
Definition: types.h:1064
#define LOG_ERROR(...)
Definition: types.h:110
void copy(void *dst, void const *src, size_t size)
float ppy
Definition: rs_types.h:60
float x
Definition: types.h:413
uint32_t calc_crc32(const uint8_t *buf, size_t bufsize)
Definition: serialization.h:336
uint16_t pid
Definition: types.h:1034
rs2_format format
Definition: types.h:474
frame_holder(frame_interface *f)
Definition: types.h:600
rs2_timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.
Definition: rs_frame.h:19
std::string id
Definition: types.h:997