rs_serializable_device.hpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2020 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 #include "rs_types.hpp"
6 #include "rs_device.hpp"
7 #include <array>
8 #include <string>
9 
10 namespace rs2
11 {
13  {
14  public:
16  : rs2::device(d.get())
17  {
18  rs2_error* e = nullptr;
20  {
21  _dev = nullptr;
22  }
24  }
25 
27  {
28  std::string results;
29 
30  rs2_error* e = nullptr;
31  std::shared_ptr<rs2_raw_data_buffer> json_data(
32  rs2_serialize_json(_dev.get(), &e),
35 
36  auto size = rs2_get_raw_data_size(json_data.get(), &e);
38 
39  auto start = rs2_get_raw_data(json_data.get(), &e);
41 
42  results.insert(results.begin(), start, start + size);
43 
44  return results;
45  }
46 
47  void load_json(const std::string& json_content) const
48  {
49  rs2_error* e = nullptr;
50  rs2_load_json(_dev.get(),
51  json_content.data(),
52  (unsigned int)json_content.size(),
53  &e);
55  }
56  };
57 }
const std::shared_ptr< rs2_device > & get() const
Definition: rs_device.hpp:116
const unsigned char * rs2_get_raw_data(const rs2_raw_data_buffer *buffer, rs2_error **error)
Definition: rs.cpp:567
void rs2_load_json(rs2_device *dev, const void *json_content, unsigned content_size, rs2_error **error)
Definition: rs.cpp:3177
Definition: cah-model.h:10
GLsizei const GLchar *const * string
d
Definition: rmse.py:171
void rs2_delete_raw_data(const rs2_raw_data_buffer *buffer)
Definition: rs.cpp:581
e
Definition: rmse.py:177
int rs2_get_raw_data_size(const rs2_raw_data_buffer *buffer, rs2_error **error)
Definition: rs.cpp:574
rs2_raw_data_buffer * rs2_serialize_json(rs2_device *dev, rs2_error **error)
Definition: rs.cpp:3169
GLsizeiptr size
void load_json(const std::string &json_content) const
int rs2_is_device_extendable_to(const rs2_device *device, rs2_extension extension, rs2_error **error)
Definition: rs.cpp:1425
std::shared_ptr< rs2_device > _dev
Definition: rs_device.hpp:146
GLuint start
static void handle(rs2_error *e)
Definition: rs_types.hpp:144
std::string serialize_json() const


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:41