converter-text.hpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2021 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
6 
7 #include "../converter.hpp"
8 
9 
10 namespace rs2 {
11 namespace tools {
12 namespace converter {
13 
14 
16 {
17  std::ostringstream s;
18 
19  if( ! f )
20  {
21  s << "[null]";
22  }
23  else
24  {
25  rs2::frameset fs( f );
26  if( fs )
27  {
28  s << "[";
29  fs.foreach_rs( [&s]( rs2::frame const & sf ) { s << frame_to_string( sf ); } );
30  s << "]";
31  }
32  else
33  {
34  auto p = f.get_profile();
35  s << "[" << rs2_stream_to_string( p.stream_type() );
36  s << "/" << p.unique_id(); //stream_index();
37  s << " #" << f.get_frame_number();
38  s << " @" << std::fixed << (double)f.get_timestamp();
39  s << "]";
40  }
41  }
42  return s.str();
43 }
44 
45 
47 {
49 
50 public:
52  : _streamType( streamType )
53  {
54  }
55 
56  std::string name() const override { return "TEXT converter"; }
57 
58  void convert( rs2::frame & frame ) override
59  {
60  std::cout << frame_to_string( frame ) << std::endl;
61  }
62 };
63 
64 } // namespace converter
65 } // namespace tools
66 } // namespace rs2
rs2::frame
Definition: rs_frame.hpp:345
rs2::frameset
Definition: rs_frame.hpp:947
rs2::tools::converter::converter_text::convert
void convert(rs2::frame &frame) override
Definition: converter-text.hpp:58
rs2_stream_to_string
const char * rs2_stream_to_string(rs2_stream stream)
Definition: to-string.cpp:766
string
GLsizei const GLchar *const * string
Definition: glad/glad/glad.h:2861
rs2::tools::converter::frame_to_string
std::string frame_to_string(rs2::frame const &f)
Definition: converter-text.hpp:15
rs2::tools::converter::converter_text::_streamType
rs2_stream _streamType
Definition: converter-text.hpp:48
f
GLdouble f
Definition: glad/glad/glad.h:1517
rs2
Definition: animated.h:9
rs2::tools::converter::converter_base
Definition: converter.hpp:25
RS2_STREAM_ANY
@ RS2_STREAM_ANY
Definition: rs_sensor.h:45
rs2::tools::converter::converter_text
Definition: converter-text.hpp:46
tools
Definition: lrs-device-controller.h:26
rs2::tools::converter::converter_text::name
std::string name() const override
Definition: converter-text.hpp:56
p
double p[GRIDW][GRIDH]
Definition: wave.c:109
rs2::tools::converter::converter_text::converter_text
converter_text(rs2_stream streamType=rs2_stream::RS2_STREAM_ANY)
Definition: converter-text.hpp:51
test-ts-same-fps.fs
fs
Definition: test-ts-same-fps.py:57
s
GLdouble s
Definition: glad/glad/glad.h:2441
rs2_stream
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:43


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