profile.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2015 Intel Corporation. All Rights Reserved.
3 
4 #include "profile.h"
6 #include "media/ros/ros_writer.h"
7 
8 namespace librealsense
9 {
10  namespace pipeline
11  {
12  profile::profile(std::shared_ptr<device_interface> dev,
14  const std::string& to_file) :
15  _dev(dev), _to_file(to_file)
16  {
17  if (!to_file.empty())
18  {
19  if (!dev)
20  throw librealsense::invalid_value_exception("Failed to create a profile, device is null");
21 
22  _dev = std::make_shared<record_device>(dev, std::make_shared<ros_writer>(to_file, dev->compress_while_record()));
23  }
24  _multistream = config.resolve(_dev.get());
25  }
26 
27  std::shared_ptr<device_interface> profile::get_device()
28  {
29  //profile can be retrieved from a pipeline_config and pipeline::start()
30  //either way, it is created by the pipeline
31 
32  //TODO: handle case where device has disconnected and reconnected
33  //TODO: remember to recreate the device as record device in case of to_file.empty() == false
34  if (!_dev)
35  {
36  throw std::runtime_error("Device is unavailable");
37  }
38  return _dev;
39  }
40 
42  {
43  auto profiles_per_sensor = _multistream.get_profiles_per_sensor();
45  for (auto&& kvp : profiles_per_sensor)
46  for (auto&& p : kvp.second)
47  profiles.push_back(p);
48 
49  return profiles;
50  }
51  }
52 }
GLfloat GLfloat p
Definition: glext.h:12687
std::shared_ptr< device_interface > get_device()
Definition: profile.cpp:27
stream_profiles get_active_streams() const
Definition: profile.cpp:41
GLsizei const GLchar *const * string
Definition: parser.hpp:154
util::config::multistream _multistream
Definition: profile.h:18
std::map< int, stream_profiles > get_profiles_per_sensor() const
Definition: resolver.h:167
multistream resolve(device_interface *dev)
Definition: resolver.h:266
std::vector< std::shared_ptr< stream_profile_interface >> stream_profiles
Definition: streaming.h:165
profile(std::shared_ptr< device_interface > dev, util::config config, const std::string &file="")
Definition: profile.cpp:12
std::shared_ptr< device_interface > _dev
Definition: profile.h:20


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:39