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" 57 std::ostringstream
ss;
59 operator std::string()
const {
return ss.str(); }
62 template<
typename T,
size_t size>
65 assert(dst !=
nullptr && src !=
nullptr);
66 for (
size_t i = 0; i <
size; i++)
73 template<
typename T,
size_t sizem,
size_t sizen>
74 inline size_t copy_2darray(T(&dst)[sizem][sizen],
const T(&src)[sizem][sizen])
76 assert(dst !=
nullptr && src !=
nullptr);
77 for (
size_t i = 0; i < sizem; i++)
79 for (
size_t j = 0; j < sizen; j++)
81 dst[i][j] = src[i][j];
87 void copy(
void* dst,
void const* src,
size_t size);
98 #if BUILD_EASYLOGGINGPP 100 #define LOG_DEBUG(...) do { CLOG(DEBUG ,"librealsense") << __VA_ARGS__; } while(false) 101 #define LOG_INFO(...) do { CLOG(INFO ,"librealsense") << __VA_ARGS__; } while(false) 102 #define LOG_WARNING(...) do { CLOG(WARNING ,"librealsense") << __VA_ARGS__; } while(false) 103 #define LOG_ERROR(...) do { CLOG(ERROR ,"librealsense") << __VA_ARGS__; } while(false) 104 #define LOG_FATAL(...) do { CLOG(FATAL ,"librealsense") << __VA_ARGS__; } while(false) 106 #else // BUILD_EASYLOGGINGPP 108 #define LOG_DEBUG(...) do { ; } while(false) 109 #define LOG_INFO(...) do { ; } while(false) 110 #define LOG_WARNING(...) do { ; } while(false) 111 #define LOG_ERROR(...) do { ; } while(false) 112 #define LOG_FATAL(...) do { ; } while(false) 114 #endif // BUILD_EASYLOGGINGPP 118 template<
typename T>
123 const T t = val < min ? min : val;
124 return t > max ? max : t;
126 return std::min(std::max(val, min), max);
145 return _exception_type;
148 const char*
what() const noexcept
override 157 _exception_type(exception_type)
214 std::string generate_last_error_message(
const std::string& msg)
const 216 return msg +
" Last Error: " + strerror(errno);
254 #pragma pack(push, 1) 262 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];
272 lazy() : _init([]() { T t{};
return t; }) {}
273 lazy(std::function<T()> initializer) : _init(
std::move(initializer)) {}
292 std::lock_guard<std::mutex> lock(other._mtx);
293 if (!other._was_init)
295 _init = move(other._init);
300 _init = move(other._init);
302 _ptr = move(other._ptr);
308 return *
this =
lazy<T>(std::move(func));
313 std::lock_guard<std::mutex> lock1(_mtx);
314 std::lock_guard<std::mutex> lock2(other._mtx);
315 if (!other._was_init)
317 _init = move(other._init);
322 _init = move(other._init);
324 _ptr = move(other._ptr);
333 std::lock_guard<std::mutex> lock(_mtx);
336 _ptr = std::unique_ptr<T>(
new T(_init()));
342 mutable std::mutex _mtx;
343 mutable bool _was_init =
false;
344 std::function<T()> _init;
345 mutable std::unique_ptr<T> _ptr;
353 static std::atomic<uint64_t> id(0);
361 template<
typename T,
int sz>
370 std::stringstream
ss;
371 for (
auto i = 0; i <
arr_size(data); i++)
372 ss <<
" [" << i <<
"] = " << data[i] <<
"\t";
383 #define RS2_ENUM_HELPERS(TYPE, PREFIX) const char* get_string(TYPE value); \ 384 inline bool is_valid(TYPE value) { return value >= 0 && value < RS2_##PREFIX##_COUNT; } \ 385 inline std::ostream & operator << (std::ostream & out, TYPE value) { if(is_valid(value)) return out << get_string(value); else return out << (int)value; } \ 386 inline bool try_parse(const std::string& str, TYPE& res) \ 388 for (int i = 0; i < static_cast<int>(RS2_ ## PREFIX ## _COUNT); i++) { \ 389 auto v = static_cast<TYPE>(i); \ 390 if(str == get_string(v)) { res = v; return true; } \ 412 #pragma pack(push, 1) 414 struct float2 {
float x,
y;
float & operator [] (
int i) {
return (&x)[i]; } };
415 struct float3 {
float x, y,
z;
float & operator [] (
int i) {
return (&x)[i]; } };
416 struct float4 {
float x, y,
z, w;
float & operator [] (
int i) {
return (&x)[i]; } };
417 struct float3x3 {
float3 x, y,
z;
float & operator () (
int i,
int j) {
return (&x)[j][i]; } };
437 for (
int j = 0; j < 3; j++)
438 for (
int i = 0; i < 3; i++)
439 r.orientation(i, j) = a.
rotation[j * 3 + i];
446 for (
int j = 0; j < 3; j++)
447 for (
int i = 0; i < 3; i++)
454 for (
int i = 0; i < 3; i++) r.
translation[i] = 0.f;
455 for (
int j = 0; j < 3; j++)
456 for (
int i = 0; i < 3; i++)
457 r.
rotation[j * 3 + i] = (i == j) ? 1.f : 0.f;
468 typedef std::tuple<platform::stream_profile_tuple, native_pixel_format_tuple, std::vector<output_tuple>>
request_mapping_tuple;
507 rs2_format format_in,
509 : stream_desc(stream_desc_in),
511 stream_resolution(res_func)
522 void(*unpack)(
byte *
const dest[],
const byte * source,
int width,
int height);
528 auto it = std::find_if(
begin(uvc_profiles),
end(uvc_profiles),
531 for (
auto & o : outputs)
534 if (o.stream_desc.type == request.
stream && o.stream_desc.index == request.
index &&
535 res.width == request.
width && res.height == request.
height &&
541 if (it !=
end(uvc_profiles))
548 bool satisfies(
const stream_profile& request, uint32_t fourcc,
const std::vector<platform::stream_profile>& uvc_profiles)
const 550 auto uvc_profile = get_uvc_profile(request, fourcc, uvc_profiles);
551 return provides_stream(request, fourcc, uvc_profile) &&
557 for (
auto& o : outputs)
560 if (o.stream_desc.type == request.
stream && o.stream_desc.index == request.
index &&
561 res.width == request.
width && res.height == request.
height)
569 for (
auto& o : outputs)
570 if (o.stream_desc.type == stream && o.stream_desc.index == index)
576 operator std::vector<output_tuple>()
578 std::vector<output_tuple> tuple_outputs;
580 for (
auto output : outputs)
582 tuple_outputs.push_back(std::make_tuple(output.stream_desc.type, output.stream_desc.index, output.format));
584 return tuple_outputs;
596 size_t get_image_size(
int width,
int height)
const {
return width * height * plane_count * bytes_per_pixel; }
600 return std::make_tuple(fourcc, plane_count, bytes_per_pixel);
617 return std::make_tuple(profile, *pf, *unpacker);
646 operator bool()
const {
return frame !=
nullptr; }
660 other.frame =
nullptr;
676 int m_major, m_minor, m_patch, m_build;
678 std::string string_representation;
681 static std::vector<std::string> split(
const std::string& str);
682 static int parse_part(
const std::string&
name,
int part);
685 firmware_version() : m_major(0), m_minor(0), m_patch(0), m_build(0), is_any(true), string_representation(to_string()) {}
688 : m_major(major), m_minor(minor), m_patch(patch), m_build(build), is_any(is_any), string_representation(to_string()) {}
696 : 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()) {}
700 if (is_any || other.is_any)
return true;
701 if (m_major > other.m_major)
return false;
702 if ((m_major == other.m_major) && (m_minor > other.m_minor))
return false;
703 if ((m_major == other.m_major) && (m_minor == other.m_minor) && (m_patch > other.m_patch))
return false;
704 if ((m_major == other.m_major) && (m_minor == other.m_minor) && (m_patch == other.m_patch) && (m_build > other.m_build))
return false;
709 return is_any || (other.m_major == m_major && other.m_minor == m_minor && other.m_patch == m_patch && other.m_build == m_build);
712 bool operator> (
const firmware_version& other)
const {
return !(*
this < other) || is_any; }
719 return (from <= *
this) && (*
this <= until);
722 operator const char*()
const 724 return string_representation.c_str();
727 operator std::string()
const 729 return string_representation.c_str();
744 void activate() {
if (!active) { struct_ = reader(); active =
true; } }
745 template<
class U>
double get(U T::* field) { activate();
return static_cast<double>(struct_.*field); }
746 template<
class U,
class V>
void set(U T::* field, V
value) { activate(); struct_.*field =
static_cast<U
>(
value); }
747 void commit() {
if (active) writer(struct_); }
750 template<
class T,
class R,
class W>
753 return std::make_shared<struct_interface<T, R, W>>(r, w);
757 template <
typename T,
typename S>
762 last_input(
std::numeric_limits<T>::lowest()), accumulated(0) {
766 (std::numeric_limits<T>::max() < std::numeric_limits<S>::max()) &&
767 (std::numeric_limits<T>::lowest() >= std::numeric_limits<S>::lowest())
768 ,
"Wraparound class requirements are not met");
773 accumulated +=
static_cast<T
>(input - last_input);
775 return (accumulated);
778 void reset() { last_input = std::numeric_limits<T>::lowest(); accumulated = 0; }
795 operator bool()
const {
return fptr !=
nullptr; }
799 try { fptr(frame, user); }
catch (...)
801 LOG_ERROR(
"Received an execption from frame callback!");
815 : fptr(on_frame), user(user) {}
817 operator bool()
const {
return fptr !=
nullptr; }
821 try { fptr(frame, source, user); }
824 LOG_ERROR(
"Received an execption from frame callback!");
857 operator bool()
const {
return nptr !=
nullptr; }
861 try { nptr(notification, user); }
864 LOG_ERROR(
"Received an execption from frame callback!");
881 operator bool()
const {
return nptr !=
nullptr; }
885 try { nptr(removed, added, user); }
888 LOG_ERROR(
"Received an execption from frame callback!");
901 using internal_callback = std::function<void(rs2_device_list* removed, rs2_device_list* added)>;
908 : _callback(callback)
913 _callback(removed , added);
922 notification(rs2_notification_category category,
int type, rs2_log_severity severity, std::string description)
923 :category(category), type(type), severity(severity), description(description)
925 timestamp = std::chrono::duration<double, std::milli>(std::chrono::system_clock::now().time_since_epoch()).count();
942 virtual notification decode(
int value) = 0;
951 void set_callback(notifications_callback_ptr callback);
952 notifications_callback_ptr get_callback()
const;
953 void raise_notification(
const notification);
956 notifications_callback_ptr _callback;
957 std::mutex _callback_mutex;
966 return{ i.
width + pad_crop * 2, i.
height + pad_crop * 2, i.
ppx + pad_crop, i.
ppy + pad_crop,
972 const float sx =
static_cast<float>(width) / i.
width, sy = static_cast<float>(height) / i.
height;
979 inline uint32_t
pack(uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3)
981 return (c0 << 24) | (c1 << 16) | (c2 << 8) | c3;
984 template<
class T,
int C>
990 bool keep_allocating =
true;
991 std::condition_variable cv;
997 for (
auto i = 0; i < C; i++)
1000 buffer[i] = std::move(T());
1006 std::unique_lock<std::mutex> lock(mutex);
1007 if (!keep_allocating)
return nullptr;
1009 for (
auto i = 0; i < C; i++)
1023 if (item < buffer || item >= buffer + C)
1027 auto i = item - buffer;
1028 auto old_value = std::move(buffer[i]);
1029 buffer[i] = std::move(T());
1032 std::unique_lock<std::mutex> lock(mutex);
1047 std::unique_lock<std::mutex> lock(mutex);
1048 keep_allocating =
false;
1053 std::unique_lock<std::mutex> lock(mutex);
1055 const auto ready = [
this]()
1059 if (!ready() && !cv.wait_for(lock, std::chrono::hours(1000), ready))
1071 std::string
id =
"";
1078 operator std::string()
1080 std::stringstream s;
1081 s <<
"id- " <<
id <<
1082 "\nvid- " << std::hex << vid <<
1083 "\npid- " << std::hex << pid <<
1085 "\nunique_id- " << unique_id <<
1086 "\npath- " << device_path;
1095 return (a.
vid == b.
vid) &&
1112 operator std::string()
1114 std::stringstream s;
1116 s <<
"vid- " << std::hex << vid <<
1117 "\npid- " << std::hex << pid <<
1119 "\nunique_id- " << unique_id;
1128 return (a.
id == b.
id) &&
1143 operator std::string()
1145 std::stringstream s;
1146 s <<
"id- " <<
id <<
1147 "\nvid- " << std::hex << vid <<
1148 "\npid- " << std::hex << pid <<
1149 "\nunique_id- " << unique_id <<
1150 "\npath- " << device_path;
1159 return (a.
id == b.
id) &&
1169 devices_data(std::vector<uvc_device_info> uvc_devices, std::vector<usb_device_info> usb_devices, std::vector<hid_device_info> hid_devices)
1170 :_uvc_devices(uvc_devices), _usb_devices(usb_devices), _hid_devices(hid_devices) {}
1173 :_usb_devices(usb_devices) {}
1175 devices_data(std::vector<uvc_device_info> uvc_devices, std::vector<usb_device_info> usb_devices)
1176 :_uvc_devices(uvc_devices), _usb_devices(usb_devices) {}
1188 operator std::string()
1191 s = _uvc_devices.size()>0 ?
"uvc devices:\n" :
"";
1192 for (
auto uvc : _uvc_devices)
1198 s += _usb_devices.size()>0 ?
"usb devices:\n" :
"";
1199 for (
auto usb : _usb_devices)
1205 s += _hid_devices.size()>0 ?
"hid devices: \n" :
"";
1206 for (
auto hid : _hid_devices)
1219 std::chrono::high_resolution_clock::time_point
started;
1220 std::chrono::high_resolution_clock::time_point
ended;
1232 : invocation(other.invocation), owner(other.owner)
1234 other.invocation =
nullptr;
1238 : invocation(invocation), owner(owner)
1243 if (invocation) owner->deallocate(invocation);
1248 invocation = other.invocation;
1249 owner = other.owner;
1250 other.invocation =
nullptr;
1256 return invocation !=
nullptr;
1261 callbacks_heap* owner;
1266 std::function<void()> continuation;
1267 const void* protected_data =
nullptr;
1274 explicit frame_continuation(std::function<
void()> continuation,
const void* protected_data) : continuation(continuation), protected_data(protected_data) {}
1279 other.continuation = []() {};
1280 other.protected_data =
nullptr;
1286 continuation = []() {};
1287 protected_data =
nullptr;
1292 protected_data =
nullptr;
1293 continuation = [](){};
1296 const void*
get_data()
const {
return protected_data; }
1301 protected_data = other.protected_data;
1302 continuation = other.continuation;
1303 other.continuation = []() {};
1304 other.protected_data =
nullptr;
1320 std::function<
bool(
rs2_stream)> intrinsic_validator);
1327 std::function<bool(rs2_stream from_stream, rs2_stream to_stream)> extrinsic_validator;
1328 std::function<bool(rs2_stream stream)> intrinsic_validator;
1333 return std::find_if(data.begin(), data.end(), [](
byte b){
return b!=0; }) != data.end();
1345 uint32_t
calc_crc32(
const uint8_t *buf,
size_t bufsize);
1352 _backend(backend_ref),_active_object([this](
dispatcher::cancellable_timer cancellable_timer)
1354 polling(cancellable_timer);
1369 if(
list_changed(_devices_data.uvc_devices, curr.uvc_devices ) ||
1370 list_changed(_devices_data.usb_devices, curr.usb_devices ) ||
1371 list_changed(_devices_data.hid_devices, curr.hid_devices ))
1376 _callback(_devices_data, curr);
1377 _devices_data = curr;
1386 _callback = std::move(callback);
1387 _devices_data = { _backend->query_uvc_devices(),
1388 _backend->query_usb_devices(),
1389 _backend->query_hid_devices() };
1391 _active_object.start();
1396 _active_object.stop();
1398 _callback_inflight.wait_until_empty();
1404 callbacks_heap _callback_inflight;
1413 template<
typename HostingClass,
typename... Args>
1416 friend HostingClass;
1424 std::lock_guard<std::mutex> locker(other.m_mutex);
1425 m_subscribers = std::move(other.m_subscribers);
1427 other.m_subscribers.clear();
1432 std::lock_guard<std::mutex> locker(other.m_mutex);
1433 m_subscribers = std::move(other.m_subscribers);
1435 other.m_subscribers.clear();
1441 std::lock_guard<std::mutex> locker(m_mutex);
1444 for (
int i = 0; i < (std::numeric_limits<int>::max)(); i++)
1446 if (m_subscribers.find(i) == m_subscribers.end())
1455 m_subscribers.emplace(token, func);
1463 std::lock_guard<std::mutex> locker(m_mutex);
1465 bool retVal =
false;
1466 typename std::map<int, std::function<void(Args...)>>::iterator it = m_subscribers.find(token);
1467 if (it != m_subscribers.end())
1469 m_subscribers.erase(token);
1478 return subscribe(func);
1483 return unsubscribe(token);
1490 bool raise(Args... args)
1492 std::vector<std::function<void(Args...)>> functions;
1493 bool retVal =
false;
1495 std::unique_lock<std::mutex> locker(m_mutex);
1496 if (m_subscribers.size() > 0)
1498 typename std::map<int, std::function<void(Args...)>>::iterator it = m_subscribers.begin();
1499 while (it != m_subscribers.end())
1501 functions.emplace_back(it->second);
1507 if (functions.size() > 0)
1509 for (
auto func : functions)
1511 func(std::forward<Args>(args)...);
1520 bool operator()(Args... args)
1522 return raise(std::forward<Args>(args)...);
1526 std::map<int, std::function<void(Args...)>> m_subscribers;
1529 template <
typename T>
1536 operator bool()
const 1554 if (!_valid)
throw std::runtime_error(
"bad optional access");
1560 if (!_valid)
throw std::runtime_error(
"bad optional access");
1561 return std::move(_value);
1582 return std::move(_value);
1599 return (hash<uint32_t>()(k.
height))
1600 ^ (hash<uint32_t>()(k.
width))
1601 ^ (hash<uint32_t>()(k.
fps))
1602 ^ (hash<uint32_t>()(k.
format))
1603 ^ (hash<uint32_t>()(k.
stream));
1614 return (hash<uint32_t>()(k.
height))
1615 ^ (hash<uint32_t>()(k.
width))
1616 ^ (hash<uint32_t>()(k.
fps))
1617 ^ (hash<uint32_t>()(k.
format));
1629 ^ (hash<librealsense::pixel_format_unpacker*>()(k.
unpacker))
1630 ^ (hash<librealsense::native_pixel_format*>()(k.
pf));
1638 return first == second;
1642 std::vector<std::shared_ptr<T>>
subtract_sets(
const std::vector<std::shared_ptr<T>>& first,
const std::vector<std::shared_ptr<T>>& second)
1644 std::vector<std::shared_ptr<T>> results;
1645 std::for_each(first.begin(), first.end(), [&](std::shared_ptr<T> data)
1647 if (std::find_if(second.begin(), second.end(), [&](std::shared_ptr<T> new_dev) {
1651 results.push_back(data);
1667 else if (width < 640)
bool operator<(const request_mapping &first, const request_mapping &second)
Definition: types.h:624
int arr_size(T(&)[sz])
Definition: types.h:362
internal_frame_callback(T on_frame)
Definition: types.h:837
S calc(const T input)
Definition: types.h:771
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:418
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:970
float3 x
Definition: types.h:417
resolution_func stream_resolution
Definition: types.h:516
const double TIMESTAMP_USEC_TO_MSEC
Definition: types.h:50
bool requires_processing() const
Definition: types.h:620
T & value() &
Definition: types.h:1552
void deallocate(T *item)
Definition: types.h:1021
void stop_allocation()
Definition: types.h:1045
std::string device_path
Definition: types.h:1076
T * allocate()
Definition: types.h:1004
camera_disconnected_exception(const std::string &msg) noexcept
Definition: types.h:192
rs2_exception_type
Exception types are the different categories of errors that RealSense API might return.
Definition: rs_types.h:29
T & operator*() &
Definition: types.h:1576
int get_size() const
Definition: types.h:1066
wrong_api_call_sequence_exception(const std::string &msg) noexcept
Definition: types.h:240
float x
Definition: types.h:415
std::vector< usb_device_info > _usb_devices
Definition: types.h:1179
signal()
Definition: types.h:1418
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:442
unsigned char byte
Definition: types.h:33
io_exception(const std::string &msg) noexcept
Definition: types.h:185
Definition: streaming.h:63
std::tuple< rs2_stream, int, rs2_format > output_tuple
Definition: types.h:467
bool has_value() const
Definition: types.h:1540
Definition: rs_types.hpp:41
rs2_notification_category category
Definition: types.h:929
void(* rs2_frame_processor_callback_ptr)(rs2_frame *, rs2_source *, void *)
Definition: rs_types.h:178
std::shared_ptr< rs2_frame_callback > frame_callback_ptr
Definition: types.h:896
notifications_callback()
Definition: types.h:854
void stop() override
Definition: types.h:1394
float w
Definition: types.h:416
rs2_distortion
Distortion model: defines how pixel coordinates should be mapped to sensor coordinates.
Definition: rs_types.h:44
float translation[3]
Definition: rs_sensor.h:85
Definition: concurrency.h:268
std::shared_ptr< struct_interface< T, R, W > > make_struct_interface(R r, W w)
Definition: types.h:751
Definition: rs_types.h:36
std::string array2str(T &data)
Definition: types.h:368
bool operator==(const firmware_version &other) const
Definition: types.h:707
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:71
res_type get_res_type(uint32_t width, uint32_t height)
Definition: types.h:1663
internal_frame_processor_fptr_callback()
Definition: types.h:813
float y
Definition: types.h:415
frame_holder(frame_holder &&other)
Definition: types.h:657
const char * what() const noexcept override
Definition: types.h:148
Definition: concurrency.h:125
std::vector< std::shared_ptr< stream_profile_interface > > original_requests
Definition: types.h:613
std::chrono::high_resolution_clock::time_point started
Definition: types.h:1219
float3 operator*(const float3 &a, float b)
Definition: types.h:422
bool operator==(const float3 &a, const float3 &b)
Definition: types.h:420
void polling(dispatcher::cancellable_timer cancellable_timer)
Definition: types.h:1364
stream_descriptor(rs2_stream type, int index=0)
Definition: types.h:492
uint32_t width
Definition: types.h:474
R reader
Definition: types.h:738
std::function< void(frame_interface *)> on_frame
Definition: streaming.h:103
void(* frame_callback_function_ptr)(rs2_frame *frame, void *user)
Definition: types.h:785
T struct_
Definition: types.h:737
sql::statement::iterator end(sql::statement &stmt)
backend_exception(const std::string &msg, rs2_exception_type exception_type) noexcept
Definition: types.h:200
std::string unique_id
Definition: types.h:1140
devices_changed_callback()
Definition: types.h:878
frame_callback(frame_callback_function_ptr on_frame, void *user)
Definition: types.h:793
float3 y
Definition: types.h:417
lazy(std::function< T()> initializer)
Definition: types.h:273
T * operator->() const
Definition: types.h:275
float coeffs[5]
Definition: rs_types.h:65
void(* notifications_callback_function_ptr)(rs2_notification *notification, void *user)
Definition: types.h:847
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:1642
void release() override
Definition: types.h:892
bool check_not_all_zeros(std::vector< byte > data)
Definition: types.h:1331
void log_to_file(rs2_log_severity min_severity, const char *file_path)
Definition: rs.hpp:26
signal & operator=(signal &&other)
Definition: types.h:1430
librealsense::small_heap< callback_invocation, 1 > callbacks_heap
Definition: types.h:1223
Definition: rs_types.h:32
void on_frame(rs2_frame *fref) override
Definition: types.h:839
static firmware_version any()
Definition: types.h:690
uint32_t height
Definition: types.h:474
T * operator->()
Definition: types.h:1568
bool unsubscribe(int token)
Definition: types.h:1461
void activate()
Definition: types.h:744
rs2_extrinsics identity_matrix()
Definition: types.h:451
void release() override
Definition: types.h:916
native_pixel_format * pf
Definition: types.h:609
pixel_format_unpacker * unpacker
Definition: types.h:610
std::tuple< platform::stream_profile_tuple, native_pixel_format_tuple, std::vector< output_tuple > > request_mapping_tuple
Definition: types.h:468
float rotation[9]
Definition: rs_sensor.h:84
uint32_t fps
Definition: types.h:474
lazy & operator=(lazy &&other) noexcept
Definition: types.h:311
lazy & operator=(std::function< T()> func) noexcept
Definition: types.h:306
res_type
Definition: types.h:1657
float3x3 transpose(const float3x3 &a)
Definition: types.h:428
float ppx
Definition: rs_types.h:60
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:740
pose inverse(const pose &a)
Definition: types.h:432
float3 position
Definition: types.h:418
bool try_sleep(int ms)
Definition: concurrency.h:135
pose to_pose(const rs2_extrinsics &a)
Definition: types.h:433
struct_interface(R r, W w)
Definition: types.h:742
std::unique_ptr< rs2_log_callback, void(*)(rs2_log_callback *)> log_callback_ptr
Definition: types.h:895
uint16_t mi
Definition: types.h:1109
Definition: processing.h:12
arithmetic_wraparound()
Definition: types.h:761
std::function< void(devices_data old, devices_data curr)> device_changed_callback
Definition: types.h:1216
invalid_value_exception(const std::string &msg) noexcept
Definition: types.h:232
Definition: rs_types.h:38
T & operator*()
Definition: types.h:280
W writer
Definition: types.h:739
unrecoverable_exception(const std::string &msg, rs2_exception_type exception_type) noexcept
Definition: types.h:175
~polling_device_watcher()
Definition: types.h:1359
bool operator!=(const firmware_version &other) const
Definition: types.h:713
frame_continuation(frame_continuation &&other)
Definition: types.h:1277
Definition: rs_types.h:33
frame_continuation & operator=(frame_continuation &&other)
Definition: types.h:1298
Definition: rs_types.hpp:34
std::string pid
Definition: types.h:1139
devices_changed_callback_internal(internal_callback callback)
Definition: types.h:907
std::shared_ptr< rs2_frame_processor_callback > frame_processor_callback_ptr
Definition: types.h:897
float z
Definition: types.h:415
Definition: streaming.h:46
sql::statement::iterator begin(sql::statement &stmt)
std::vector< uvc_device_info > _uvc_devices
Definition: types.h:1178
rs2_matchers
Specifies types of different matchers.
Definition: rs_types.h:127
bool file_exists(const char *filename)
devices_changed_callback(devices_changed_function_ptr on_devices_changed, void *user)
Definition: types.h:879
T & operator=(const T &v)
Definition: types.h:1545
std::ostringstream ss
Definition: types.h:57
std::shared_ptr< rs2_notifications_callback > notifications_callback_ptr
Definition: types.h:898
T clamp_val(T val, const T &min, const T &max)
Definition: types.h:119
Definition: concurrency.h:128
firmware_version(const std::string &name)
Definition: types.h:695
uint16_t vid
Definition: types.h:1072
const void * get_data() const
Definition: types.h:1296
std::string datetime_string()
const int RS2_USER_QUEUE_SIZE
Definition: types.h:35
internal_frame_processor_fptr_callback(rs2_frame_processor_callback_ptr on_frame, void *user)
Definition: types.h:814
platform::stream_profile profile
Definition: types.h:608
notifications_callback(notifications_callback_function_ptr on_notification, void *user)
Definition: types.h:855
rs2_playback_status
Definition: rs_record_playback.h:19
T && value() &&
Definition: types.h:1558
bool operator<=(const firmware_version &other) const
Definition: types.h:698
bool is_empty() const
Definition: types.h:1065
~frame_continuation()
Definition: types.h:1308
std::function< void(rs2_device_list *removed, rs2_device_list *added)> internal_callback
Definition: types.h:901
uint32_t width
Definition: types.h:500
std::chrono::high_resolution_clock::time_point ended
Definition: types.h:1220
int width
Definition: rs_types.h:58
int type
Definition: types.h:930
frame_holder()
Definition: types.h:663
size_t operator()(const librealsense::stream_profile &k) const
Definition: types.h:1595
void on_frame(rs2_frame *frame, rs2_source *source) override
Definition: types.h:818
uint16_t mi
Definition: types.h:1074
rs2_format
Format identifies how binary data is encoded within a frame.
Definition: rs_sensor.h:55
callback_invocation_holder(callback_invocation *invocation, callbacks_heap *owner)
Definition: types.h:1237
void wait_until_empty()
Definition: types.h:1051
void release() override
Definition: types.h:868
optional_value()
Definition: types.h:1533
std::string id
Definition: types.h:1137
std::string id
Definition: types.h:1105
Definition: rs_types.h:35
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:1169
frame_callback()
Definition: types.h:792
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:38
void on_notification(rs2_notification *notification) override
Definition: types.h:858
windows_backend_exception(const std::string &msg) noexcept
Definition: types.h:224
size_t copy_array(T(&dst)[size], const T(&src)[size])
Definition: types.h:63
bool operator<(const firmware_version &other) const
Definition: types.h:714
float3 z
Definition: types.h:417
#define LOG_INFO(...)
Definition: types.h:109
#define RS2_ENUM_HELPERS(TYPE, PREFIX)
Definition: types.h:383
int operator+=(const std::function< void(Args...)> &func)
Definition: types.h:1476
void commit()
Definition: types.h:747
int index
Definition: types.h:495
notification(rs2_notification_category category, int type, rs2_log_severity severity, std::string description)
Definition: types.h:922
rs2_format format
Definition: types.h:515
int index
Definition: types.h:473
float x
Definition: types.h:416
frame_continuation()
Definition: types.h:1272
rs2_stream stream
Definition: types.h:472
Cross-stream extrinsics: encode the topology describing how the different devices are connected...
Definition: rs_sensor.h:82
const T & operator*() const &
Definition: types.h:1572
callback_invocation_holder()
Definition: types.h:1227
optional_value(const T &v)
Definition: types.h:1534
std::string unique_id
Definition: types.h:1110
const T * operator->() const
Definition: types.h:1564
rs2_exception_type get_exception_type() const noexcept
Definition: types.h:143
rs2_distortion model
Definition: rs_types.h:64
float y
Definition: types.h:416
stream_output(stream_descriptor stream_desc_in, rs2_format format_in, resolution_func res_func=[](resolution res) {return res;})
Definition: types.h:506
std::string device_path
Definition: types.h:1141
bool operator>=(const firmware_version &other) const
Definition: types.h:715
frame_interface * frame
Definition: types.h:639
~callback_invocation_holder()
Definition: types.h:1241
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:94
lazy(lazy &&other) noexcept
Definition: types.h:290
rs2_notification_category
Category of the librealsense notifications.
Definition: rs_types.h:17
Definition: rs_sensor.h:40
devices_data(std::vector< uvc_device_info > uvc_devices, std::vector< usb_device_info > usb_devices)
Definition: types.h:1175
not_implemented_exception(const std::string &msg) noexcept
Definition: types.h:248
signal(signal &&other)
Definition: types.h:1422
double timestamp
Definition: types.h:933
stream_descriptor stream_desc
Definition: types.h:514
float fy
Definition: rs_types.h:63
float fx
Definition: rs_types.h:62
frame_interface * operator->()
Definition: types.h:641
T && operator*() &&
Definition: types.h:1580
int y
Definition: types.h:413
std::string serialized_data
Definition: types.h:934
void on_frame(rs2_frame *frame) override
Definition: types.h:796
void release() override
Definition: types.h:844
Video stream intrinsics.
Definition: rs_types.h:56
callback_invocation_holder(callback_invocation_holder &&other)
Definition: types.h:1231
uint16_t vid
Definition: types.h:1107
polling_device_watcher(const platform::backend *backend_ref)
Definition: types.h:1351
small_heap()
Definition: types.h:995
rs2_intrinsics pad_crop_intrinsics(const rs2_intrinsics &i, int pad_crop)
Definition: types.h:964
stream_descriptor()
Definition: types.h:491
void on_devices_changed(rs2_device_list *removed, rs2_device_list *added) override
Definition: types.h:882
float z
Definition: types.h:416
std::string description
Definition: types.h:932
firmware_version(int major, int minor, int patch, int build, bool is_any=false)
Definition: types.h:687
librealsense_exception(const std::string &msg, rs2_exception_type exception_type) noexcept
Definition: types.h:154
uint16_t pid
Definition: types.h:1073
bool is_between(const firmware_version &from, const firmware_version &until) const
Definition: types.h:717
void start(platform::device_changed_callback callback) override
Definition: types.h:1383
std::shared_ptr< rs2_devices_changed_callback > devices_changed_callback_ptr
Definition: types.h:899
static uint64_t generate_id()
Definition: types.h:351
int subscribe(const std::function< void(Args...)> &func)
Definition: types.h:1439
size_t copy_2darray(T(&dst)[sizem][sizen], const T(&src)[sizem][sizen])
Definition: types.h:74
callback_invocation_holder & operator=(callback_invocation_holder &&other)
Definition: types.h:1246
void release() override
Definition: types.h:805
int height
Definition: rs_types.h:59
std::string unique_id
Definition: types.h:1075
void log_to_console(rs2_log_severity min_severity)
Definition: rs.hpp:19
firmware_version()
Definition: types.h:685
std::tuple< uint32_t, int, size_t > native_pixel_format_tuple
Definition: types.h:466
to_string & operator<<(const T &val)
Definition: types.h:58
devices_data(std::vector< usb_device_info > usb_devices)
Definition: types.h:1172
float3 operator+(const float3 &a, const float3 &b)
Definition: types.h:421
Definition: rs_types.hpp:55
float float_4[4]
Definition: types.h:376
void on_devices_changed(rs2_device_list *removed, rs2_device_list *added) override
Definition: types.h:911
bool operator-=(int token)
Definition: types.h:1481
void(* devices_changed_function_ptr)(rs2_device_list *removed, rs2_device_list *added, void *user)
Definition: types.h:871
rs2_log_severity
Severity of the librealsense logger.
Definition: rs_types.h:82
float y
Definition: types.h:414
rs2_log_severity severity
Definition: types.h:931
uint32_t pack(uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3)
Definition: types.h:979
const char * get_message() const noexcept
Definition: types.h:138
void operator()()
Definition: types.h:1283
void reset()
Definition: types.h:1290
std::function< resolution(resolution res)> resolution_func
Definition: types.h:503
frame_continuation(std::function< void()> continuation, const void *protected_data)
Definition: types.h:1274
size_t operator()(const librealsense::request_mapping &k) const
Definition: types.h:1624
Definition: rs_types.h:34
void release() override
Definition: types.h:828
void reset()
Definition: types.h:778
linux_backend_exception(const std::string &msg) noexcept
Definition: types.h:209
lazy()
Definition: types.h:272
bool contains(const T &first, const T &second)
Definition: types.h:1636
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:494
std::vector< hid_device_info > _hid_devices
Definition: types.h:1180
const T & operator*() const
Definition: types.h:285
struct rs2_frame rs2_frame
Definition: rs_types.h:151
std::string vid
Definition: types.h:1138
#define LOG_ERROR(...)
Definition: types.h:111
void copy(void *dst, void const *src, size_t size)
float ppy
Definition: rs_types.h:61
uint32_t calc_crc32(const uint8_t *buf, size_t bufsize)
uint16_t pid
Definition: types.h:1108
rs2_format format
Definition: types.h:475
frame_holder(frame_interface *f)
Definition: types.h:650
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:1071