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
virtual void convert(rs2::frame &frame)=0
Definition: animated.h:9
bool frames_map_get_and_set(rs2_stream streamType, frame_number_t frameNumber)
Definition: converter.cpp:31
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:42
void metadata_to_txtfile(const rs2::frame &frm, const std::string &filename)
Definition: converter.cpp:9
std::vector< std::thread > _subWorkers
Definition: converter.hpp:28
GLdouble f
virtual std::string name() const =0
unsigned long long frame_number_t
Definition: converter.hpp:23
virtual std::string get_statistics()
Definition: converter.cpp:62
std::unordered_map< int, std::unordered_set< frame_number_t > > _framesMap
Definition: converter.hpp:29


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Thu Dec 22 2022 03:43:16