15 namespace device_serializer
42 os <<
id.device_index <<
"/" <<
id.sensor_index <<
"/" <<
id.stream_type <<
"/" <<
id.stream_index;
46 using nanoseconds = std::chrono::duration<uint64_t, std::nano>;
72 return T::get_type() ==
type();
76 std::shared_ptr<T>
as()
const 81 switch (T::get_type())
87 return std::static_pointer_cast<
T>(std::const_pointer_cast<
serialized_data>(shared_from_this()));
115 return serialized_data_type::frame;
129 return serialized_data_type::invalid_frame;
142 sensor_id(id),
option(o), option_id(opt_id)
145 std::shared_ptr<librealsense::option>
option;
163 return serialized_data_type::end_of_file;
176 sensor_id(id), notif(n)
182 return serialized_data_type::notificaion;
195 m_snapshots(snapshots)
201 auto snapshot_it = m_snapshots.find(t);
202 if (snapshot_it ==
std::end(m_snapshots))
206 return snapshot_it->second;
208 std::map<rs2_extension, std::shared_ptr<extension_snapshot>>
get_snapshots()
const 215 return m_snapshots.at(extension);
220 return m_snapshots[extension];
223 std::map<rs2_extension, std::shared_ptr<extension_snapshot>>
m_snapshots;
230 m_snapshots(sensor_extensions),
236 m_snapshots(sensor_extensions),
271 m_device_snapshots(device_extensios),
272 m_sensors_snapshot(sensors_snapshot),
273 m_extrinsics_map(extrinsics_map)
279 return m_sensors_snapshot;
283 return m_sensors_snapshot;
287 return m_device_snapshots;
291 return m_extrinsics_map;
327 virtual void write_device_description(
const device_snapshot& device_description) = 0;
333 virtual ~
writer() =
default;
339 virtual ~
reader() =
default;
341 virtual std::shared_ptr<serialized_data> read_next_data() = 0;
342 virtual void seek_to_time(
const nanoseconds& time) = 0;
344 virtual void reset() = 0;
345 virtual void enable_stream(
const std::vector<device_serializer::stream_identifier>& stream_ids) = 0;
346 virtual void disable_stream(
const std::vector<device_serializer::stream_identifier>& stream_ids) = 0;
348 virtual std::vector<std::shared_ptr<serialized_data>> fetch_last_frames(
const nanoseconds& seek_time) = 0;
device_snapshot(const snapshot_collection &device_extensios, const std::vector< sensor_snapshot > &sensors_snapshot, const std::map< stream_identifier, std::pair< uint32_t, rs2_extrinsics >> &extrinsics_map)
static serialized_data_type get_type()
serialized_data_type type() const override
std::map< stream_identifier, std::pair< uint32_t, rs2_extrinsics > > get_extrinsics_map() const
std::shared_ptr< extension_snapshot > & operator[](rs2_extension extension)
std::map< stream_identifier, std::pair< uint32_t, rs2_extrinsics > > m_extrinsics_map
stream_identifier stream_id
sensor_identifier sensor_id
snapshot_collection & get_sensor_extensions_snapshots()
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
static serialized_data_type get_type()
serialized_notification(device_serializer::nanoseconds time, sensor_identifier id, const notification &n)
const std::shared_ptr< extension_snapshot > & operator[](rs2_extension extension) const
sensor_identifier sensor_id
GLsizei const GLchar *const * string
std::vector< sensor_snapshot > & get_sensors_snapshots()
snapshot_collection m_snapshots
std::shared_ptr< librealsense::option > option
bool operator<(const stream_identifier &lhs, const stream_identifier &rhs)
uint32_t get_sensor_index() const
std::map< rs2_extension, std::shared_ptr< extension_snapshot > > get_snapshots() const
serialized_data_type type() const override
status
Defines return codes that SDK interfaces use. Negative values indicate errors, a zero value indicates...
snapshot_collection get_sensor_extensions_snapshots() const
snapshot_collection m_device_snapshots
std::ostream & operator<<(std::ostream &os, const stream_identifier &id)
serialized_data_type type() const override
std::shared_ptr< extension_snapshot > find(rs2_extension t) const
static serialized_data_type get_type()
stream_profiles m_streams
virtual device_serializer::nanoseconds get_timestamp() const
serialized_option(device_serializer::nanoseconds time, sensor_identifier id, rs2_option opt_id, std::shared_ptr< librealsense::option > o)
std::vector< std::shared_ptr< stream_profile_interface >> stream_profiles
serialized_data_type type() const override
rs2_stream
Streams are different types of data provided by RealSense devices.
std::chrono::duration< uint64_t, std::nano > nanoseconds
serialized_invalid_frame(device_serializer::nanoseconds time, stream_identifier id)
std::map< std::tuple< size_t, rs2_stream, size_t, rs2_stream >, rs2_extrinsics > device_extrinsics
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
std::vector< sensor_snapshot > m_sensors_snapshot
std::string get_file_name(const std::string &path)
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
stream_profiles get_stream_profiles() const
std::map< rs2_extension, std::shared_ptr< extension_snapshot > > m_snapshots
sensor_snapshot(uint32_t index, const snapshot_collection &sensor_extensions)
std::shared_ptr< T > as() const
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
serialized_frame(device_serializer::nanoseconds time, stream_identifier id, frame_holder f)
static serialized_data_type get_type()
serialized_data(const device_serializer::nanoseconds ×tamp=device_serializer::nanoseconds::max())
snapshot_collection get_device_extensions_snapshots() const
device_serializer::nanoseconds _timestamp
std::vector< sensor_snapshot > get_sensors_snapshots() const
snapshot_collection(const std::map< rs2_extension, std::shared_ptr< extension_snapshot >> &snapshots)
serialized_data_type type() const override
sensor_snapshot(uint32_t index, const snapshot_collection &sensor_extensions, stream_profiles streams)
bool operator==(const stream_identifier &lhs, const stream_identifier &rhs)
GeneratorWrapper< T > map(Func &&function, GeneratorWrapper< U > &&generator)
static serialized_data_type get_type()