CARLA
Loading...
Searching...
No Matches
V2XSerializer.h
Go to the documentation of this file.
1// Copyright (c) 2026 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"
12
13#include <cstdint>
14#include <cstring>
15
16namespace carla {
17namespace sensor {
18
19 class SensorData;
20
21namespace s11n {
22
23 // ===========================================================================
24 // -- V2XSerializer ----------------------------------------------------------
25 // ===========================================================================
26
27 /// Serializes the CAM data generated by V2X sensors.
29 public:
30
31 template <typename Sensor>
32 static Buffer Serialize(
33 const Sensor &sensor,
34 const data::CAMDataS &data,
35 Buffer &&output);
36
38 };
39
40 template <typename Sensor>
42 const Sensor &,
43 const data::CAMDataS &data,
44 Buffer &&output) {
45 output.copy_from(data.MessageList);
46 return std::move(output);
47 }
48
49 /// Serializes the custom message data generated by V2X sensors.
51 public:
52
53 template <typename Sensor>
54 static Buffer Serialize(
55 const Sensor &sensor,
56 const data::CustomV2XDataS &data,
57 Buffer &&output);
58
60 };
61
62 template <typename Sensor>
64 const Sensor &,
65 const data::CustomV2XDataS &data,
66 Buffer &&output) {
67 output.copy_from(data.MessageList);
68 return std::move(output);
69 }
70
71} // namespace s11n
72} // namespace sensor
73} // namespace carla
A piece of raw data.
void copy_from(const T &source)
Copy source into this buffer. Allocates memory if necessary.
Wrapper around the raw data generated by a sensor plus some useful meta-information.
Definition RawData.h:21
std::vector< CAMData > MessageList
Definition V2XData.h:60
std::vector< CustomV2XData > MessageList
Definition V2XData.h:85
Serializes the CAM data generated by V2X sensors.
static Buffer Serialize(const Sensor &sensor, const data::CAMDataS &data, Buffer &&output)
static SharedPtr< SensorData > Deserialize(RawData &&data)
Serializes the custom message data generated by V2X sensors.
static Buffer Serialize(const Sensor &sensor, const data::CustomV2XDataS &data, Buffer &&output)
static SharedPtr< SensorData > Deserialize(RawData &&data)
This file contains definitions of common data structures used in traffic manager.
std::shared_ptr< T > SharedPtr
Definition Memory.h:15