CARLA
RadarSerializer.h
Go to the documentation of this file.
1 // Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
9 #include "carla/Memory.h"
10 #include "carla/sensor/RawData.h"
12 
13 #include <cstdint>
14 #include <cstring>
15 
16 namespace carla {
17 namespace sensor {
18 
19  class SensorData;
20 
21 namespace s11n {
22 
23  // ===========================================================================
24  // -- RadarSerializer --------------------------------------------------------
25  // ===========================================================================
26 
27  /// Serializes the data generated by Radar sensors.
29  public:
30 
31  template <typename Sensor>
32  static Buffer Serialize(
33  const Sensor &sensor,
34  const data::RadarData &measurement,
35  Buffer &&output);
36 
38  };
39 
40  template <typename Sensor>
42  const Sensor &,
43  const data::RadarData &measurement,
44  Buffer &&output) {
45  output.copy_from(measurement._detections);
46  return std::move(output);
47  }
48 
49 } // namespace s11n
50 } // namespace sensor
51 } // namespace carla
static SharedPtr< SensorData > Deserialize(RawData &&data)
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
Definition: Memory.h:20
static Buffer Serialize(const Sensor &sensor, const data::RadarData &measurement, Buffer &&output)
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
std::vector< RadarDetection > _detections
Definition: RadarData.h:74
Serializes the data generated by Radar sensors.
A piece of raw data.
Definition: carla/Buffer.h:42
void copy_from(const T &source)
Copy source into this buffer. Allocates memory if necessary.
Definition: carla/Buffer.h:305
Wrapper around the raw data generated by a sensor plus some useful meta-information.
Definition: RawData.h:21