forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
converter.hpp
59 lines (42 loc) · 1.5 KB
/
converter.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2018 Intel Corporation. All Rights Reserved.
#ifndef __RS_CONVERTER_CONVERTER_H
#define __RS_CONVERTER_CONVERTER_H
#include <unordered_map>
#include <unordered_set>
#include <thread>
#include <string>
#include <sstream>
#include <algorithm>
#include "librealsense2/rs.hpp"
namespace rs2 {
namespace tools {
namespace converter {
void metadata_to_txtfile(const rs2::frame& frm, const std::string& filename);
typedef unsigned long long frame_number_t;
class converter_base {
protected:
std::thread _worker;
std::vector<std::thread> _subWorkers;
std::unordered_map<int, std::unordered_set<frame_number_t>> _framesMap;
protected:
bool frames_map_get_and_set(rs2_stream streamType, frame_number_t frameNumber);
void wait_sub_workers();
template <typename F> void start_worker(const F& f)
{
_worker = std::thread(f);
}
template <typename F> void add_sub_worker(const F& f)
{
_subWorkers.emplace_back(f);
}
public:
virtual void convert(rs2::frame& frame) = 0;
virtual std::string name() const = 0;
virtual std::string get_statistics();
void wait();
};
}
}
}
#endif