composite-frame.h
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 #include "frame.h"
7 
8 namespace librealsense {
9 class composite_frame : public frame
10 {
11 public:
13  : frame()
14  {
15  }
16 
17  frame_interface * get_frame( int i ) const
18  {
19  auto frames = get_frames();
20  return frames[i];
21  }
22 
23  frame_interface ** get_frames() const { return (frame_interface **)data.data(); }
24 
25  const frame_interface * first() const { return get_frame( 0 ); }
26  frame_interface * first() { return get_frame( 0 ); }
27 
28  void keep() override
29  {
30  auto frames = get_frames();
31  for( size_t i = 0; i < get_embedded_frames_count(); i++ )
32  if( frames[i] )
33  frames[i]->keep();
34  frame::keep();
35  }
36 
37  size_t get_embedded_frames_count() const { return data.size() / sizeof( rs2_frame * ); }
38 
39  // In the next section we make the composite frame "look and feel" like the first of its
40  // children
41  frame_header const & get_header() const override { return first()->get_header(); }
43  {
44  return first()->get_frame_metadata( frame_metadata );
45  }
47  {
48  return first()->supports_frame_metadata( frame_metadata );
49  }
50  int get_frame_data_size() const override { return first()->get_frame_data_size(); }
51  const byte * get_frame_data() const override { return first()->get_frame_data(); }
52  rs2_time_t get_frame_timestamp() const override { return first()->get_frame_timestamp(); }
54  {
56  }
57  unsigned long long get_frame_number() const override
58  {
59  if( first() )
60  return first()->get_frame_number();
61  else
62  return frame::get_frame_number();
63  }
64  rs2_time_t get_frame_system_time() const override { return first()->get_frame_system_time(); }
65  std::shared_ptr< sensor_interface > get_sensor() const override
66  {
67  return first()->get_sensor();
68  }
69 };
70 
72 } // namespace librealsense
virtual rs2_metadata_type get_frame_metadata(const rs2_frame_metadata_value &frame_metadata) const =0
virtual const byte * get_frame_data() const =0
virtual rs2_timestamp_domain get_frame_timestamp_domain() const =0
frame_header const & get_header() const override
int get_frame_data_size() const override
rs2_time_t get_frame_system_time() const override
unsigned long long get_frame_number() const override
Definition: frame.cpp:180
virtual frame_header const & get_header() const =0
frame_interface ** get_frames() const
const frame_interface * first() const
MAP_EXTENSION(RS2_EXTENSION_AUTO_CALIBRATED_DEVICE, auto_calibrated_interface)
rs2_time_t get_frame_timestamp() const override
std::shared_ptr< sensor_interface > get_sensor() const override
virtual rs2_time_t get_frame_timestamp() const =0
bool supports_frame_metadata(const rs2_frame_metadata_value &frame_metadata) const override
const byte * get_frame_data() const override
unsigned long long get_frame_number() const override
void keep() override
Definition: frame.cpp:79
unsigned char byte
Definition: src/types.h:40
virtual std::shared_ptr< sensor_interface > get_sensor() const =0
virtual rs2_time_t get_frame_system_time() const =0
virtual int get_frame_data_size() const =0
rs2_metadata_type get_frame_metadata(const rs2_frame_metadata_value &frame_metadata) const override
long long rs2_metadata_type
Definition: rs_types.h:302
frame_interface * get_frame(int i) const
int i
double rs2_time_t
Definition: rs_types.h:301
rs2_timestamp_domain get_frame_timestamp_domain() const override
virtual unsigned long long get_frame_number() const =0
Definition: parser.hpp:153
rs2_frame_metadata_value
Per-Frame-Metadata is the set of read-only properties that might be exposed for each individual frame...
Definition: rs_frame.h:29
struct rs2_frame rs2_frame
Definition: rs_types.h:262
virtual bool supports_frame_metadata(const rs2_frame_metadata_value &frame_metadata) const =0
size_t get_embedded_frames_count() const
rs2_timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.
Definition: rs_frame.h:19


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