converter.hpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2018 Intel Corporation. All Rights Reserved.
3 
4 #ifndef __RS_CONVERTER_CONVERTER_H
5 #define __RS_CONVERTER_CONVERTER_H
6 
7 #include <unordered_map>
8 #include <unordered_set>
9 #include <thread>
10 #include <string>
11 #include <sstream>
12 #include <algorithm>
13 
14 #include "librealsense2/rs.hpp"
15 
16 
17 namespace rs2 {
18  namespace tools {
19  namespace converter {
20 
21  void metadata_to_txtfile(const rs2::frame& frm, const std::string& filename);
22 
23  typedef unsigned long long frame_number_t;
24 
26  protected:
27  std::thread _worker;
28  std::vector<std::thread> _subWorkers;
29  std::unordered_map<int, std::unordered_set<frame_number_t>> _framesMap;
30 
31  protected:
32  bool frames_map_get_and_set(rs2_stream streamType, frame_number_t frameNumber);
33  void wait_sub_workers();
34 
35  template <typename F> void start_worker(const F& f)
36  {
37  _worker = std::thread(f);
38  }
39 
40  template <typename F> void add_sub_worker(const F& f)
41  {
42  _subWorkers.emplace_back(f);
43  }
44 
45  public:
46  virtual void convert(rs2::frame& frame) = 0;
47  virtual std::string name() const = 0;
48 
49  virtual std::string get_statistics();
50 
51  void wait();
52  };
53 
54  }
55  }
56 }
57 
58 
59 #endif
rs2::tools::converter::converter_base::_framesMap
std::unordered_map< int, std::unordered_set< frame_number_t > > _framesMap
Definition: converter.hpp:29
rs2::frame
Definition: rs_frame.hpp:345
rs2::tools::converter::converter_base::convert
virtual void convert(rs2::frame &frame)=0
string
GLsizei const GLchar *const * string
Definition: glad/glad/glad.h:2861
rs2::tools::converter::converter_base::wait_sub_workers
void wait_sub_workers()
Definition: converter.cpp:47
rs2::tools::converter::converter_base::add_sub_worker
void add_sub_worker(const F &f)
Definition: converter.hpp:40
rs.hpp
f
GLdouble f
Definition: glad/glad/glad.h:1517
rs2
Definition: animated.h:9
rs2::tools::converter::converter_base::frames_map_get_and_set
bool frames_map_get_and_set(rs2_stream streamType, frame_number_t frameNumber)
Definition: converter.cpp:31
rs2::tools::converter::converter_base
Definition: converter.hpp:25
tools
Definition: lrs-device-controller.h:26
test-projection-from-recording.filename
filename
Definition: test-projection-from-recording.py:15
rs2::tools::converter::converter_base::wait
void wait()
Definition: converter.cpp:57
rs2::tools::converter::metadata_to_txtfile
void metadata_to_txtfile(const rs2::frame &frm, const std::string &filename)
Definition: converter.cpp:9
rs2::tools::converter::converter_base::name
virtual std::string name() const =0
rs2::tools::converter::converter_base::start_worker
void start_worker(const F &f)
Definition: converter.hpp:35
rs2::tools::converter::converter_base::get_statistics
virtual std::string get_statistics()
Definition: converter.cpp:62
rs2::tools::converter::converter_base::_worker
std::thread _worker
Definition: converter.hpp:27
rs2::tools::converter::frame_number_t
unsigned long long frame_number_t
Definition: converter.hpp:23
rs2_stream
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:43
rs2::tools::converter::converter_base::_subWorkers
std::vector< std::thread > _subWorkers
Definition: converter.hpp:28


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Fri Aug 2 2024 08:30:01